Hi,
I am trying to get the sum of a counter variable over a period of time. The
problem that I encounter is when the pod is restarted, the counter drops to
"zero" and starts again. Hence I lose the old value.
As per the attached diagram the value before pod restart is 3 and the value
after pod restart is 2. I want to have 3+2 = 5.
*Scenario *
*Before Pod restart*number_of_orders{label1="a",label2="b",label3="c"} 3
number_of_orders{label1="a",label2="b",label3="d"} 10
number_of_orders{label1="a",label2="b",label3="e"} 10
*After Pod restart*number_of_orders{label1="a",label2="b",label3="c"} 2
number_of_orders{label1="a",label2="b",label3="d"} 1
number_of_orders{label1="a",label2="b",label3="e"} 2
I would like to have a total number of orders for a dimension (for example
by label3) for the last 2 days.
So I am using the below PromQL.
sum by (label3) (number_of_orders{component="component_dev",label3="c"})
-- I am expecting the value to be 5 (total number of orders by dimension
label3). But I got 3 as a result.
Also trying to use increase
sum by (label3)
(increase(number_of_orders{component="component_dev",label3="c"}[48h]))
But here I get the result as 3.14
Any help would be much appreciated !!
Regards,
Pradeep Anbalagan
[image: image.png]
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/prometheus-users/CAOhMBuXz29ubRvu8Ucb8kRCA3aucO09p_uC6-BuZaxbj_wo2Uw%40mail.gmail.com.