Is storing discrete values (e.g. enum) in Prometheus feasible?

Viewed 289

I want to store system state as a Prometheus metric, for visualisation in Grafana. In code, it is backed by a simple enum with integer values e.g.:

enum SystemState{NotRunning,Starting,Running,Stopping,Fault}

Reporting the value to a metric is easy, but Prometheus/Grafana uses extrapolation (which you cannot disable IIRC) and this is discrete data.

Would it be better to instead expose one meta/info label for each enum value e.g. system_state_info{state="Starting"} and so on, given I would like to display on a dashboard the named state, not the numeric value?

0 Answers
Related