Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Construct metrics registry with default() when name_in_metrics is empty #36

Merged
merged 1 commit into from
Mar 21, 2024

Conversation

djhworld
Copy link
Contributor

This adds a clause to use Registry::default() if name_in_metrics is empty

At the moment using the with_prefix method, the metrics that get rendered ends up looking like this: _my_metric because prefix is Option
https://github.com/prometheus/client_rust/blob/master/src/registry.rs#L62

Using Registry::default() will set prefix to None so that metrics get rendered without the leading underscore.

This adds a clause to use `Registry::default()` if `name_in_metrics` is empty

At the moment using the `with_prefix` method, the metrics that get
rendered ends up looking like this: `_my_metric` because `prefix` is
`Option`
https://github.com/prometheus/client_rust/blob/master/src/registry.rs#L62

Using `Registry::default()` will set prefix to `None` so that metrics
get rendered without the leading underscore.
@inikulin inikulin requested a review from nox March 20, 2024 05:57
@nox nox merged commit c6e3c85 into cloudflare:main Mar 21, 2024
17 checks passed
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.

None yet

4 participants