Skip to content

Commit

Permalink
Add a test reproducing micrometer-metrics/micrometer#3020
Browse files Browse the repository at this point in the history
  • Loading branch information
izeye committed Jan 19, 2024
1 parent 8165251 commit 5f96c95
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.composite.CompositeMeterRegistry;
import io.micrometer.core.instrument.config.MeterFilter;
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;
Expand All @@ -28,4 +30,25 @@ void test() {
assertThat(childMeterRegistry.counter(name).count()).isOne();
}

@Disabled("See https://github.com/micrometer-metrics/micrometer/issues/3020")
@Test
void filtersOnIntermediateCompositeMeterRegistryDoNotSeemToWork() {
CompositeMeterRegistry parentMeterRegistry = new CompositeMeterRegistry();

CompositeMeterRegistry intermediateMeterRegistry = new CompositeMeterRegistry();
intermediateMeterRegistry.config().meterFilter(MeterFilter.denyNameStartsWith("deny"));
parentMeterRegistry.add(intermediateMeterRegistry);

SimpleMeterRegistry leafMeterRegistry = new SimpleMeterRegistry();
intermediateMeterRegistry.add(leafMeterRegistry);

parentMeterRegistry.counter("deny.item");

assertThat(parentMeterRegistry.getMeters()).hasSize(1);
// This seems to be empty with and without the filter.
assertThat(intermediateMeterRegistry.getMeters()).isEmpty();
// Filters on intermediate composite meter registries don't seem to work.
assertThat(leafMeterRegistry.getMeters()).isEmpty();
}

}

0 comments on commit 5f96c95

Please sign in to comment.