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

Traceql instant query #3859

Merged
merged 15 commits into from
Jul 18, 2024
Merged

Traceql instant query #3859

merged 15 commits into from
Jul 18, 2024

Conversation

mdisibio
Copy link
Contributor

@mdisibio mdisibio commented Jul 11, 2024

What this PR does:
Adds a new api /api/metrics/query which performs an instant query instead of a range query. Includes both http and grpc streaming versions. The parameters are (1) query, (2) start, and (3) end. Wanted to match the Prometheus instant api, but for now we can't. TraceQL is missing the custom interval tidbits like [1h], so it needs the full time range (start and end). I think this is fine.

This new api is actually the same, conceptually and implementation-wise, as doing a range query with 1 step. It reuses the existing query_range sharder, pipeline, combiner, etc, and does a transformation of the response at the end.

Extends the tempo-cli command tempo-cli query metrics to take an --instant parameter to call the new apis. Works with both http and --use-grpc streaming version.

Also tried to cleanup/solidify the time range handling.

Which issue(s) this PR fixes:
Fixes #

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Copy link
Contributor

@zalegrala zalegrala left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Copy link
Member

@joe-elliott joe-elliott left a comment

Choose a reason for hiding this comment

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

two questions

pkg/traceql/engine_metrics.go Show resolved Hide resolved
pkg/tempopb/tempo.proto Show resolved Hide resolved
Copy link
Member

@mapno mapno left a comment

Choose a reason for hiding this comment

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

LGTM

@mdisibio mdisibio merged commit 7f788b3 into grafana:main Jul 18, 2024
15 checks passed
@joe-elliott joe-elliott added type/bug Something isn't working backport r157 labels Jul 19, 2024
github-actions bot pushed a commit that referenced this pull request Jul 19, 2024
* first working draft

* Cleanup request time manipulation code

* comment

* Update after merge, oops restore accidentally deleted query metrics

* Fix request clone for logging

* tweak method signature

* changelog

* Make TrimToOverlap aware of instant query, fix alignment issue on generator complete blocks

* Fix test

* Add streaming version of metrics query instant, add to cli, fix timestamp handling in metrics diff detection

* Fix typo in QueryInstantResponse name

* lint

* docs

* lint, rename

(cherry picked from commit 7f788b3)
@github-actions github-actions bot mentioned this pull request Jul 19, 2024
3 tasks
joe-elliott pushed a commit that referenced this pull request Jul 19, 2024
* first working draft

* Cleanup request time manipulation code

* comment

* Update after merge, oops restore accidentally deleted query metrics

* Fix request clone for logging

* tweak method signature

* changelog

* Make TrimToOverlap aware of instant query, fix alignment issue on generator complete blocks

* Fix test

* Add streaming version of metrics query instant, add to cli, fix timestamp handling in metrics diff detection

* Fix typo in QueryInstantResponse name

* lint

* docs

* lint, rename

(cherry picked from commit 7f788b3)

Co-authored-by: Martin Disibio <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport r157 type/bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants