Traditionally, all metrics needed to be provided the value in milliseconds to be calculated and rendered correctly by Graphite via StatsD. StatsLib continued this tradition, but did nothing to indicate or enforce it besides a docstring on the parameter.
Because of the above, the interface was made somewhat confusing:
- Prometheus naming convention recommends supplying the metric name with a unit
- Prometheus encourages sending values in human terms - this is usually seconds in the smallest unit
- Because of the above, the metric unit was set as "seconds" but we gave the verb the duration in milliseconds (unit mismatch)
Given our ownership of StatsLib, we have the opportunity to make TimingMetric unit-aware and thus allow the developer to give us the metric value in whatever unit they want. Given that, StatsLib could then do the appropriate recalculation to milliseconds behind the scenes.
This could manifest as either/both:
- Perform the appropriate recalculation to milliseconds based on a developer-supplied unit
- Append the developer-supplied unit to the metrics, foregoing the need to suffix the metric name with the unit
Thanks to @Tarrow for this idea!