Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downsample in OpenTSDB #31

Open
dgl opened this issue Sep 17, 2019 · 10 comments
Open

Downsample in OpenTSDB #31

dgl opened this issue Sep 17, 2019 · 10 comments

Comments

@dgl
Copy link
Contributor

dgl commented Sep 17, 2019

It may be possible to do some aggregations in OpenTSDB to avoid sending the raw OpenTSDB data back. Not all the aggregations make sense, in particular the Thanos aggrchunks are about downsampling mostly, the labels don't seem to change.

Maybe useful to do #15 first so we can actually measure the impact.

@robincw-gr
Copy link
Member

I don't think there's enough detail in the Thanos store api's SeriesRequest to determine what aggregations could help. Thanos needs more work I think

@dgl
Copy link
Contributor Author

dgl commented Sep 18, 2019

It's very unlikely thanos will change there, the store API fairly closely matches Prometheus's tsdb so it's unclear how work could even be done there. The main thing we can do would be downsampling as often OpenTSDB data has more points than Prometheus data would due to the push rather than scrape model.

@robincw-gr
Copy link
Member

If you compare PromQL to resulting SeriesRequest, you'll see that downsampling window size is not transmitted, and functions are mapped to the Aggr value but it seems to be just a stub of an idea and is unused:
https://github.com/thanos-io/thanos/blob/master/pkg/store/storepb/rpc.proto#L91
https://github.com/thanos-io/thanos/blob/master/pkg/query/querier.go#L142

@robincw-gr
Copy link
Member

A configurable minimum resolution could be used to downsample all queries regardless of what is specified in a user's PromQL.

@robincw-gr robincw-gr added this to To do in Geras v1.0 via automation Sep 23, 2019
@dgl dgl moved this from To do to Backlog in Geras v1.0 Oct 4, 2019
@dgl dgl changed the title Aggregations in OpenTSDB Downsample in OpenTSDB Oct 9, 2019
@dgl dgl removed this from Backlog in Geras v1.0 Oct 28, 2019
@eswdd
Copy link
Contributor

eswdd commented Dec 9, 2019

So, having done some digging, a maximum resolution window is passed down to the series request when you select a downsample mode other than "Only raw data" on the Thanos query UI (raw data is the default).

If a non-zero value is passed from the query (auto is a valid value) then this is set to a sensible value which would then allow downsampling, which can be combined with the aggregate type to do the right thing.

OpenTSDB 2.4 also supports rollups and pre-aggregates, but we certainly don't run this (it supports storage of such, and retrieval via new APIs, but not the actual calculation thereof) so I don't see much value in supporting at this stage.

@dgl
Copy link
Contributor Author

dgl commented Dec 10, 2019

We should also investigate setting https://github.com/thanos-io/thanos/blob/master/docs/components/query.md#auto-downsampling on the querier (as the thanos UI has the downsampling controls mentioned, but many queries will come from Grafana...). And document this behaviour...

@eswdd
Copy link
Contributor

eswdd commented Dec 10, 2019

Yeah, that's a request-level param. We could either add explicit Thanos support in Grafana datasources, and then configure this at the datasource level (or at least default it in the UI) or default this on at the querier level - but that feels more insidious..

@eswdd
Copy link
Contributor

eswdd commented Dec 10, 2019

Hmm, so the Prometheus datasource in Grafana supports custom query parameters (turns out these were added for Thanos - grafana/grafana#16665):

https://grafana.com/docs/grafana/latest/features/datasources/prometheus/

However it would be nice to set on a per-query basis - extending the Prometheus datasource to also support Thanos might be desirable. In fact in the grafana issue above @davkal made a suggestion along the lines I was thinking - might be worth trying to properly implement that.

@davkal
Copy link

davkal commented Dec 10, 2019

Re per-query parameters: we recommend using two datasources with different query parameters pointing to the same thanos instead. In the panel editor you then choose the Mixed datasource and can have per-query datasources.

@eswdd
Copy link
Contributor

eswdd commented Dec 10, 2019

I think my concern with the current recommendation is that as the set of additional parameters the Thanos Query component supports over Prometheus grows, the potential set of configurations you might want to choose from grows. Given the flexibility of Thanos, we're finding that we're deploying many different Query components depending on the Store API implementations we want to be able to query over, so multiplying the two could get very unwieldy.

This might be best discussed over in a Grafana issue, but I'd be keen to gauge appetite on the LTS extensions for the Prometheus datasource such that we can have a single datasource used in different ways set at query time with appropriate validation.

@dgl dgl moved this from In review to Done in Geras v1.0 Dec 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Geras v1.0
  
Done
Development

No branches or pull requests

4 participants