title: Spring boot micrometer register cache metrics
body: <p>I have a problem with creating metrics for 2 instances of the application.
  I created metrics for hazelcast cache metrics using</p>
  
  <pre><code> HazelcastCacheMetrics.monitor(prometheusMeterRegistry, (IMap&lt;?, ?&gt;) cache.getNativeCache());
  </code></pre>
  
  <p>and when I run 1 instance of application everything work properly but when I run 2 instances i got error </p>
  
  <pre><code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hazelcastCacheMetricConfig': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Prometheus requires that all meters with the same name have the same set of tag keys. There is already an existing meter named 'cache_size' containing tag keys [cache, cacheManager, name]. The meter you are attempting to register has keys [cache].
  </code></pre>
  
  <p>Or when I change registered metrics into</p>
  
  <pre><code>@Autowired
  private CacheMetricsRegistrar cacheMetricsRegistrar;
  
  cacheMetricsRegistrar.bindCacheToRegistry(cache, Tag.of("instance", podName));
  </code></pre>
  
  <p>I have this error</p>
  
  <pre><code> Error creating bean with name 'hazelcastCacheMetricConfig': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Prometheus requires that all meters with the same name have the same set of tag keys. There is already an existing meter named 'cache_size' containing tag keys [cache, cacheManager, name]. The meter you are attempting to register has keys [cache, instance, name].
  </code></pre>
  
  <p>Thanks for the help for solving this problem</p>