prometheus-flask-exporter
Prometheus metrics exporter for Flask
What it is and what it does
Prometheus Flask exporter integrates Prometheus metrics collection directly into Flask applications. It automatically tracks HTTP request duration, request count, and uncaught exceptions using a Prometheus registry, exposing them on a `/metrics` endpoint by default. The library provides decorators to define custom metrics (counters, gauges, histograms, summaries) on individual endpoints and supports filtering which endpoints are tracked.
The package depends on prometheus_client for metric primitives and flask for the web framework. It's designed for applications that need observability into request patterns and performance without manual instrumentation of every endpoint. Configuration options allow changing the metrics endpoint path, registry, grouping strategy, and default labels applied to all metrics.
Use it for:
- Monitor Flask application request latency and throughput in production environments with Prometheus scraping
- Track endpoint-specific metrics like request count by status code or custom business logic counters
- Exclude sensitive endpoints from metrics collection using decorators or regex path patterns
- Expose application version and metadata as static Prometheus gauge metrics
- Group request metrics by endpoint function name instead of URI path to reduce cardinality
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Exports HTTP request metrics from Flask applications to Prometheus, tracking request duration, count, exceptions, and custom metrics via decorators.
Yes, with conditions. Install if you run Flask applications with Prometheus monitoring infrastructure already in place and need straightforward request-level metrics. The low install friction and permissive license make adoption easy. However, the aging maintenance status (521 days since last release) means you should verify compatibility with your Flask and Python versions before committing to production use.
Install
prometheus-flask-exporter on PyPI
pip
pip install prometheus-flask-exporteruv
uv add prometheus-flask-exporterpoetry
poetry add prometheus-flask-exporterInstalling prometheus-flask-exporter
Before you install
Low friction install with only two runtime dependencies (prometheus_client and flask). Maintenance status is aging—last release was 521 days ago, though the repository remains active with recent commits and 685 stars.
License in practice
MIT license (permissive) places no restrictions on use, modification, or distribution in commercial or private projects.
Quickstart
from flask import Flask
from prometheus_flask_exporter import PrometheusMetrics
app = Flask(__name__)
metrics = PrometheusMetrics(app)
@app.route('/')
def main():
pass # requests tracked by default
Verify before relying
- Whether the package actively maintains compatibility with Flask versions beyond those listed in classifiers
- Performance overhead of metrics collection on high-throughput applications
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — prometheus_client, flask |
| Maintenance | aging — 521 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,229,514/month — #2,692 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: prometheus_flask_exporter-0.23.2-py3-none-any.whl
Keywords: prometheus, flask, monitoring, exporter
Tags
More Monitoring packages
Wraps any iterable to display a real-time…
copyleft · top 100 on PyPI
opentelemetry-semantic-conventionsProvides generated Python code for…
permissive · top 100 on PyPI
opentelemetry-sdkProvides the reference implementation of the…
permissive · top 100 on PyPI
opentelemetry-apiProvides the abstract API and interfaces for…
permissive · top 100 on PyPI
opentelemetry-exporter-otlp-proto-httpExports OpenTelemetry observability data to an…
permissive · top 1,000 on PyPI
opentelemetry-instrumentationProvides automatic instrumentation commands and…
permissive · top 1,000 on PyPI
airflow-exporterExposes Airflow DAG and task metrics to…
permissive · top 15,000 on PyPI
prometheus-api-clientConnects to Prometheus monitoring systems and…
permissive · top 5,000 on PyPI
starlette-exporterCollects and exports Prometheus metrics for…
permissive · top 5,000 on PyPI
opentelemetry-exporter-prometheusExports OpenTelemetry metrics to Prometheus for…
permissive · top 1,000 on PyPI
django-prometheusExports Django application metrics (requests,…
permissive · top 5,000 on PyPI
prometheus-fastapi-instrumentatorAdds Prometheus metrics collection and exposure…
permissive · top 5,000 on PyPI
opentelemetry-exporter-prometheus-remote-writeExports metrics from OpenTelemetry Python SDK…
permissive · top 5,000 on PyPI
prometheus-asyncAdds async/await support to Prometheus metrics…
permissive · top 15,000 on PyPI
prometheus-clientInstruments Python applications to expose…
permissive · top 1,000 on PyPI
Flask-RESTfulFlask-RESTful provides decorators and utilities…
permissive · top 5,000 on PyPI