On 05/01/2021 15:35, Roman Dodin wrote:
Hello community,
I have a telemetry system that sends data into Prometheus when the
data changes (i.e. its a push-on-event mechanism, not a
sample/interval push)
That means, if a system is stable, then the last reported value can be
reported quite some time back.
Let's say this metric is called "my_metric", how do I get its last
reported value without specifying manually the timeframe to look back?
So far I come up with the following query:
my_metric{label="value"}[100y]
Is this the only way to get the last value of a series, or maybe there
is another alternative?
Prometheus is designed to be used as a scrape (pull) system where
metrics are regularly fetched and their values recorded in the TSDB
(even if they haven't changed). As a result of this and metric that
doesn't have a recent value is seen as "stale" and isn't returned when
doing instant queries. The default setting is 5 minutes, which leads to
the generally suggested maximum scrape interval of 2 minutes (to allow
for a single scrape failure without the series being marked as stale).
I'm not sure how you are pushing events into Prometheus, but it sounds
like you are working against the design of the system. Additionally
Prometheus is a metrics system rather than an event storage system.
For event storage I would use a different database (possibly SQL based
or a generic timeseries database) which would have no problems with the
sort of queries you are wanting.
--
You received this message because you are subscribed to the Google Groups
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/prometheus-users/68e751f4-db71-c927-3c5b-dc502850da16%40Jahingo.com.