Status Enum reporting both states simultaneously? #770
-
I have a measurement device that I can query over telnet with prometheus_client in python. I can report the value so Prometheus can see it, but when I try to report the status (connected/not connected) I somehow see both states at the same time? The python script is attached, and what I see in the Prometheus web console: https://imgur.com/a/ZFo8GnT What am I doing wrong with the prometheus_client.Enum? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello, you are using Enum properly and it is expected to see both states at the same time. You will see that the value of one of the states is 1, and the other values are 0. The series with a value of 1 is the state that is active. The reason for this behavior is that it avoids creating lots of churn in your Prometheus instance where series are deleted and re-created for each state change, and allows easier use of some operations. If you want to query for just the active state you can use |
Beta Was this translation helpful? Give feedback.
Hello, you are using Enum properly and it is expected to see both states at the same time. You will see that the value of one of the states is 1, and the other values are 0. The series with a value of 1 is the state that is active. The reason for this behavior is that it avoids creating lots of churn in your Prometheus instance where series are deleted and re-created for each state change, and allows easier use of some operations. If you want to query for just the active state you can use
arlyn_scales_status == 1
.