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

query: set default times for query_exemplars API #5014

Merged
merged 1 commit into from
Jan 1, 2022

Conversation

paulgrav
Copy link
Contributor

@paulgrav paulgrav commented Dec 30, 2021

Signed-off-by: Paul Grave paul@stomer.net

Changes

Fixes #5011

I replaced calls to cortexutil.ParseTime with parseTimeParam in NewExemplarsHandler since the later allows default times to be set.
I removed the cortexutil since the above change made it redundant.

The impact is that this behaviour mirrors Prometheus’ behaviour and allows exemplars to be displayed in Grafana.

Verification

I effected some functional tests. I ran my own container (paulgrave/thanos:0.24.1) on my cluster and validated that exemplars are now displayed in Grafana.
Executed curl -v -d query=test http://localhost:10902/api/v1/query_exemplars to validate that a) API doesn’t error b) returns a 200 instead of a 400.
Executed curl -v -d query='my_requests_total{app="prom-py"}' -d start=1640770731.689 -d end=(date +%s) http://localhost:10902/api/v1/query_exemplars | jq to validate that exemplars are indeed returned like before.
Thanos is running as expected on my local cluster.

Unfortunately make lint and make test are broken on my M1 Mac.

Signed-off-by: Paul Grave <paul@stomer.net>
Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for your contribution!

@yeya24 yeya24 merged commit 5c574a9 into thanos-io:main Jan 1, 2022
@paulgrav paulgrav deleted the defaulttimerange branch January 1, 2022 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Thanos Query’s query_exemplars API behaviour differs from Prometheus’s
2 participants