cloudflare / foundations

Cloudflare's Rust service foundations library.
https://blog.cloudflare.com/introducing-foundations-our-open-source-rust-service-foundation-library
BSD 3-Clause "New" or "Revised" License
1.3k stars 56 forks source link

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

Closed djhworld closed 7 months ago

djhworld commented 7 months ago

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.