prometheus_client_php icon indicating copy to clipboard operation
prometheus_client_php copied to clipboard

Add default metrics about the gathering process

Open LKaemmerling opened this issue 3 years ago • 2 comments

ATM all official Prometheus client libraries expose default metrics about the scraping process, like how many RAM was used for the gathering of the metrics, how long did it take?

https://github.com/prometheus/client_golang/blob/master/prometheus/process_collector.go#L63 https://github.com/prometheus/client_python/blob/master/prometheus_client/process_collector.py#L62

Some of the "default" metrics does not make sense in the PHP world, like https://github.com/prometheus/client_golang/blob/master/prometheus/process_collector.go#L101 but the others might make sense: https://github.com/prometheus/client_golang/blob/master/prometheus/process_collector.go#L69

@rdohms what do you think about it?

LKaemmerling avatar Oct 20 '20 05:10 LKaemmerling

That would be only for the process of gathering the metrics from storage and formatting in text right?

I think it's worth it if it's standard practice. PHP is not great at measuring all that, but we can try to get some metrics and log them. What we would need to look at is how this plays with all the extra framework stuff out of our control, if we can gather precise metrics or if we are only telling part of the story.

rdohms avatar Oct 20 '20 08:10 rdohms

My idea would be to add a timestamp + used memory size at the construction of the RegistryCollector and before we render (at https://github.com/PromPHP/prometheus_client_php/blob/f151e0b97e0fa59aee553be8e25b84b52fc4172d/src/Prometheus/CollectorRegistry.php#L69) the metrics again save the timestamp + used memory and calculate the difference between them.

LKaemmerling avatar Oct 20 '20 08:10 LKaemmerling