Initializing a metric with a tuple for labels leads to incorrect label count
See original GitHub issueg = prometheus_client.Gauge(
"my_super_special_metric",
"This is ametric",
("label"))
g.labels({"label" : "somevalue"}).set(1)
Leads to “incorrect label names”. Changing it to:
g = prometheus_client.Gauge(
"my_super_special_metric",
"This is ametric",
["label"])
g.labels({"label" : "somevalue"}).set(1)
works normally.
Since both are iterable types, it would be idiomatic python to ensure that any non-string sequence type supplied for the labels be treated as a list of labels.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:2
- Comments:5 (1 by maintainers)
Top Results From Across the Web
In the context o f prometheus instrumentation, should I use all ...
No, you have to give a value for each of the labels. ... in labels raise ValueError('Incorrect label count') ValueError: Incorrect label ......
Read more >How to set multiple label values with using tuple or list to ...
File "/Library/Python/2.7/site-packages/prometheus_client/core.py", line 516, in labels raise ValueError('Incorrect label count')
Read more >Collection of alerting rules - Awesome Prometheus alerts
1. Windows Server collector Error. Collector {{ $labels. · 2. Windows Server service Status. Windows Service state is not OK [copy] · 3....
Read more >Usage examples - Python package - CatBoost
Get the identifier of the iteration with the best result. Return the iteration with the best value of the evaluation metric on the...
Read more >Trainer - Hugging Face
from torch import nn from transformers import Trainer class CustomTrainer(Trainer): def compute_loss(self, model, inputs, return_outputs=False): labels ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It’s ok, here is the way to go for thos who pass here
This isn’t a tuple, it’s a string in parens. (“label”, ) is what you want.