The specification and java doc specifies that the default unit for the Timer metric is nanoseconds.
However, the unit bears no significance for Timer metric whatsoever and serves only to confuse users.
The Timer interface indicates that explicit API calls to update and retrieve times is through the Java Duration object. However, it should be noted that timing with context will return a long which indicates how many nanoseconds transpired when the stop() method of the context is called. Similarily, interacting with the underlying Snapshot will provide values in nanoseconds. Yet ultimately, the formatted result in Prometheus is in seconds.
Units, however, may still be useful to non Prometheus registries.
The specification and java doc specifies that the default unit for the
Timer
metric is nanoseconds. However, the unit bears no significance forTimer
metric whatsoever and serves only to confuse users. TheTimer
interface indicates that explicit API calls to update and retrieve times is through the JavaDuration
object. However, it should be noted that timing with context will return along
which indicates how many nanoseconds transpired when thestop()
method of the context is called. Similarily, interacting with the underlyingSnapshot
will provide values in nanoseconds. Yet ultimately, the formatted result in Prometheus is in seconds.Units, however, may still be useful to non Prometheus registries.