boynux / squid-exporter

Squid Prometheus Exporter

Home Page:https://www.boynux.com/squid-exporter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Service Times are Counters instead of Gauges

alvarocabanas opened this issue · comments

Describe the bug
In the prometheus definition "A counter is a cumulative metric that represents a single monotonically increasing counter whose value can only increase or be reset to zero on restart".

Since service_time metrics are calculated on buckets that vary as the time passes, the values of those metrics increase and decrease with time, so I think they should be treated as Gauges.

The problem gets worse when using the exporter with the OpenTelemetry prometheus receiver as Counters are translated into monotonic cummulative metrics and every time there is a decrease in the.value the startTimestamp is reset, so openTelemetry treats it as a new sequence.

To Reproduce
Executing the exporter and looking at the metrics from the endpoint you can see the service_times are counters.

Scrapping the exporter with the OpenTelemetry Collector and the prometheus receiver you get the result that you can see in the image attached whenever there is a decrease in the value of those counters.

Expected behavior
I would consider those metrics as GAUGE.

OS (please complete the following information):

  • OS: all
  • Version 1.10.3

image

Hi @alvarocabanas ,

Thanks for filing this issue, I guess you are right that service times should be gauges and not counters. That's probably overlooked while implementing service time metrics.

Since it's a metadata change only, I don't see any issues with changing the counters to gauges for those metrics. If you have time to create a PR for this change it would be great.

Hi @boynux, thanks for the quick response. This is the PR I opened #68

Closing this, thanks for the PR