tikv / rust-prometheus

Prometheus instrumentation library for Rust applications
Apache License 2.0
1.05k stars 182 forks source link

Using a prefixed registry, valid metric names are incorrectly marked as invalid #462

Open tooboredtocode opened 1 year ago

tooboredtocode commented 1 year ago

Describe the bug Due to how Metrics are constructed, using a prefixed registry causes valid metric names to be marked as invalid For example, if a registry has a valid prefix (such as backend), (yet) invalid metric name (such as 3rd_party_api_response_time) will turn into valid metric names (backend_3rd_party_api_response_time)

Given that the check currently happens in the constructor of the metrics and not in the registration, there is no way to construct such metrics besides abandoning the prefix utility and manually prefixing the metrics