How can I change metrics naming in Micrometer

Viewed 27

At the moment on my endpoint /actuator/prometheus I receive answer for timer like this:

...
# HELP MY_NAME_seconds  
# TYPE MY_NAME_seconds summary
MY_NAME_seconds_count{application="MyApplication",smth="else",} 520.0
MY_NAME_seconds_sum{application="MyApplication",smth="else",} 1249.024
# HELP MY_NAME_seconds_max  
# TYPE MY_NAME_seconds_max gauge
...

I'm creating my timer like this: Metrics.timer(operation, tags).record(endTime - startTime, TimeUnit.MILLISECONDS); Is it possible to change naming from MY_NAME_seconds_count to MY_NAME_millis_count?

1 Answers

Answer from micrometer support:

Generally I'd say this isn't necessary. The value of the metric is a floating point seconds value. If you want to display ms on a chart you can safely multiply the time series by 1000 There is a healthy principle of using base units whenever possible. Seconds is a base unit, which makes it easier to scale the time series in either direction (either down to millis or up to minutes) The word 'seconds' comes from that convention in the Prometheus ecosystem. Other ecosystems may suggest that this is redundant Naming convention can set on a registry under registry.config()

Related