Micrometer: CacheMeterBinder - cache.gets is set twice

Created on 12 Mar 2019  路  4Comments  路  Source: micrometer-metrics/micrometer

The metric cache.gets is configured twice in CacheMeterBinder; once on line 62 and is linked to the misses and then on line 72 and linked to the hits. Is this intentional please?

question

All 4 comments

@samanthacatania Assuming that you're referring CacheMeterBinder (not CacheMeterBuilder), as you've noticed, one for misses and another for hits. Any problem with it?

@izeye You're correct I meant CacheMeterBinder. When loading the value from actuator only the hits seem to be returned.

http://localhost:8090/actuator/metrics/cache.gets
{ "name": "cache.gets", "description": "The number of times cache lookup methods have returned a cached value.", "measurements": [ { "statistic": "COUNT", "value": 3.0 } ], "availableTags": [ { "tag": "result", "values": [ "hit", "miss" ] }, { "tag": "appointments", "values": [ "cache" ] }, { "tag": "cache", "values": [ "appointments" ] }, { "tag": "name", "values": [ "appointments" ] }, { "tag": "cacheManager", "values": [ "cacheManager" ] } ] }

@samanthacatania http://localhost:8090/actuator/metrics/cache.gets gives you a merged result based on the meter name cache.gets.

If you want to see "hit" or "miss" result specifically, you can drill down to it by specifying tag(s) as follows:

  • http://localhost:8090/actuator/metrics/cache.gets?tag=result:hit
  • http://localhost:8090/actuator/metrics/cache.gets?tag=result:miss

See the "Metrics endpoint" section in the Spring Boot reference for more details.

Closing as this is a question on Spring Boot Actuator metrics endpoint.

If you have an additional question, it'd be better to ask it on StackOverflow with tags like spring-boot, spring-boot-actuator, and micrometer.

@izeye Thanks for clarifying, it is appreciated.

Was this page helpful?
0 / 5 - 0 ratings