time() function...

71 views
Skip to first unread message

Vishwanath

unread,
Feb 29, 2024, 11:29:18 AMFeb 29
to prometheus-developers
As per Prometheus documentation - time(0 function doesn;t give current time, but the time at which expression is evaluated (below)

time() returns the number of seconds since January 1, 1970 UTC. Note that this does not actually return the current time, but the time at which the expression is to be evaluated.

Does this mean  "time()-timestamp(my_metric)" can plot ingestion latency for any metric ingested ?

Thank you in advance for your answers.

-Vishwanath.

Julius Volz

unread,
Mar 2, 2024, 3:41:36 PMMar 2
to Vishwanath, prometheus-developers
No, that expression would give you the number of seconds since the start of the last scrape of a target (or recording rule evaluation), relative to the query evaluation timestamp.

For example, if you had a scrape interval of 15s, that value would move somewhere roughly between 0s - 15s. See: https://demo.promlens.com/?l=fycmtZbOWVY

--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/CAPVy_QUwoANF2zycwaKP%3D6APDLd%3DtZRr-j3sz-nnm6K2Eyrrcg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages