On 04 May 08:55, Debashish Ghosh wrote:
> Hi,
>     I am plotting a prometheus timeline using the query -( increase(metric 
> A)[5m] - increase(metric B)[5m]) to derive another timeline metric C .
> But due to probably some weird case , sometimes this value is negative . Is 
> there a way in Prom QL where I can say something like a conditional 
> operator like metricA - metricB <0 ?0: metricA-metricB.
> So if the value is -ve use 0 otherwise use the actual value .

You can use:


clamp_min(metricA - metricB, 0)

> 
> Thanks
> Debashish
> 
> -- 
> 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/2985dad3-c4fd-4db7-b827-5487d5b321f8%40googlegroups.com.


-- 
 (o-    Julien Pivotto
 //\    Open-Source Consultant
 V_/_   Inuits - https://www.inuits.eu

-- 
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/20200504163317.GA747513%40oxygen.

Attachment: signature.asc
Description: PGP signature

Reply via email to