When running an instrumented application's test suite I'm getting errors like the following:
Failed to overwrite metric overlay_outbound_transit_seconds, Labels:
This is probably because when running tests the metric initialization is also run in parallel, and since the registry used is the same across all there each test is attempting to override the same metric name.
Sample:
#[metrics(scope = "app")]
pub struct MyMetric {
#[metric]
pub my_metric: Counter,
}
#[test]
fn foo() {
let metrics = MyMetric::default();
...
}
#[test]
fn bar() {
let metrics = MyMetric::default();
...
}
When running an instrumented application's test suite I'm getting errors like the following:
This is probably because when running tests the metric initialization is also run in parallel, and since the registry used is the same across all there each test is attempting to override the same metric name.
Sample: