Skip to content

Add unprefixed flag to #[metrics] macro - #153

Merged
TheJokr merged 1 commit into
mainfrom
lblocher/prefix-free-metrics
Nov 7, 2025
Merged

TheJokr merged 1 commit into
mainfrom
lblocher/prefix-free-metrics

Conversation

@TheJokr

@TheJokr TheJokr commented Nov 6, 2025

Copy link
Copy Markdown
Collaborator

This change is twofold. First, it refactors the registry selection in metrics::internal::Registries to use boolean flags rather than separate methods to select a registry to use. As part of this, we add a combination of flags to return a registry without the global service name prefix that is normally present.

Second, we add a new unprefixed argument to the metrics proc-macro. If present, this argument causes all metrics in the associated module to be registered in the registry mentioned above. This works for both the "main" and the "optional" registry.

I've added both a proc-macro expansion test and an integration test to validate the flag's functionality.

This change is twofold. First, it refactors the registry selection in
`metrics::internal::Registries` to use boolean flags rather than
separate methods to select a registry to use. As part of this, we add a
combination of flags to return a registry without the global service
name prefix that is normally present.

Second, we add a new `unprefixed` argument to the `metrics` proc-macro.
If present, this argument causes all metrics in the associated module to
be registered in the registry mentioned above. This works for both the
"main" and the "optional" registry.

I've added both a proc-macro expansion test and an integration test
to validate the flag's functionality.
@TheJokr
TheJokr force-pushed the lblocher/prefix-free-metrics branch from f0194db to 04d0827 Compare November 7, 2025 09:44
@TheJokr
TheJokr merged commit 34cbc69 into main Nov 7, 2025
20 checks passed
@TheJokr
TheJokr deleted the lblocher/prefix-free-metrics branch November 7, 2025 15:21
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.

3 participants