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

querier,ingester: support for limit parameter in the finding series endpoint #10620

Merged
merged 7 commits into from
Feb 12, 2025

Conversation

narqo
Copy link
Contributor

@narqo narqo commented Feb 10, 2025

What this PR does

This PR updates the querier and the ingester services, with a basic support for the limit parameter in the /series API endpoint.

Here the code only passes the limit to the downstream services, as-is. This is not ideal, because the limit of MM series in the distributor can overwhelm the ingesters. I want to focus on that in the follow-up PR to make the review simpler.

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.

@narqo narqo requested a review from a team as a code owner February 10, 2025 11:02
@narqo narqo force-pushed the vldmr/api-series-limit branch 2 times, most recently from e0c1de1 to 381c2a6 Compare February 10, 2025 13:25
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.

easy, LGTM with two small suggestions

CHANGELOG.md Outdated Show resolved Hide resolved
pkg/ingester/ingester.go Outdated Show resolved Hide resolved
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.

Nice work! I left a comment about where to apply limit in a function.

CHANGELOG.md Outdated Show resolved Hide resolved
for _, m := range metrics {
if len(result) >= resultCap {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not limit few lines above when we populate metrics to deduplicate series? We could just stop once len(metrics) reached the limit.

Similarly, I'm wondering why we don't apply the limiter in the same for loop above when we populate metrics. Do you see a good reason to not do it there?

Copy link
Contributor Author

@narqo narqo Feb 11, 2025

Choose a reason for hiding this comment

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

Do you see a good reason to not do it there?

I think, the only one is that, in the worst case, this will check every duplicate against the series limiter, calculating the hash of the series twice. I cannot tell if that better or worse, from applying this limit later.

Note I'll skip looking into this part. We can benchmark different options separately.

pkg/distributor/distributor_test.go Outdated Show resolved Hide resolved
narqo and others added 7 commits February 12, 2025 09:24
Signed-off-by: Vladimir Varankin <[email protected]>
Signed-off-by: Vladimir Varankin <[email protected]>
Signed-off-by: Vladimir Varankin <[email protected]>
Signed-off-by: Vladimir Varankin <[email protected]>
@narqo narqo force-pushed the vldmr/api-series-limit branch from df94c31 to 9a952b1 Compare February 12, 2025 08:25
@narqo narqo enabled auto-merge (squash) February 12, 2025 08:30
@dimitarvdimitrov dimitarvdimitrov changed the title distributor: support for limit parameter in the finding series endpoint querier,ingester: support for limit parameter in the finding series endpoint Feb 12, 2025
@narqo narqo merged commit bb0636a into main Feb 12, 2025
28 checks passed
@narqo narqo deleted the vldmr/api-series-limit branch February 12, 2025 08:42
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.

3 participants