Skip to content

Add active series limit for native histogram samples #6796

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

Merged

Conversation

PaurushGarg
Copy link
Contributor

@PaurushGarg PaurushGarg commented Jun 6, 2025

What this PR does:
In addition to the current active series limit on float+histogram samples, this PR adds an active series limit for specifically for native histogram
samples.
This is done, b/c the ingestion of native histogram samples is much more CPU intensive than that of float samples - adding native histogram samples specific ingestion limit to protect the service and to allow clients to adjust the NH series ingestion.

Currently, Prometheus doesn't provide a way to count the specific active native histogram series in the head and hence this PR uses the activeNativeHistogram series count from Cortex - which differs in the way active series is counted.

Checklist

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

Copy link
Contributor

@harry671003 harry671003 left a comment

Choose a reason for hiding this comment

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

Overall changes looks good. Please add tests.

CHANGELOG.md Outdated
@@ -1,6 +1,7 @@
# Changelog

## master / unreleased
* [ENHANCEMENT] Ingester: Add activeSeries limit specifically for NativeHistograms. #6796
Copy link
Contributor

Choose a reason for hiding this comment

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

This changelog item needs to be grouped with other enhancement items

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. Updated.

Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove this line since you already added it below

@PaurushGarg PaurushGarg changed the title Add active series limit for nativeHistograms samples Add active series limit for nativeHistogram samples Jun 24, 2025
@PaurushGarg PaurushGarg force-pushed the native-histograms-active-series-limit branch from 024c1e9 to ab7970d Compare June 24, 2025 19:16
@PaurushGarg PaurushGarg marked this pull request as ready for review June 24, 2025 19:16
Copy link
Contributor

@harry671003 harry671003 left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you.

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.

Thanks. I think this looks good. Just some nits

localLimit := l.limits.MaxLocalNativeHistogramSeriesPerUser(userID)
globalLimit := l.limits.MaxGlobalNativeHistogramSeriesPerUser(userID)

return fmt.Errorf("per-user nativeHistograms series limit of %d exceeded, %s (local limit: %d global limit: %d actual local limit: %d)",
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's be consistent with other messages. per-user native histogram series limit...

@PaurushGarg PaurushGarg changed the title Add active series limit for nativeHistogram samples Add active series limit for native histogram samples Jun 30, 2025
@PaurushGarg PaurushGarg force-pushed the native-histograms-active-series-limit branch from 0d0a007 to 5e35219 Compare June 30, 2025 20:03
@yeya24 yeya24 merged commit f8260cd into cortexproject:master Jun 30, 2025
17 checks passed
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.

3 participants