thanos-community / thanos-promql-connector

WIP
Apache License 2.0
9 stars 2 forks source link

/api/v1/label/x/values and /api/v1/series support #5

Open sepich opened 2 months ago

sepich commented 2 months ago

Thank you for such a great way to bridge to other systems! Queries from thanos-query --query.mode=distributed UI seems to works fine for /query and /query_range. But unfortunately to fully use this connector in grafana dashboards one also need grafana dashboard variables support. Which use /api/v1/label/<label_name>/values API (and /api/v1/series in datasource compatibility mode)

image

Currently thanos-promql-connector responds with error to such requests:

curl -i 'https://xxx/api/v1/label/cluster/values?match[]=prometheus_build_info'
HTTP/2 200

{"status":"success","data":[],"warnings":["fetch label values from store Addr: mimir-query-frontend:8081 LabelSets: {query-backend=\"http://127.0.0.1:8080/prometheus\"} MinTime: -9223372036854775808 MaxTime: 9223372036854775807: fetch label values from store Addr: mimir-query-frontend:8081 LabelSets: {query-backend=\"http://127.0.0.1:8080/prometheus\"} MinTime: -9223372036854775808 MaxTime: 9223372036854775807: rpc error: code = Unimplemented desc = unknown service thanos.Store"]}

curl -i 'https://xxx/api/v1/series?match[]=prometheus_build_info'
HTTP/2 200

{"status":"success","data":[],"warnings":["receive series from Addr: mimir-query-frontend:8081 LabelSets: {query-backend=\"http://127.0.0.1:8080/prometheus\"} MinTime: -9223372036854775808 MaxTime: 9223372036854775807: rpc error: code = Unimplemented desc = unknown service thanos.Store"]}

Is there any plans to add a support for such calls?

fpetkovski commented 1 month ago

Thanks for opening the issue. I think it makes sense to support labels and label_values calls since they are useful for dashboards.

Series calls could be a bit expensive, and I am not sure how they would map to external providers. I believe they are also not completely necessary if you configure the Prometheus datasource to use Thanos as the Prometheus type.