Closed tudborg closed 9 months ago
Hey @tbug. In order to support floats there would need to be a change to implement sums in the same manner that the distributions are handled as there is no way to support summing at the time of the call efficiently.
In your particular use case, you can just use the distribution which includes the sum as one of its aggregates. In the example you gave, you'd just look for the http_request_duration_seconds_total_sum
. I realize it may not be ideal, but it will get you the value you're looking for and doesn't increase the system load any more than supporting floats in sum.
I'm wondering if instead of failing the value could be truncated before being used to update ets. That would make the feature usable. I'm not sure how worthwhile the usecase of unit: {:native, :second}
actually is if measurements are in the sub-seconds.
I'm also having this issue, while I can work around this using distribution()
, it exports 3 extra metrics per label which I don't need. In my use-case there would be about 1000 distinct label values so my concern is how this affects disk usage in prometheus.
I have a sum over the amount of request duration from
Plug.Telemetry
more or less defined like this:Telemetry.Metrics
converts the native time integer to a float. I think the behaviour makes sense. The alternative of just using the output fromSystem.convert_time_unit/3
would be that most of my measurements would be 0s because they are sub-second.However, this fails because the
Sum
module'shandle_event/4
is usingets:update_counter/4
which only works with integers. See line 61 of from: https://github.com/beam-telemetry/telemetry_metrics_prometheus_core/blob/cd8bea3df0c0b4c6aaad5c2b7d42760cbadf0c07/lib/core/sum.ex#L53-L67I'm not quite sure how to attack this problem. If the conversion happened when rendering instead of when storing this wouldn't be an issue, but that only solves it for
:native
vs:second
problem. in general I think it should be possible to sum any numeric. Not just integers.