Skip to content

Add opt-in Vec TTL via MetricVec and TTLRegistry#1989

Open
jpinsonneau wants to merge 1 commit into
prometheus:mainfrom
jpinsonneau:ttl-registry
Open

Add opt-in Vec TTL via MetricVec and TTLRegistry#1989
jpinsonneau wants to merge 1 commit into
prometheus:mainfrom
jpinsonneau:ttl-registry

Conversation

@jpinsonneau
Copy link
Copy Markdown

Introduce NewMetricVecWithTTL and per-child lastAccessed tracking so
stale label sets can be omitted from Collect and removed with
CleanupExpired. Store vec children as pointers to satisfy atomic
copying rules.

Keep default NewCounterVec/NewGaugeVec/NewHistogramVec on NewMetricVec
without TTL for backwards compatibility. Opt-in TTLRegistry wraps a
dedicated Registry, exposes New*Vec constructors with a fixed ttl, and
runs CleanupExpired before each Gather.

Relates to #1983

Signed-off-by: Julien Pinsonneau jpinsonn@redhat.com
Made-with: Cursor

Introduce NewMetricVecWithTTL and per-child lastAccessed tracking so
stale label sets can be omitted from Collect and removed with
CleanupExpired. Store vec children as pointers to satisfy atomic
copying rules.

Keep default NewCounterVec/NewGaugeVec/NewHistogramVec on NewMetricVec
without TTL for backwards compatibility. Opt-in TTLRegistry wraps a
dedicated Registry, exposes New*Vec constructors with a fixed ttl, and
runs CleanupExpired before each Gather.

Relates to prometheus#1983

Signed-off-by: Julien Pinsonneau <jpinsonn@redhat.com>
Made-with: Cursor
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