You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In two places, output related to Timer values is expressed in seconds, regardless of the setting of baseUnit:
MTimer#toString() - uses Duration output with seconds units which is often not enough precision to display meaningful data for small values
JSON-formatted output - uses seconds as units. Here the output is decimal (not truncated to an integer) but is a change from 3.x behavior.
Some notes
The Micrometer Timer to which Helidon's API delegates does not itself support baseUnits as a builder setting. Micrometer's timer stores values in nanoseconds internally. The various methods on Micrometer's Timer which return the timer's data do accept a TimeUnit parameter which determines the units in which the returned value (a double) is expressed.
That said, the Helidon Timer.Builder by virtue of extending Meter.Builder, does expose a baseUnit(String) method. The current Helidon implementation ignores that setting entirely when it builds the Micrometer Timer; there is no way to communicate this value to the Micrometer Timer.Builder.
The Micrometer Timer does expose a baseTimeUnit method with this Javadoc:
The base time unit of the timer to which all published metrics will be scaled
but Micrometer decides internally what this value will be based on what lower-level timer implementation(s) are used by the higher-level timer. For example, typically the actual timer Micrometer uses is a PrometheusTimer and its baseTimeUnit is seconds.
One possibility could be for the Helidon MTimer implementation to save the specified base unit when the Helidon Timer.Builder#baseUnit(String) method is invoked and then for the Helidon code to use that in the toString() output.
Helidon could also use such a saved base unit value in formatting the JSON output. If the developer never specified a base unit to use, the default could be nanoseconds which (IIRC) would reinstate the 3.x behavior.
Steps to reproduce
Add a Timer to the SE QuickStart app's GreetService:
Environment Details
Problem Description
In two places, output related to
Timer
values is expressed in seconds, regardless of the setting ofbaseUnit
:MTimer#toString()
- usesDuration
output with seconds units which is often not enough precision to display meaningful data for small valuesSome notes
The Micrometer
Timer
to which Helidon's API delegates does not itself supportbaseUnits
as a builder setting. Micrometer's timer stores values in nanoseconds internally. The various methods on Micrometer'sTimer
which return the timer's data do accept aTimeUnit
parameter which determines the units in which the returned value (adouble
) is expressed.That said, the Helidon
Timer.Builder
by virtue of extendingMeter.Builder
, does expose abaseUnit(String)
method. The current Helidon implementation ignores that setting entirely when it builds the MicrometerTimer
; there is no way to communicate this value to the MicrometerTimer.Builder
.The Micrometer
Timer
does expose abaseTimeUnit
method with this Javadoc:but Micrometer decides internally what this value will be based on what lower-level timer implementation(s) are used by the higher-level timer. For example, typically the actual timer Micrometer uses is a
PrometheusTimer
and itsbaseTimeUnit
is seconds.One possibility could be for the Helidon
MTimer
implementation to save the specified base unit when the HelidonTimer.Builder#baseUnit(String)
method is invoked and then for the Helidon code to use that in thetoString()
output.Helidon could also use such a saved base unit value in formatting the JSON output. If the developer never specified a base unit to use, the default could be nanoseconds which (IIRC) would reinstate the 3.x behavior.
Steps to reproduce
Add a
Timer
to the SE QuickStart app'sGreetService
:In the constructor:
As the new first lines of
getDefaultMessageHandler
:Build and run the app.
curl http://localhost:8080/greet
# to update the timercurl http://localhost:8080/observe/metrics -H "Accept: application/json"
The server console output contains
(note the 0 reported time) and the metrics output includes
The output is expressed in seconds.
The text was updated successfully, but these errors were encountered: