Closed ColdFire87 closed 1 year ago
Hello,
First off, consider if this is really what you want, depending on the number of different values you can return there, it might blow out metric cardinality, see some guidelines here: https://prometheus.io/docs/practices/naming/#labels
If you do have some well behaved values, then you can attach them to Flask requests (or responses, or session, or some global Flask objects) and get them at the end of the request from a lambda label handler, like lambda response: response.someattribute
or lambda: flask.someobject.someattribute
.
Does this help?
yes, that's perfect... I didn't know I can use a lambda
to compute a label
(the docs do have a few examples, but I must've missed them :)
I have the following code:
How can I make it such that the value generated inside the handler is added as a label?
From what I can see in the docs, I can only add labels based on information from the HTTP request.
Thanks!