rycus86 / prometheus_flask_exporter

Prometheus exporter for Flask applications
https://pypi.python.org/pypi/prometheus-flask-exporter
MIT License
645 stars 161 forks source link

How to return flask_http_request_duration_milliseconds_bucket instead of flask_http_request_duration_seconds_bucket #172

Open zhangweijiqn opened 8 months ago

zhangweijiqn commented 8 months ago

for example: flask_http_request_duration_seconds_bucket{le="0.005",method="POST",path="/predict",status="200"} 2.0 flask_http_request_duration_seconds_bucket{le="0.01",method="POST",path="/predict",status="200"} 2.0

--->

flask_http_request_duration_milliseconds_bucket{le="5",method="POST",path="/predict",status="200"} 2.0 flask_http_request_duration_milliseconds_bucket{le="10",method="POST",path="/predict",status="200"} 2.0

rycus86 commented 8 months ago

The library only supports seconds at the moment for the default metric (as showed in https://prometheus.io/docs/practices/histograms/) but you can add your own histogram metric with measurements - though perhaps a bit fiddly. I'd be open to a change to allow asking for millisecond precision by default - is that something you could look into?