这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Bosun opentsdb queries ignore "dropcounter" in rate options #2409

@annettejanewilson

Description

@annettejanewilson

Summary

Although inadequately documented in OpenTSDB, the syntax for expressing the rate option "dropResets: true" is in fact rate{dropcounter} as can be seen in QueryRpc.java in the OpenTSDB source. Unfortunately, Bosun parses the OpenTSDB query string itself and doesn't recognise this syntax, silently dropping {dropcounter} from the query it sends to OpenTSDB.

Demonstration

For example, if I go into the Bosun expression editor and run this query:

q("sum:1m-last-null:rate{dropcounter}:slingshot.services.falcon.proxy.hrsp_5xx", "10m", "1m")

I see listed the queries performed:

Queries
end=2019/04/16-02:30:00&m=sum:1m-last-null:rate:slingshot.services.falcon.proxy.hrsp_5xx&start=2019/04/16-02:21:00

The {dropcounter} option has vanished, contrary to my expectations.

By contrast, if I run this query:

q("sum:1m-last-null:rate{counter}:slingshot.services.falcon.proxy.hrsp_5xx", "10m", "1m")

I see this instead:

Queries
end=2019/04/16-02:30:00&m=sum:1m-last-null:rate{counter}:slingshot.services.falcon.proxy.hrsp_5xx&start=2019/04/16-02:21:00

This time the rate option {counter} is preserved, as expected.

Analysis

Bosun's OpenTSDB code does not know about dropResets:
tsdb.go:453-456:

type RateOptions struct {
	Counter    bool  `json:"counter,omitempty"`
	CounterMax int64 `json:"counterMax,omitempty"`
	ResetValue int64 `json:"resetValue,omitempty"`
}

Nor recognise dropcounter:
tsdb.go:519:

q.RateOptions.Counter = sp[0] == "counter"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions