You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Perhaps I'm misunderstanding some fundamental concept here, but it seems to me there is a bug in the way metrics are handled by provided adapters. I would expect that setting the value of the gauge metric to two different values in sequence would result in both those values being present in the MetricFamilySamples object. Instead, the second value overwrites the first one. Also, no timestamp seems to be included with any of the metrics, so I'm guessing Prometheus will assign the timestamp when scraping. This all means that, in order to have accurate metrics, you need to configure Prometheus to scrape your data once every second, which does not seem very efficient.
try to add an label with current datetime. you will get new entry for any new combination of label-values...
But that label will not act as the metric timestamp, right? Prometheus will still assign the same timestamp to all those metrics based on the time of scraping. Or am I wrong?
yes, prometheus use the scraping timestamp. but i have also an PR (#54) to handle this, so you can set your own TS.
on the other hand, you have to strip this datetime-label so that prometheus/grafana can better handle this samples and recognize that this is one stream:
Perhaps I'm misunderstanding some fundamental concept here, but it seems to me there is a bug in the way metrics are handled by provided adapters. I would expect that setting the value of the gauge metric to two different values in sequence would result in both those values being present in the
MetricFamilySamples
object. Instead, the second value overwrites the first one. Also, no timestamp seems to be included with any of the metrics, so I'm guessing Prometheus will assign the timestamp when scraping. This all means that, in order to have accurate metrics, you need to configure Prometheus to scrape your data once every second, which does not seem very efficient.Here's a test case I wrote to demonstrate what I'm saying: https://github.com/pavlepredic/prometheus_client_php_test/blob/master/src/GaugeTest.php. In the test, I use
InMemory
adapter (because it's easier to set up), but I'm getting the same behaviour withRedis
adapter.Am I missing something or is there a design flaw in the library?
The text was updated successfully, but these errors were encountered: