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
I am a bit confused about how to use the Histogram style of metrics successfully with swift-metrics.
When interacting with the Timer interface from swift-metrics you can specify the unit of your time measurements. But when configuring PrometheusMetricsFactory I cannot specify the unit of my histogram buckets. If I use the default values ([0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10]), most measurements will end up in the +Inf bucket, because internally the MetricsHistogramTimer always records nanoseconds. I think the only way to make it work right know would be to change the buckets to be in ns, [0.005e9, 0.01e9, 0.025e9, 0.05e9, 0.1e9, 0.25e9, 0.5e9, 1e9, 2.5e9, 5e9, 10e9] which seems quite unintuitive.
Probably it would make sense to default to seconds for the unit and change the MetricsHistogramTimer implementation to convert the nanoseconds to seconds. Since this is a global setting it will apply to ALL "timer" metrics emitted by any library in the process. So maybe this should be part of the TimerImplementation configuration.
The text was updated successfully, but these errors were encountered:
t089
changed the title
TimerHander implementation always records nanoseconds in Histogram
TimerHandler implementation always records nanoseconds in Histogram
Jun 20, 2022
I am a bit confused about how to use the Histogram style of metrics successfully with
swift-metrics
.When interacting with the
Timer
interface fromswift-metrics
you can specify the unit of your time measurements. But when configuringPrometheusMetricsFactory
I cannot specify the unit of my histogram buckets. If I use the default values ([0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10]
), most measurements will end up in the+Inf
bucket, because internally theMetricsHistogramTimer
always records nanoseconds. I think the only way to make it work right know would be to change the buckets to be in ns,[0.005e9, 0.01e9, 0.025e9, 0.05e9, 0.1e9, 0.25e9, 0.5e9, 1e9, 2.5e9, 5e9, 10e9]
which seems quite unintuitive.Probably it would make sense to default to seconds for the unit and change the
MetricsHistogramTimer
implementation to convert the nanoseconds to seconds. Since this is a global setting it will apply to ALL "timer" metrics emitted by any library in the process. So maybe this should be part of theTimerImplementation
configuration.Example
The text was updated successfully, but these errors were encountered: