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
Prometheus sends requests to the monitored application to collect metrics, and you configure the interval this happens in Prometheus. It would then make sense that default metrics are collected when Prometheus requests them. Right?
So why is it that prom-client provides no way to collect default metrics on demand and instead opt collect them on an interval? The Prometheus docs on writing exporters says and I quote:
Metrics should only be pulled from the application when Prometheus scrapes them, exporters should not perform scrapes based on their own timers. That is, all scrapes should be synchronous.
Accordingly, you should not set timestamps on the metrics you expose, let Prometheus take care of that. If you think you need timestamps, then you probably need the Pushgateway instead.
Clients MUST be written to be callback based internally. Clients SHOULD generally follow the structure described here.
The key class is the Collector. This has a method (typically called ‘collect’) that returns zero or more metrics and their samples. Collectors get registered with a CollectorRegistry. Data is exposed by passing a CollectorRegistry to a class/method/function "bridge", which returns the metrics in a format Prometheus supports. Every time the CollectorRegistry is scraped it must callback to each of the Collectors’ collect method.
There is no such collect method to Collectors in this library, there's only the synchronous get method which leads me to conclude that this library's core design is a canonical example of doing Prometheus wrong.
The text was updated successfully, but these errors were encountered:
Prometheus sends requests to the monitored application to collect metrics, and you configure the interval this happens in Prometheus. It would then make sense that default metrics are collected when Prometheus requests them. Right?
So why is it that prom-client provides no way to collect default metrics on demand and instead opt collect them on an interval? The Prometheus docs on writing exporters says and I quote:
Furthermore the writing client libraries document has this to say:
There is no such collect method to Collectors in this library, there's only the synchronous get method which leads me to conclude that this library's core design is a canonical example of doing Prometheus wrong.
The text was updated successfully, but these errors were encountered: