title: Reducing metrics dimensions with a MetricFilter
body: <p>We're currently implementing a Spring Boot service with Kafka stream and are currenty looking into the automatically generated metrics so we can establish proper monitoring.</p>
  <p>We've found that the data (as exposed by the actuator endpoint) is split into too many dimensions for our needs; we'd be fine with metrics &quot;by topic&quot; for now, but there are also dimensions like &quot;kafka.version&quot;, &quot;partitions&quot; etc.</p>
  <p>What we did was to try and add a <code>MeterFilter</code> bean like this:</p>
  <pre><code>@Bean
  public MeterFilter meterFilter() {
      return MeterFilter.ignoreTags(&quot;spring.id&quot;, &quot;kafka.version&quot;, &quot;client.id&quot;, &quot;partition&quot;);
  }
  </code></pre>
  <p><a href="https://stackoverflow.com/questions/55146929/micrometer-remove-disable-a-certain-tag">This question</a> states &quot;this will ignore all meters with this tag.&quot;</p>
  <p>That doesn't seem entirely the case - we see output like
  (endpoint .../actuator/metrics/kafka.consumer.fetch.manager.records.lag)</p>
  <pre><code>{
    &quot;name&quot;: &quot;kafka.consumer.fetch.manager.records.lag&quot;,
    &quot;description&quot;: &quot;The latest lag of the partition&quot;,
    &quot;measurements&quot;: [
      {
        &quot;statistic&quot;: &quot;VALUE&quot;,
        &quot;value&quot;: 0.0
      }
    ],
    &quot;availableTags&quot;: [
      {
        &quot;tag&quot;: &quot;topic&quot;,
        &quot;values&quot;: [
          &quot;our_internal_app-KSTREAM-TOTABLE-STATE-STORE-0000000002-changelog&quot;
        ]
      }
    ]
  }
  </code></pre>
  <p>This remains the only metric shown at this endpoint.</p>
  <p>Does this metric really not originally contain the tags &quot;kafka.version&quot; and &quot;partition&quot;? If we remove the filter, that topic appears along with several more (including internal ones) and with the dimensions we tried to remove.</p>
  <p>We were expecting to either not see any metric (&quot;ignore all meters with this tag&quot;) or all topics, which is how we read the <code>MeterFilter.ignoreTags()</code> javadoc: &quot;Suppress tags with given tag keys.&quot; (suppress <em>tags</em>, not <em>metrics containing them</em>).</p>
  <p>What are we misunderstanding?</p>