Really basic implementation of a metrics target for use by prometheus#275
Really basic implementation of a metrics target for use by prometheus#275jelmer wants to merge 1 commit into
Conversation
|
I wonder if this could be implemented as a WSGI middleware? (Maybe there already exists some pluggable WSGI middleware that we can just use?) |
|
Maybe one of those, didn't look into any closely though https://github.com/benley/python-wsgi-prometheus |
|
It can't be just middleware if you want to add klaus-specific metrics, and those are the most useful. client_python (the second in your list) is what I'm using in this PR |
|
Sure, at least we will have to provide some hooks in the Klaus codebase or we can push metrics from Klaus (eg. increase some counters from Klaus views). I was wondering more about the metrics endpoint. I wonder if it makes sense to use Prometheus-Flask-Exporter or something like this: https://github.com/prometheus/client_python#flask But I am fine with a stand-alone implementation if you think that’s easier. I wonder if we should make the feature optional even if prometheus_client is installed. |
|
Maybe the best approach here is to have a separate port for the metrics. That's consistent with what other web apps do - so you don't have your metrics exposed to the internet. The other benefit is that we can then only import the metrics library when --metrics-port is specified. |
Really basic implementation of a metrics target for use by prometheus.
Some caveats:
one might not want to expose internal metrics there
(number of requests, failures, exceptions, etc). At the moment
it just exports a bunch of python statstics.