io.micrometer.core.instrument.config.MeterFilter Java Examples

The following examples show how to use io.micrometer.core.instrument.config.MeterFilter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MeterRegistryPostProcessor.java    From foremast with Apache License 2.0 6 votes vote down vote up
private MeterRegistryConfigurer getConfigurer() {
    if (this.configurer == null) {
        Collection<MeterBinder> meterBinders = Collections.emptyList();
        Collection<MeterFilter> meterFilters = Collections.emptyList();
        Collection<MeterRegistryCustomizer<?>> meterRegistryCustomizers = Collections.emptyList();
        MetricsProperties properties = beanFactory.getBean(MetricsProperties.class);
        if (beanFactory instanceof ListableBeanFactory) {
            ListableBeanFactory listableBeanFactory = (ListableBeanFactory)beanFactory;
            meterBinders = listableBeanFactory.getBeansOfType(MeterBinder.class).values();
            meterFilters = listableBeanFactory.getBeansOfType(MeterFilter.class).values();
            Map<String, MeterRegistryCustomizer> map = listableBeanFactory.getBeansOfType(MeterRegistryCustomizer.class);
            meterRegistryCustomizers = new ArrayList<>();
            for(MeterRegistryCustomizer c : map.values()) {
                meterRegistryCustomizers.add(c);
            }
        }
        this.configurer = new MeterRegistryConfigurer(
                meterBinders,
                meterFilters,
                meterRegistryCustomizers, properties.isUseGlobalRegistry());
    }
    return this.configurer;
}
 
Example #2
Source File: MeterRegistryPostProcessor.java    From foremast with Apache License 2.0 6 votes vote down vote up
private MeterRegistryConfigurer getConfigurer() {
    if (this.configurer == null) {
        Collection<MeterBinder> meterBinders = Collections.emptyList();
        Collection<MeterFilter> meterFilters = Collections.emptyList();
        Collection<MeterRegistryCustomizer<?>> meterRegistryCustomizers = Collections.emptyList();
        MetricsProperties properties = beanFactory.getBean(MetricsProperties.class);
        if (beanFactory instanceof ListableBeanFactory) {
            ListableBeanFactory listableBeanFactory = (ListableBeanFactory)beanFactory;
            meterBinders = listableBeanFactory.getBeansOfType(MeterBinder.class).values();
            meterFilters = listableBeanFactory.getBeansOfType(MeterFilter.class).values();
            Map<String, MeterRegistryCustomizer> map = listableBeanFactory.getBeansOfType(MeterRegistryCustomizer.class);
            meterRegistryCustomizers = new ArrayList<>();
            for(MeterRegistryCustomizer c : map.values()) {
                meterRegistryCustomizers.add(c);
            }
        }
        this.configurer = new MeterRegistryConfigurer(
                meterBinders,
                meterFilters,
                meterRegistryCustomizers, properties.isUseGlobalRegistry());
    }
    return this.configurer;
}
 
Example #3
Source File: ZipkinServerConfiguration.java    From pivotal-bank-demo with Apache License 2.0 6 votes vote down vote up
@Bean
public MeterRegistryCustomizer meterRegistryCustomizer() {
  return registry ->
      registry
          .config()
          .meterFilter(
              MeterFilter.deny(
                  id -> {
                    String uri = id.getTag("uri");
                    return uri != null
                        && (uri.startsWith("/actuator")
                            || uri.startsWith("/metrics")
                            || uri.startsWith("/health")
                            || uri.startsWith("/favicon.ico")
                            || uri.startsWith("/prometheus"));
                  }));
}
 
Example #4
Source File: MeterRegistryTest.java    From micrometer with Apache License 2.0 6 votes vote down vote up
@Test
void removeMetersWithSyntheticsAffectedByMeterFilter() {
    registry.config().meterFilter(new MeterFilter() {
        @Override
        public Meter.Id map(Meter.Id id) {
            return id.withName("another.name");
        }
    });

    Timer timer = Timer.builder("my.timer")
            .publishPercentiles(0.95)
            .register(registry);

    assertThat(registry.getMeters()).hasSize(2);
    registry.remove(timer);
    assertThat(registry.getMeters()).isEmpty();
}
 
Example #5
Source File: JettyClientMetrics.java    From micrometer with Apache License 2.0 6 votes vote down vote up
protected JettyClientMetrics(MeterRegistry registry, JettyClientTagsProvider tagsProvider, String timingMetricName, String contentSizeMetricName, int maxUriTags) {
    this.registry = registry;
    this.tagsProvider = tagsProvider;
    this.timingMetricName = timingMetricName;
    this.contentSizeMetricName = contentSizeMetricName;

    MeterFilter timingMetricDenyFilter = new OnlyOnceLoggingDenyMeterFilter(
            () -> String.format("Reached the maximum number of URI tags for '%s'.", timingMetricName));
    MeterFilter contentSizeMetricDenyFilter = new OnlyOnceLoggingDenyMeterFilter(
            () -> String.format("Reached the maximum number of URI tags for '%s'.", contentSizeMetricName));
    registry.config()
            .meterFilter(MeterFilter.maximumAllowableTags(
                    this.timingMetricName, "uri", maxUriTags, timingMetricDenyFilter))
            .meterFilter(MeterFilter.maximumAllowableTags(
                    this.contentSizeMetricName, "uri", maxUriTags, contentSizeMetricDenyFilter));
}
 
Example #6
Source File: HistogramGaugesTest.java    From micrometer with Apache License 2.0 6 votes vote down vote up
@Test
void meterFiltersAreOnlyAppliedOnceToHistogramsAndPercentiles() {
    MeterRegistry registry = new SimpleMeterRegistry();

    registry.config().meterFilter(new MeterFilter() {
        @Override
        public Meter.Id map(Meter.Id id) {
            return id.withName("MYPREFIX." + id.getName());
        }
    });

    Timer.builder("my.timer")
         .serviceLevelObjectives(Duration.ofMillis(1))
         .publishPercentiles(0.95)
         .register(registry);

    registry.get("MYPREFIX.my.timer.percentile").tag("phi", "0.95").gauge();
    registry.get("MYPREFIX.my.timer.histogram").tag("le", "0.001").gauge();
}
 
Example #7
Source File: MeterFilterTest.java    From micrometer with Apache License 2.0 6 votes vote down vote up
@Test
void maximumAllowableTagsWhenDifferentTagKeyShouldNotAffect() {
    MeterFilter onMaxReached = mock(MeterFilter.class);
    MeterFilter filter = MeterFilter.maximumAllowableTags("name1", "key1", 3, onMaxReached);

    Meter.Id id1 = new Meter.Id("name1", Tags.of("key1", "value1"), null, null, Meter.Type.COUNTER);
    Meter.Id id2 = new Meter.Id("name1", Tags.of("key1", "value2"), null, null, Meter.Type.COUNTER);
    Meter.Id id3 = new Meter.Id("name1", Tags.of("key1", "value3"), null, null, Meter.Type.COUNTER);
    Meter.Id id4 = new Meter.Id("name1", Tags.of("key1", "value4"), null, null, Meter.Type.COUNTER);
    Meter.Id id5 = new Meter.Id("name1", Tags.of("key2", "value5"), null, null, Meter.Type.COUNTER);

    filter.accept(id1);
    filter.accept(id2);
    filter.accept(id3);
    verifyNoInteractions(onMaxReached);

    filter.accept(id4);
    verify(onMaxReached).accept(id4);

    filter.accept(id5);
    verifyNoMoreInteractions(onMaxReached);
}
 
Example #8
Source File: MeterFilterTest.java    From micrometer with Apache License 2.0 6 votes vote down vote up
@Test
void maximumAllowableTagsWhenAlreadyInAllowableTagValuesShouldNotAffect() {
    MeterFilter onMaxReached = mock(MeterFilter.class);
    MeterFilter filter = MeterFilter.maximumAllowableTags("name1", "key1", 3, onMaxReached);

    Meter.Id id1 = new Meter.Id("name1", Tags.of("key1", "value1"), null, null, Meter.Type.COUNTER);
    Meter.Id id2 = new Meter.Id("name1", Tags.of("key1", "value2"), null, null, Meter.Type.COUNTER);
    Meter.Id id3 = new Meter.Id("name1", Tags.of("key1", "value3"), null, null, Meter.Type.COUNTER);
    Meter.Id id4 = new Meter.Id("name1", Tags.of("key1", "value4"), null, null, Meter.Type.COUNTER);

    filter.accept(id1);
    filter.accept(id2);
    filter.accept(id3);
    verifyNoInteractions(onMaxReached);

    filter.accept(id4);
    verify(onMaxReached).accept(id4);

    filter.accept(id1);
    verifyNoMoreInteractions(onMaxReached);
}
 
Example #9
Source File: MeterFilterTest.java    From micrometer with Apache License 2.0 6 votes vote down vote up
@Test
void mapThenAccept() {
    MeterRegistry registry = new SimpleMeterRegistry();

    registry.config().meterFilter(new MeterFilter() {
        @Override
        public Meter.Id map(Meter.Id id) {
            return id.withName("my.other.counter");
        }
    });

    registry.config().meterFilter(MeterFilter.acceptNameStartsWith("my.other"));
    registry.config().meterFilter(MeterFilter.deny());

    registry.counter("my.counter").increment();

    assertThat(registry.getMeters()).isNotEmpty();
}
 
Example #10
Source File: CompositeMeterRegistryTest.java    From micrometer with Apache License 2.0 6 votes vote down vote up
@Test
void differentFiltersForCompositeAndChild() {
    composite.add(simple);

    simple.config().meterFilter(MeterFilter.denyNameStartsWith("deny.child"));
    composite.config().meterFilter(MeterFilter.denyNameStartsWith("deny.composite"));

    composite.counter("deny.composite");
    composite.counter("deny.child");

    assertThat(simple.find("deny.composite").meter()).isNull();
    assertThat(composite.find("deny.composite").meter()).isNull();

    assertThat(simple.find("deny.child").meter()).isNull();
    composite.get("deny.child").meter();

    // if the meter is registered directly to the child, the composite config does not take effect
    simple.counter("deny.composite");
    simple.get("deny.composite").meter();
}
 
Example #11
Source File: HealthMeterRegistryTest.java    From micrometer with Apache License 2.0 6 votes vote down vote up
@Test
void meterFiltersAffectServiceLevelObjectives() {
    HealthMeterRegistry registry = HealthMeterRegistry.builder(HealthConfig.DEFAULT)
            .clock(new MockClock())
            .serviceLevelObjectives(JvmServiceLevelObjectives.MEMORY)
            .serviceLevelObjectiveFilter(MeterFilter.denyNameStartsWith("jvm.pool"))
            .serviceLevelObjectiveFilter(new MeterFilter() {
                @Override
                public Meter.Id map(Meter.Id id) {
                    return id.getName().equals("jvm.gc.load") ? id.withName("jvm.collection.load") : id;
                }
            })
            .build();

    assertThat(registry.getServiceLevelObjectives().stream().map(ServiceLevelObjective::getName))
            .contains("jvm.collection.load")
            .doesNotContain("jvm.pool.memory")
            .isNotEmpty();
}
 
Example #12
Source File: AppOpticsMeterRegistry.java    From micrometer with Apache License 2.0 6 votes vote down vote up
protected AppOpticsMeterRegistry(AppOpticsConfig config, Clock clock, ThreadFactory threadFactory, HttpSender httpClient) {
    super(config, clock);

    config().namingConvention(new AppOpticsNamingConvention());

    this.config = config;
    this.httpClient = httpClient;

    config().meterFilter(new MeterFilter() {
        @Override
        public Meter.Id map(Meter.Id id) {
            if (id.getName().startsWith("system.")) {
                return id.withName("micrometer." + id.getName());
            }
            return id;
        }
    });

    start(threadFactory);
}
 
Example #13
Source File: DropwizardMeterRegistries.java    From armeria with Apache License 2.0 6 votes vote down vote up
/**
 * Configures the {@link DropwizardMeterRegistry} with Armeria's defaults. Useful when using a different
 * implementation of {@link DropwizardMeterRegistry}, e.g., a {@code JmxMeterRegistry}.
 *
 * @return the specified {@link DropwizardMeterRegistry}
 */
public static <T extends DropwizardMeterRegistry> T configureRegistry(T meterRegistry) {
    requireNonNull(meterRegistry, "meterRegistry");
    meterRegistry.config().meterFilter(new MeterFilter() {
        @Override
        public MeterFilterReply accept(Meter.Id id) {
            if (id.getName().endsWith(".percentile") && id.getTag("phi") != null) {
                return MeterFilterReply.DENY;
            }
            if (id.getName().endsWith(".histogram") && id.getTag("le") != null) {
                return MeterFilterReply.DENY;
            }
            return MeterFilterReply.NEUTRAL;
        }
    });

    meterRegistry.config().namingConvention(MoreNamingConventions.dropwizard());
    return meterRegistry;
}
 
Example #14
Source File: DestinationPublishingMetricsAutoConfiguration.java    From spring-cloud-stream with Apache License 2.0 6 votes vote down vote up
@Bean
@ConditionalOnMissingBean
public DefaultDestinationPublishingMeterRegistry defaultDestinationPublishingMeterRegistry(
		ApplicationMetricsProperties applicationMetricsProperties,
		MetersPublisherBinding publisherBinding,
		MetricsPublisherConfig metricsPublisherConfig, Clock clock) {
	DefaultDestinationPublishingMeterRegistry registry = new DefaultDestinationPublishingMeterRegistry(
			applicationMetricsProperties, publisherBinding, metricsPublisherConfig,
			clock);

	if (StringUtils.hasText(applicationMetricsProperties.getMeterFilter())) {
		registry.config()
				.meterFilter(MeterFilter.denyUnless(id -> PatternMatchUtils
						.simpleMatch(applicationMetricsProperties.getMeterFilter(),
								id.getName())));
	}
	return registry;
}
 
Example #15
Source File: MeterRegistryConfigurer.java    From foremast with Apache License 2.0 5 votes vote down vote up
MeterRegistryConfigurer(Collection<MeterBinder> binders,
                        Collection<MeterFilter> filters,
                        Collection<MeterRegistryCustomizer<?>> customizers,
                        boolean addToGlobalRegistry) {
    this.binders = (binders != null ? binders : Collections.emptyList());
    this.filters = (filters != null ? filters : Collections.emptyList());
    this.customizers = (customizers != null ? customizers : Collections.emptyList());
    this.addToGlobalRegistry = addToGlobalRegistry;
}
 
Example #16
Source File: PropertiesMeterFilter.java    From foremast with Apache License 2.0 5 votes vote down vote up
private static MeterFilter createMapFilter(Map<String, String> tags) {
    if (tags.isEmpty()) {
        return new MeterFilter() {
        };
    }
    Tags commonTags = Tags.of(tags.entrySet().stream()
            .map((entry) -> Tag.of(entry.getKey(), entry.getValue()))
            .collect(Collectors.toList()));
    return MeterFilter.commonTags(commonTags);
}
 
Example #17
Source File: WebMvcMetricsAutoConfiguration.java    From foremast with Apache License 2.0 5 votes vote down vote up
@Bean
@Order(0)
public MeterFilter metricsHttpServerUriTagFilter() {
    String metricName = this.properties.getWeb().getServer().getRequestsMetricName();
    MeterFilter filter = new OnlyOnceLoggingDenyMeterFilter(() -> String
            .format("Reached the maximum number of URI tags for '%s'.", metricName));
    return MeterFilter.maximumAllowableTags(metricName, "uri",
            this.properties.getWeb().getServer().getMaxUriTags(), filter);
}
 
Example #18
Source File: LocMetricsAutoConfigure.java    From loc-framework with MIT License 5 votes vote down vote up
@Bean
@Order(1)
public MeterFilter accessProfileMeterFilter() {
  return MeterFilter.accept(id -> {
    String profile = id.getTag(PROFILE_KEY);
    return StringUtils.isNotBlank(profile) && (profile.equals(LocConstants.PRO_PROFILE)
        || profile.equals(LocConstants.TEST_PROFILE));
  });
}
 
Example #19
Source File: LocMetricsAutoConfigure.java    From loc-framework with MIT License 5 votes vote down vote up
@Bean
@Order(2)
public MeterFilter denyUriMeterFilter() {
  return MeterFilter.deny(id -> {
    String uri = id.getTag(URI);
    return StringUtils.isNotBlank(uri) && EXCLUDE_PATH_PREFIX.stream().anyMatch(uri::startsWith);
  });
}
 
Example #20
Source File: HealthMeterRegistry.java    From micrometer with Apache License 2.0 5 votes vote down vote up
private boolean accept(Meter.Id id) {
    for (MeterFilter filter : serviceLevelObjectiveFilters) {
        MeterFilterReply reply = filter.accept(id);
        if (reply == MeterFilterReply.DENY) {
            return false;
        } else if (reply == MeterFilterReply.ACCEPT) {
            return true;
        }
    }
    return true;
}
 
Example #21
Source File: MeterFilterTest.java    From micrometer with Apache License 2.0 5 votes vote down vote up
@Test
void minExpectedOnTimer() {
    MeterFilter filter = MeterFilter.minExpected("name", Duration.ofNanos(100));
    Meter.Id timer = new Meter.Id("name", Tags.empty(), null, null, Meter.Type.TIMER);

    assertThat(filter.configure(timer, DistributionStatisticConfig.DEFAULT))
            .satisfies(conf -> assertThat(conf.getMinimumExpectedValueAsDouble()).isEqualTo(100));
}
 
Example #22
Source File: MeterFilterTest.java    From micrometer with Apache License 2.0 5 votes vote down vote up
@Test
void maxExpectedOnSummary() {
    MeterFilter filter = MeterFilter.maxExpected("name", 100.0);
    Meter.Id timer = new Meter.Id("name", Tags.empty(), null, null, Meter.Type.DISTRIBUTION_SUMMARY);

    assertThat(filter.configure(timer, DistributionStatisticConfig.DEFAULT))
            .satisfies(conf -> assertThat(conf.getMaximumExpectedValueAsDouble()).isEqualTo(100));
}
 
Example #23
Source File: MeterFilterTest.java    From micrometer with Apache License 2.0 5 votes vote down vote up
@Test
void minExpectedOnSummary() {
    MeterFilter filter = MeterFilter.minExpected("name", 100.0);
    Meter.Id timer = new Meter.Id("name", Tags.empty(), null, null, Meter.Type.DISTRIBUTION_SUMMARY);

    assertThat(filter.configure(timer, DistributionStatisticConfig.DEFAULT))
            .satisfies(conf -> assertThat(conf.getMinimumExpectedValueAsDouble()).isEqualTo(100));
}
 
Example #24
Source File: CommonMetricsFilter.java    From foremast with Apache License 2.0 5 votes vote down vote up
/**
 * Filter for "[PREFIX]_*"
 *
 * @param id
 * @return MeterFilterReply
 */
public MeterFilterReply accept(Meter.Id id) {
    if (!k8sMetricsProperties.isEnableCommonMetricsFilter()) {
        return MeterFilter.super.accept(id);
    }

    String metricName = id.getName();

    Boolean enabled = lookupWithFallbackToAll(this.properties.getEnable(), id, null);
    if (enabled != null) {
        return enabled ? MeterFilterReply.NEUTRAL : MeterFilterReply.DENY;
    }

    if (whitelist.contains(metricName)) {
        return MeterFilterReply.NEUTRAL;
    }
    if (blacklist.contains(metricName)) {
        return MeterFilterReply.DENY;
    }

    for(String prefix: prefixes) {
        if (metricName.startsWith(prefix)) {
            return MeterFilterReply.ACCEPT;
        }
    }

    for(String key: tagRules.keySet()) {
        String expectedValue = tagRules.get(key);
        if (expectedValue != null) {
            if (expectedValue.equals(id.getTag(key))) {
                return MeterFilterReply.ACCEPT;
            }
        }
    }

    return MeterFilterReply.DENY;
}
 
Example #25
Source File: CommonMetricsFilter.java    From foremast with Apache License 2.0 5 votes vote down vote up
/**
 * Filter for "[PREFIX]_*"
 *
 * @param id
 * @return MeterFilterReply
 */
public MeterFilterReply accept(Meter.Id id) {
    if (!k8sMetricsProperties.isEnableCommonMetricsFilter()) {
        return MeterFilter.super.accept(id);
    }

    String metricName = id.getName();

    Boolean enabled = lookupWithFallbackToAll(this.properties.getEnable(), id, null);
    if (enabled != null) {
        return enabled ? MeterFilterReply.NEUTRAL : MeterFilterReply.DENY;
    }

    if (whitelist.contains(metricName)) {
        return MeterFilterReply.NEUTRAL;
    }
    if (blacklist.contains(metricName)) {
        return MeterFilterReply.DENY;
    }

    for(String prefix: prefixes) {
        if (metricName.startsWith(prefix)) {
            return MeterFilterReply.ACCEPT;
        }
    }

    for(String key: tagRules.keySet()) {
        String expectedValue = tagRules.get(key);
        if (expectedValue != null) {
            if (expectedValue.equals(id.getTag(key))) {
                return MeterFilterReply.ACCEPT;
            }
        }
    }

    return MeterFilterReply.DENY;
}
 
Example #26
Source File: MeterFilterTest.java    From micrometer with Apache License 2.0 5 votes vote down vote up
@Test
void maximumAllowableMetrics() {
    MeterFilter filter = MeterFilter.maximumAllowableMetrics(1);

    Meter.Id id = new Meter.Id("name", Tags.empty(), null, null, Meter.Type.COUNTER);
    Meter.Id id2 = new Meter.Id("name2", Tags.empty(), null, null, Meter.Type.COUNTER);

    assertThat(filter.accept(id)).isEqualTo(MeterFilterReply.NEUTRAL);
    assertThat(filter.accept(id)).isEqualTo(MeterFilterReply.NEUTRAL);
    assertThat(filter.accept(id2)).isEqualTo(MeterFilterReply.DENY);
}
 
Example #27
Source File: MeterFilterTest.java    From micrometer with Apache License 2.0 5 votes vote down vote up
@Test
@Issue("#329")
void renameTags() {
    MeterFilter filter = MeterFilter.renameTag("hystrix", "group", "hystrixgroup");
    Meter.Id id = new Meter.Id("hystrix.something", Tags.of("k", "v", "group", "mygroup"), null, null, Meter.Type.GAUGE);
    assertThat(filter.map(id)).has(tag("hystrixgroup", "mygroup"));

    Meter.Id id2 = new Meter.Id("something.else", Tags.of("group", "mygroup"), null, null, Meter.Type.GAUGE);
    assertThat(filter.map(id2)).has(tag("group", "mygroup"));
}
 
Example #28
Source File: MeterFilterTest.java    From micrometer with Apache License 2.0 5 votes vote down vote up
@Test
void replaceTagValues() {
    MeterFilter filter = MeterFilter.replaceTagValues("status", s -> s.charAt(0) + "xx", "200");

    Meter.Id id = new Meter.Id("name", Tags.of("status", "400"), null, null, Meter.Type.COUNTER);
    Meter.Id filteredId = filter.map(id);
    assertThat(filteredId).has(tag("status", "4xx"));

    id = new Meter.Id("name", Tags.of("status", "200"), null, null, Meter.Type.COUNTER);
    filteredId = filter.map(id);
    assertThat(filteredId).has(tag("status", "200"));
}
 
Example #29
Source File: CommonMetricsFilter.java    From foremast with Apache License 2.0 5 votes vote down vote up
/**
 * Filter for "[PREFIX]_*"
 *
 * @param id
 * @return MeterFilterReply
 */
public MeterFilterReply accept(Meter.Id id) {
    if (!k8sMetricsProperties.isEnableCommonMetricsFilter()) {
        return MeterFilter.super.accept(id);
    }

    String metricName = id.getName();

    Boolean enabled = lookupWithFallbackToAll(this.properties.getEnable(), id, null);
    if (enabled != null) {
        return enabled ? MeterFilterReply.NEUTRAL : MeterFilterReply.DENY;
    }

    if (whitelist.contains(metricName)) {
        return MeterFilterReply.NEUTRAL;
    }
    if (blacklist.contains(metricName)) {
        return MeterFilterReply.DENY;
    }

    for(String prefix: prefixes) {
        if (metricName.startsWith(prefix)) {
            return MeterFilterReply.ACCEPT;
        }
    }

    for(String key: tagRules.keySet()) {
        String expectedValue = tagRules.get(key);
        if (expectedValue != null) {
            if (expectedValue.equals(id.getTag(key))) {
                return MeterFilterReply.ACCEPT;
            }
        }
    }

    return MeterFilterReply.DENY;
}
 
Example #30
Source File: MeterFilterTest.java    From micrometer with Apache License 2.0 5 votes vote down vote up
@Test
void ignoreTags() {
    MeterFilter filter = MeterFilter.ignoreTags("k1", "k2");
    Meter.Id id = new Meter.Id("name", Tags.of("k1", "v1", "k2", "v2", "k3", "v3"), null, null, Meter.Type.COUNTER);

    Meter.Id filteredId = filter.map(id);
    assertThat(filteredId).has(tag("k3"));
    assertThat(filteredId).doesNotHave(tag("k1"));
    assertThat(filteredId).doesNotHave(tag("k2"));
}