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

MeterRegistry#removeByPreFilterId returns null when multiple pre-filter IDs map to same ID #5035

Closed
shakuzen opened this issue May 2, 2024 · 0 comments
Assignees
Labels
module: micrometer-core An issue that is related to our core module regression A regression from a previous release
Milestone

Comments

@shakuzen
Copy link
Member

shakuzen commented May 2, 2024

The following test demonstrates the issue and fails currently. It would pass if the tag value in the pre-filter ID were value instead because that is what is in the preFilterIdToMeterMap because it was registered first.

@Test
void multiplePreFilterIdsMapToSameId_removeByPreFilterId() {
    registry.config().meterFilter(MeterFilter.replaceTagValues("secret", s -> "redacted"));
    Counter c1 = registry.counter("counter", "secret", "value");
    Counter c2 = registry.counter("counter", "secret", "value2");

    Meter.Id preFilterId = new Meter.Id("counter", Tags.of("secret", "value2"), null, null, Meter.Type.COUNTER);
    assertThat(registry.removeByPreFilterId(preFilterId)).isSameAs(c1).isSameAs(c2);
    assertThat(registry.getMeters()).isEmpty();
}
@shakuzen shakuzen added regression A regression from a previous release module: micrometer-core An issue that is related to our core module labels May 2, 2024
@shakuzen shakuzen added this to the 1.13.0 milestone May 2, 2024
@shakuzen shakuzen self-assigned this May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: micrometer-core An issue that is related to our core module regression A regression from a previous release
Projects
None yet
Development

No branches or pull requests

1 participant