trallnag / prometheus-fastapi-instrumentator

Instrument your FastAPI with Prometheus metrics.
ISC License
982 stars 84 forks source link

Persistent Metric Data #85

Open wymangr opened 3 years ago

wymangr commented 3 years ago

Is there a way to store the counters on disk so the values persist after restarted the application? I think I've seen this done in other Prometheus client libraries where it saves the metrics to sqlite files? If this isn't possible, maybe this is a good candidate for a feature request?

siin-lab commented 8 months ago

Setting the PROMETHEUS_MULTIPROC_DIR environment variable helps in that respect. You should set it to an existing directory where metrics will be accumulated in a DB across multiple runs.