hipages / php-fpm_exporter

A prometheus exporter for PHP-FPM.
Apache License 2.0
591 stars 118 forks source link

phpfpm_process_request_duration should not be a gauge #256

Closed cdaguerre closed 1 year ago

cdaguerre commented 1 year ago

According to the php docs, phpfpm_process_request_duration should not be a gauge, it should be a counter.

It states:

name description
requests The total number of requests served.
request duration The total time in seconds spent serving requests.

To get a gauge you'd have to caculate request duration / requests, which from the looks of the initial PR is not the case.

While I think this is a bug, this should be probably not be changed because I guess it could break a lot of setups since it's been around for 4 years... Introducing a new metric called phpfpm_process_average_request_duration (histogram) would probably be a better idea... Would solve https://github.com/hipages/php-fpm_exporter/issues/77

Related issues: https://github.com/hipages/php-fpm_exporter/issues/66 https://github.com/hipages/php-fpm_exporter/issues/205

cdaguerre commented 1 year ago

False alert: from looking at the code, it seems the documentation is wrong and request duration is actually the time spent serving the last request. I opened a PR to fix the docs. https://github.com/php/doc-en/pull/1860