I have a metric compaction_level2_duration_ns that is sanitized into compaction_level__duration_ns. I believe this metric is a valid prometheus name..
Here is a test that shows that it fails:
#[test]
fn check_sanitize() {
let name = "compaction_level2_duration_ns".to_owned();
let actual = sanitize_metric_name(&name);
assert_eq!(name, actual);
}
I have a metric
compaction_level2_duration_ns
that is sanitized intocompaction_level__duration_ns
. I believe this metric is a valid prometheus name..Here is a test that shows that it fails:
The sanitize code is here:
https://github.com/metrics-rs/metrics/blob/5f720a0a8f53aaee4bfa9de1d9fc470f1ed6b3c3/metrics-exporter-prometheus/src/formatting.rs#L111-L115
I think it is because it replaces the first n occurrences matching the predicate, regardless of their position.