-
Notifications
You must be signed in to change notification settings - Fork 802
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enum: custom label for state #416
Comments
The OpenMetrics draft standard does not permit this. Can you explain more about your use case? |
Of course! We have different scheduled processes that usually start on time and depending on the data to process take more or less time. Those processes emit different events like ( Then on Prometheus and Grafana, we want to define several alerts and graphs based on those metrics where most of them are based on a couple of different state metrics. And here is where we have the problem because the metrics have different labels and is quite complex to define them. Right now we're using a Gauge that we set with the different states but we would like to use an Enum as it's easier and better for our use case. deadline_start = Gauge(
'deadline_start', 'Start of a time-critical process',
labelnames=['customer', 'state'],
registry=registry
)
for state in ['waiting', 'late', 'started']:
metric_value = 1 if current_state == state else 0
deadline_start.labels(customer=customer, state=state).set(metric_value) |
Hmm, personally I'd expose timestamps of the starts/deadlines and work from there rather than putting that logic into an enum. |
This is defined by OpenMetrics, so won't be changing on our own. |
Hi, I use Enum to describe a task's state, when I use the label of taskId, the result is not what I excepted.
the result is follow
what I excepted is
|
Please don't ask questions on closed issues. It makes more sense to ask questions like this on the prometheus-users mailing list rather than in a GitHub issue. On the mailing list, more people are available to potentially respond to your question, and the whole community can benefit from the answers provided. |
We're using the
Enum
metric to represent the state of different critical processes in the following way:and the result we obtain is:
but we would like to have a custom_label for the state instead of the metric name as we need to have the same label for all the metrics.
the same happens with
StateSetMetricFamily
.Would be possible to allow to pass a custom label? I can make a PR with the improvement
The text was updated successfully, but these errors were encountered: