skillfed

prometheus-flask-exporter

Prometheus metrics exporter for Flask

prometheus-flask-exporter v0.23.2 3.2M downloads/30d#2,692 on PyPI685
Permissive license MIT AGING released

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-exporter

uv

uv add prometheus-flask-exporter

poetry

poetry add prometheus-flask-exporter

Installing 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

Development Status :: 4 - BetaIntended Audience :: DevelopersIntended Audience :: System AdministratorsLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: System :: Monitoring

Tags

flask prometheus metrics exporterprometheus http request monitoringflask request duration trackingprometheus flask integrationapplication metrics collection flaskprometheus exporter decoratorflask endpoint monitoring
observabilityprometheusmetrics

More Monitoring packages

tqdm

Wraps any iterable to display a real-time…

copyleft · top 100 on PyPI

opentelemetry-semantic-conventions

Provides generated Python code for…

permissive · top 100 on PyPI

opentelemetry-sdk

Provides the reference implementation of the…

permissive · top 100 on PyPI

opentelemetry-api

Provides the abstract API and interfaces for…

permissive · top 100 on PyPI

opentelemetry-exporter-otlp-proto-http

Exports OpenTelemetry observability data to an…

permissive · top 1,000 on PyPI

opentelemetry-instrumentation

Provides automatic instrumentation commands and…

permissive · top 1,000 on PyPI

airflow-exporter

Exposes Airflow DAG and task metrics to…

permissive · top 15,000 on PyPI

prometheus-api-client

Connects to Prometheus monitoring systems and…

permissive · top 5,000 on PyPI

starlette-exporter

Collects and exports Prometheus metrics for…

permissive · top 5,000 on PyPI

opentelemetry-exporter-prometheus

Exports OpenTelemetry metrics to Prometheus for…

permissive · top 1,000 on PyPI

django-prometheus

Exports Django application metrics (requests,…

permissive · top 5,000 on PyPI

prometheus-fastapi-instrumentator

Adds Prometheus metrics collection and exposure…

permissive · top 5,000 on PyPI

opentelemetry-exporter-prometheus-remote-write

Exports metrics from OpenTelemetry Python SDK…

permissive · top 5,000 on PyPI

prometheus-async

Adds async/await support to Prometheus metrics…

permissive · top 15,000 on PyPI

prometheus-client

Instruments Python applications to expose…

permissive · top 1,000 on PyPI

Flask-RESTful

Flask-RESTful provides decorators and utilities…

permissive · top 5,000 on PyPI