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 metrics tests #4802

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

ruslan-mikhailov
Copy link
Contributor

What this PR does:
Improves coverage of TraceQL metrics

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]

@ruslan-mikhailov ruslan-mikhailov force-pushed the trace-ql-metrics-tests branch 2 times, most recently from a09acad to 25c70d4 Compare March 7, 2025 13:49
@ruslan-mikhailov ruslan-mikhailov marked this pull request as ready for review March 7, 2025 14:02
@ruslan-mikhailov ruslan-mikhailov marked this pull request as draft March 7, 2025 14:03
@ruslan-mikhailov ruslan-mikhailov marked this pull request as ready for review March 7, 2025 14:11
@@ -55,6 +55,14 @@ sendLoop:
for _, query := range []string{
"{} | rate()",
"{} | compare({status=error})",
"{} | count_over_time()",
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we include aggregations here?

{span.http.status_code = 500} | count_over_time() by (resource.service.name)

We should also test metrics with no matches

{span.foo = bar} | count_over_time() by (resource.service.name)

Copy link
Contributor Author

@ruslan-mikhailov ruslan-mikhailov Mar 7, 2025

Choose a reason for hiding this comment

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

+

Added

@ruslan-mikhailov ruslan-mikhailov force-pushed the trace-ql-metrics-tests branch from d337963 to a7331cc Compare March 7, 2025 15:17
} {
t.Run(query, func(t *testing.T) {
callQueryRange(t, tempo.Endpoint(tempoPort), query, debugMode)
queryRangeRes := callQueryRange(t, tempo.Endpoint(tempoPort), query, debugMode)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this test should be rewritten to a deterministic table-driven test asserting that the data returned is correct:

  • MakeThriftBatch generates random data; this should be changed to something we can control
  • We should ensure we have traces in the backend and in recent data to test the different aggregation layers
  • We should test a comprehensive list of metrics with and without aggregation and check the correctnes of the returned series

@ruslan-mikhailov
Copy link
Contributor Author

+ Rebase from latest main and fix after rebase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants