Closed nicolasroy11 closed 1 year ago
If a metric has labels then the labels need to be set before the metrics can be incremented or changed. So in your case the following will likely work better:
request_exceptions_total.labels(
endpoint=request.path,
user=company_name,
status_code=status_code,
message=message
).inc(amount=1)
Yep. That did it! Thanks!
This may be a prometheus-client issue, but no one seems to be around there much, so I'll try my chance here. I tried this a million different ways, and no cigar. Even the Python Intellisense on VSCode sees that an inc() method is available, but it throws this error everytime I try to increase counter value:
Error: Exception has occurred: AttributeError 'Counter' object has no attribute '_value'
I have tried leaving out the label values when a label is created, but no success there either. I went to the Google answers page, but no one had an answer for this.