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