Skip to content

Conversation

@TheJokr
Copy link
Collaborator

@TheJokr TheJokr commented Nov 25, 2025

#[with_removal] generates two additional functions that allow to
remove individual label sets from a metric family as well as clear the
family completely. This is useful when metrics are used for dynamic
data, such as peer RTT in a P2P system.

The feature is hidden behind cfg(foundations_unstable), which allows
us to iterate on the API in the future. Both proc-macro unit tests as
well as an integration test are included in the change.

Tests on this PR will fail until nox/prometools#6 is merged and released, which
exposes the necessary Family APIs to implement this feature.

@TheJokr TheJokr self-assigned this Nov 25, 2025
@TheJokr TheJokr force-pushed the lblocher/expose-raw-family branch from 08f285f to 5b53bd4 Compare November 28, 2025 17:29
@TheJokr TheJokr marked this pull request as ready for review November 28, 2025 17:29
This helps document the `cfg` values foundations understands.
`#[with_removal]` generates two additional functions that allow to
remove individual label sets from a metric family as well as clear the
family completely. This is useful when metrics are used for dynamic
data, such as peer RTT in a P2P system.

The feature is hidden behind `cfg(foundations_unstable)`, which allows
us to iterate on the API in the future. Both proc-macro unit tests as
well as an integration test are included in the change.
@TheJokr TheJokr force-pushed the lblocher/expose-raw-family branch from 5b53bd4 to c05704b Compare November 28, 2025 17:35
Copy link
Collaborator

@fisherdarling fisherdarling left a comment

Choose a reason for hiding this comment

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

Looks good!

General q, is it possible to have an API of:

regular::dynamic("foo").remove();

Rather than having the _remove suffix?

@TheJokr
Copy link
Collaborator Author

TheJokr commented Dec 1, 2025

General q, is it possible to have an API of:

regular::dynamic("foo").remove();

Yes, good idea! I'll make some changes to the PR.

E: Discussed a bit more, it's quite unergonomic to implement such an API because my prometools change wasn't designed for it. The Removable type would have to carry a type parameter for the internal label set structure, making it hard to write out for users. Will merge as-is.

@TheJokr TheJokr marked this pull request as draft December 1, 2025 10:40
@TheJokr TheJokr marked this pull request as ready for review December 1, 2025 11:04
@TheJokr TheJokr merged commit 492ba79 into main Dec 1, 2025
20 checks passed
@TheJokr TheJokr deleted the lblocher/expose-raw-family branch December 1, 2025 11:04
@TheJokr TheJokr mentioned this pull request Dec 1, 2025
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.

2 participants