Skip to content

feat: add retain() to Family to allow metrics filtering - #196

Open
howardjohn wants to merge 1 commit into
prometheus:masterfrom
howardjohn:metrics/expiry
Open

feat: add retain() to Family to allow metrics filtering#196
howardjohn wants to merge 1 commit into
prometheus:masterfrom
howardjohn:metrics/expiry

Conversation

@howardjohn

@howardjohnhowardjohn commented Apr 29, 2024

Copy link
Copy Markdown
Contributor

Implementation for #197.

This enables a way to filter metrics by arbitrary logic. The existing remove() function is not suitable for this, as it requires us to know the entire label set we want to remove. The clear() function is not as it clears everything.

A simple doc test is added, as well as a more complex example that uses a custom counter to track the last-access-time and calls retain based on that.

@howardjohn

Copy link
Copy Markdown
ContributorAuthor

@mxinden what do you think of this approach?

@howardjohnhowardjohn changed the title Prototype of metrics expiryImplement metrics expiryNov 5, 2024
@howardjohn
howardjohn marked this pull request as ready for review November 5, 2024 19:29
@howardjohnhowardjohn changed the title Implement metrics expiryfeat: add retain() to Family to allow metrics filteringJan 16, 2025
@howardjohnhowardjohn changed the title feat: add retain() to Family to allow metrics filteringfeat: add retain() to Family to allow metrics filteringJan 16, 2025
Signed-off-by: John Howard <john.howard@solo.io>
@howardjohn

Copy link
Copy Markdown
ContributorAuthor

Ok I have fixed this up and added documentation. Should be good to go from my perspective.

Sign up for freeto 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

@howardjohn