Skip to content

Add TTL eviction for histogram vectors#2053

Open
Zubi-fix wants to merge 1 commit into
prometheus:mainfrom
Zubi-fix:main
Open

Add TTL eviction for histogram vectors#2053
Zubi-fix wants to merge 1 commit into
prometheus:mainfrom
Zubi-fix:main

Conversation

@Zubi-fix

@Zubi-fix Zubi-fix commented Jul 12, 2026

Copy link
Copy Markdown

Closes #1

Summary

Adds TTL-based eviction for HistogramVec to prevent unbounded memory growth from high-cardinality labels.

What changed

  • Added optional MetricVecOpts.IdleTTL for vector eviction.
  • Track last activity on histogram observations.
  • Prune expired histogram entries on access and during collection.
  • Added regression coverage for TTL eviction behavior.

Notes

  • Existing behavior stays unchanged when IdleTTL is zero.
  • Eviction is lazy, so the hot path stays lightweight.

Signed-off-by: Zubi-fix <zubi-fix@users.noreply.github.com>
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.

1 participant