Skip to main content

Prometheus integration for Starlette

Project description

Starlette Prometheus

Build Status Package Version PyPI Version

Introduction

Prometheus integration for Starlette.

Requirements

  • Python 3.8+
  • Starlette 0.12+

Installation

$ pip install starlette-prometheus

Usage

A complete example that exposes prometheus metrics endpoint under /metrics/ path.

from starlette.applications import Starlette
from starlette_prometheus import metrics, PrometheusMiddleware

app = Starlette()

app.add_middleware(PrometheusMiddleware)
app.add_route("/metrics/", metrics)

Metrics for paths that do not match any Starlette route can be filtered by passing filter_unhandled_paths=True argument to add_middleware method. Note that not turning on this filtering can lead to unbounded memory use when lots of different routes are called.

Contributing

This project is absolutely open to contributions so if you have a nice idea, create an issue to let the community discuss it.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

starlette_prometheus-0.10.0.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

starlette_prometheus-0.10.0-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file starlette_prometheus-0.10.0.tar.gz.

File metadata

  • Download URL: starlette_prometheus-0.10.0.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.4 Darwin/23.6.0

File hashes

Hashes for starlette_prometheus-0.10.0.tar.gz
Algorithm Hash digest
SHA256 77d1e9cfad572206e8de242975bd00a62e33685eb330389f2add04e4d719d47d
MD5 497a9a3fdc1f1abcc3065e98ad592d6a
BLAKE2b-256 89f203fc6b3c10fb436c81ee567ac46c49418819d6901101ece7bd45be465162

See more details on using hashes here.

File details

Details for the file starlette_prometheus-0.10.0-py3-none-any.whl.

File metadata

File hashes

Hashes for starlette_prometheus-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8b2f997495f809f01387378dad5476b2a1cf2fb2d9b96164394effdecb2d8380
MD5 fde9c2d9de4f169bb692befc450f38ad
BLAKE2b-256 1040244a5eba1a1d0393b9eea768afee74ab8e0d7d0e99299edbcafe22ef65f7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page