-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow timestamp in metric samples #64
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Simon Podlipsky <[email protected]>
Can you share the rationale behind this? Prometheus might have problems ingesting metrics if timestamps are either in the future (clocks might be misaligned) and in the case of distributed applications, timestamps might be inconsistent too, which is why to unify them as "when things were observed", which is the result of not having a timestamp in the exposed metrics. |
@pachico, if you don't mind I will share mine. We have following setup: multiple nodes serving http-requests using php-fpm. Each node has its own local instance of redis storing metrics, each node scraped separately. Once written, any metric is stored in redis forever. So even if part reporting that metric is dead or removed, metric itself continues being exported. And you can't tell if it has been updated right now or a long time ago. In opposite to manual housekeeping exporting with timestamp could help prometheus mark metric as staled. |
You seem to be describing a common issue with Prometheus exporters, in general. The way they solved it is, in my opinion, better than adding a timestamp (https://vector.dev/docs/reference/configuration/global-options/#expire_metrics_secs): metrics that didn't change within a certain interval were not exported. Having Redis a TTL mechanism I might be in favour of using a SETEX every time there is an update to a given metric and letting it, instead, expire after a certain amount of time. In addition, you would have smaller exported payloads and a smaller memory usage footprint in Redis. |
Agree, seems like a better option. But |
We're using victoriametrics that support openmetrics format. |
Any chance that this gets implemented? Would love to be able to add timestamps. |
@johannesx75, we switched to telegraf as a local aggregator. Each php-node have its local telegraf instance, application uses statsd to report metrics. On telegraf side we use prometheus plugin to export metrics. Works fine, there are settings for obsolescence and you also can export update timestamp |
Metric line can also contain optional timestamp.
Should I move forward with this?