prometheus-plugs icon indicating copy to clipboard operation
prometheus-plugs copied to clipboard

Change http_request_<duration> for PlugPipelineInstrumenter

Open PhillippOhlandt opened this issue 5 years ago • 1 comments

Hey,

I tried switching from :microseconds to :seconds since Prometheus suggests to use second as base unit. The problem is, the config setting only changes the metric name but not the buckets and value. While defining custom buckets is not a big deal, the reported value is still in microseconds.

Or do I miss something here?

PhillippOhlandt avatar May 28 '19 10:05 PhillippOhlandt

I see the same thing... shouldn't the diff take into account the duration_unit?

Looking at https://github.com/deadtrickster/prometheus-plugs/blob/72fa654abd1222ee298e13051035d874fcaa1adf/lib/prometheus/plug_pipeline_instrumenter.ex#L150-L151

Shouldn't that instead be

diff = :erlang.convert_time_unit(stop - start, :native, duration_unit)

sorliem avatar Mar 23 '22 15:03 sorliem