Open hAh0L13 opened 2 years ago
Hello, it looks like you are trying to remove a child that does not exist, thus KeyError is an appropriate response.
In the second example are you only passing one argument? The error could be improved some for that case.
Hello @csmarchbanks ,
I also have this KeyError issue while trying to remove a child metric that is still there, as prometheus can see it. Can you provide a short example on how to call the remove method?
Thanks!
Hello @cmarasescu
In my case, I rewrite it with clear()
-
service_login_status_prom.clear()
Hello @hAh0L13 ,
I've finally fixed my issue, it seems that I've just put the labels in a wrong order. Most likely your initial call was failing simply because there was no child metric matching your labels.
Hello. Tried to remove some childs, but got KeyError.
My custom metric (gauge) have some lables and worked fine. But when i needed to delete some childs, i'm stuck:
https://github.com/prometheus/client_python/blob/09fb45953bac018a90e89f0b1e7bcd1d5d81c01b/prometheus_client/metrics.py#L187
Error is -
When label is only one, error quite different -
Comma at the end of labelvalues confused me