Apply multiple functions on metric

15 views
Skip to first unread message

Avner Adania

unread,
Feb 26, 2020, 9:37:50 AM2/26/20
to Prometheus Users
i'm trying to apply two function on one metric. 
For example:

i would like to get a perSecond(Graphite function) on a sumSeries function:

perSecond(sumSeries(prefix.region.cluster.metric_name.*.offset),"Rate")

Question is how to apply two or more functions on one metric?

Aliaksandr Valialkin

unread,
Feb 26, 2020, 5:26:07 PM2/26/20
to Avner Adania, Prometheus Users
I believe something like the following PromQL query should work for your case:

sum(rate(metric[5m]))

Note that you cannot swap sum() and rate() in the query in general case, since this can give unexpected results. See https://www.robustperception.io/rate-then-sum-never-sum-then-rate for details.

--
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-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/51a596fb-67d1-45d8-a069-19c94fc2a211%40googlegroups.com.


--
Best Regards,

Aliaksandr
Reply all
Reply to author
Forward
0 new messages