G-Research / geras

Geras provides a Thanos Store API for the OpenTSDB HTTP API. This makes it possible to query OpenTSDB via PromQL, through Thanos.
https://github.com/G-Research/geras
Apache License 2.0
38 stars 16 forks source link

Use /api/query/last for instantaneous queries #33

Closed dgl closed 5 years ago

dgl commented 5 years ago

If a query is instantaneous then use /api/query/last to potentially reduce query cost http://opentsdb.net/docs/build/html/api_http/query/last.html

Will need a heuristic like mintime == maxtime and in last ~10 seconds to figure out if it's instantaneous, but that should be ok.

robincw-gr commented 5 years ago

If a minimum resolution for downsampling is introduced in issue #31 then that value can be used instead of the suggested 10sec

dgl commented 5 years ago

The heuristic is to figure out if the query is instantaneous, so it's just to deal with clocks not quite in sync. Using the downsampling value could lead to misleading results.

robincw-gr commented 5 years ago

Ah, clocks, that clarifies the reason for the 10sec.

dgl commented 5 years ago

Robin looked into this a bit, because last actually looks further back to find older timeseries (i.e. tags that exist but don't have recent data), it's actually more expensive. Don't think this is worth pursuing.