--- id: starlette-prometheus version: "0.10.0" license: GPL-3.0+ license_treatment: copyleft maintenance: dormant --- # starlette-prometheus — Prometheus integration for Starlette License: copyleft · Maintenance: dormant · Downloads: 432.5K/mo ## What it is and what it does Starlette Prometheus is a middleware package that integrates Prometheus metrics collection into Starlette web applications. It automatically instruments HTTP requests and responses, collecting metrics like request counts, latencies, and response codes, then exposes them via a `/metrics/` endpoint that Prometheus can scrape. The package wraps Starlette's middleware system to intercept requests transparently. The package depends on starlette and prometheus_client to function. It's straightforward to set up—add the middleware and route the metrics endpoint—but requires careful configuration when handling dynamic or unmatched routes, as unfiltered path tracking can consume unbounded memory. The package supports Python 3.8 through 3.12 and is marked Production/Stable, though development has been dormant since its last release. Use it for: - Expose HTTP request metrics to Prometheus for monitoring Starlette application performance and availability. - Track request latency, error rates, and throughput to feed into alerting and dashboarding systems. - Debug and profile application behavior by analyzing request patterns and response times over time. - Integrate observability into microservices built with Starlette without writing custom instrumentation code. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Adds Prometheus metrics collection and exposure to Starlette web applications, allowing you to instrument HTTP request/response behavior and expose metrics via a `/metrics/` endpoint. Yes, if you need Prometheus metrics for a Starlette application and accept the GPL-3.0+ copyleft license. Install friction is low and the package is stable. However, dormant maintenance means you should verify compatibility with your Starlette version and be prepared to fork or patch if issues arise. Not suitable if your project cannot comply with GPL-3.0+ licensing. ## Install pip install starlette-prometheus uv add starlette-prometheus poetry add starlette-prometheus ## Installing starlette-prometheus Before you install: Low install friction with only two runtime dependencies (starlette and prometheus_client). Maintenance is dormant—last release was over 710 days ago, though the repository remains active and the package is marked Production/Stable. License in practice: Licensed under GPL-3.0+, a copyleft license. Any application using this package must comply with GPLv3+ terms, including potential source code disclosure obligations if you distribute the application. Quickstart: pip install starlette-prometheus from starlette.applications import Starlette from starlette_prometheus import metrics, PrometheusMiddleware app = Starlette() app.add_middleware(PrometheusMiddleware) app.add_route("/metrics/", metrics) Requires Python 3.8+ and Starlette 0.12+. Unfiltered unhandled paths can lead to unbounded memory use; use filter_unhandled_paths=True if needed. Verify before relying: - Whether the package is actively maintained or seeking new maintainers despite dormant status. - Performance impact of metrics collection on high-throughput applications. - Compatibility with recent Starlette versions beyond what the classifiers declare. ## Package facts - License: GPL-3.0+ (copyleft) - Python support: supports_current - Install friction: low - Maintenance: dormant - Downloads: 432.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags prometheus metrics starlette, starlette monitoring instrumentation, http metrics collection, prometheus middleware, starlette observability, request metrics exposure, prometheus http integration, observability, prometheus, middleware [View on SkillFed](https://skillfed.io/packages/starlette-prometheus) · [View on PyPI](https://pypi.org/project/starlette-prometheus/)