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 Frontend: Expose samples_processed in Server-Timing header #10103

Merged
merged 9 commits into from
Dec 19, 2024

Conversation

tinitiuset
Copy link
Contributor

@tinitiuset tinitiuset commented Dec 3, 2024

What this PR does

This PR will make the Query frontend expose samples_processed in Server-Timing header. It is complementary to #9985 and this in the effort of measuring throughput on Mimir.

This was worked on by @krajorama before #7966, but I decided to open a different PR as the idea has evolved overtime.

Which issue(s) this PR fixes or relates to

Not related to an specific issue.

Checklist

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

Copy link
Collaborator

@pracucci pracucci left a comment

Choose a reason for hiding this comment

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

I have a comment about the naming. "total samples" may mean "total raw samples processed" or "total number of samples returned by the query". The cost of a query is a function of the actual raw samples processed, not returned. If that's what you're going to track (as I would expect) then we may consider renaming it to "samples processed" (to keep it consistent with "bytes processed" that we already have).

@tinitiuset tinitiuset force-pushed the tinitiuset/feat/exposeTotalSamples branch from c373bdd to cc1117d Compare December 3, 2024 19:57
@tinitiuset tinitiuset changed the title Query Frontend: Expose total_samples in Server-Timing header Query Frontend: Expose samples_processed in Server-Timing header Dec 4, 2024
@tinitiuset tinitiuset marked this pull request as ready for review December 5, 2024 10:10
@tinitiuset tinitiuset requested a review from a team as a code owner December 5, 2024 10:10
@tinitiuset
Copy link
Contributor Author

@pracucci 's feedback is acknowledged and MQE support will be added in another PR.

Copy link
Contributor

@charleskorn charleskorn left a comment

Choose a reason for hiding this comment

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

LGTM, but I'd like to see the Stats tests expanded to cover the new SamplesProcessed field.

pkg/querier/stats/stats.go Outdated Show resolved Hide resolved
pkg/querier/stats_renderer_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@dimitarvdimitrov dimitarvdimitrov left a comment

Choose a reason for hiding this comment

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

LGTM, mod Charles and Marco's comments

@chencs
Copy link
Contributor

chencs commented Dec 10, 2024

The CHANGELOG has just been cut to prepare for the next release. Please rebase main and eventually move the CHANGELOG entry added / updated in this PR to the top of the CHANGELOG.md document. Thanks!

@tinitiuset
Copy link
Contributor Author

Ready for review again. Testing updated. CHANGELOG updated also.

@tinitiuset tinitiuset force-pushed the tinitiuset/feat/exposeTotalSamples branch from 560ff96 to a39869b Compare December 18, 2024 20:25
…s affecting other tests and Mimir doesn't support Prometheus' UTF-8 metric/label name scheme yet.
@tinitiuset tinitiuset force-pushed the tinitiuset/feat/exposeTotalSamples branch from a39869b to 2969331 Compare December 19, 2024 09:51
@tinitiuset
Copy link
Contributor Author

tinitiuset commented Dec 19, 2024

Branch got out of sync with main. I also updated a test that was making other tests fail because it was enabling UTF-8 support.

pkg/querier/stats/stats.proto Outdated Show resolved Hide resolved
},
"sparse_series": {
expr: `sparse_series{}`,
expectedTotalSamples: 5 + 4,
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this be 2 because there are only two samples

			sparse_series 0 _ _ _ _ _ _ 7 _ _ _

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not completely sure why, but in that case, the engine is returning [0, "0"], [60, "0"], [120, "0"], [180, "0"], [240, "0"], [420, "7"], [480, "7"], [540, "7"], [600, "7"] which equal to 9 samples. I also assumed 2 samples beforehand.

Copy link
Contributor

Choose a reason for hiding this comment

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

i wonder if it's not because of the lookback period of 5 minutes. Can you quickly verify that it is? It's configurable on the promQL engine config via LookbackDelta

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call, I tried different LookbackDelta values and it's consistent with the samples returned.

@dimitarvdimitrov dimitarvdimitrov merged commit a53f79d into main Dec 19, 2024
29 checks passed
@dimitarvdimitrov dimitarvdimitrov deleted the tinitiuset/feat/exposeTotalSamples branch December 19, 2024 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants