FastAPI Prometheus Exporter
Project description
fastapi-prometheus-exporter
FastAPI Prometheus Exporter is a simple Prometheus exporter for FastAPI applications. It provides a set of metrics by default and allows you to add your own metrics as well.
Installation
pip install fastapi-prometheus-exporter
or
poetry add fastapi-prometheus-exporter
Usage
from fastapi import FastAPI
from fastapi_prometheus_exporter import PrometheusExporterMiddleware
app = FastAPI()
PrometheusExporterMiddleware.setup(
app=app,
metrics_path="/metrics",
# ignore_paths=["/healthz", "/metrics"],
)
Parameters
app: FastAPI application instanceignore_paths: List of paths to ignore. Default:[]metrics_path: Path to expose metrics. Default:/metricsmetrics_registry: Prometheus registry to use. Default:prometheus_client.CollectorRegistryrequest_latency_name: Name of the request latency metric. Default:http_request_duration_secondsrequest_latency_doc: Description of the request latency metric. Default:HTTP Request Latencyrequest_latency_buckets: Buckets for the request latency metric. Default:prometheus_client.Histogram.DEFAULT_BUCKETSrequest_latency_labels: Labels for the request latency metric. Default:["method", "endpoint", "http_status"]request_count_name: Name of the request count metric. Default:http_requests_totalrequest_count_doc: Description of the request count metric. Default:Total HTTP Requestsrequest_count_labels: Labels for the request count metric. Default:["method", "endpoint", "http_status"]
Metrics
Default Metrics
http_request_duration_seconds: HTTP request latency in secondshttp_requests_total: Total HTTP requests
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for fastapi_prometheus_exporter-0.2.2.tar.gz
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | 1eb6d88b638e1e234e071879d413b64f466a31fd6f0afc5dfdc869956c1d2b1e |
|
| MD5 | 4b4abd6d92142d1f6e57730004558e48 |
|
| BLAKE2b-256 | 734f3e08d09b8ba29daa10e750022f7038b2d11770ff4d7b9be02615ed4de17e |
Close
Hashes for fastapi_prometheus_exporter-0.2.2-py3-none-any.whl
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | e14ee4350131768d3ec0588d62b12b8b6d2cf870467b4d0761d5925cf2a65960 |
|
| MD5 | 31f3a33bf5869ec1078907897295082c |
|
| BLAKE2b-256 | 7943b3a6b35b3d832280119b96b7c2775ca4cf776a09cb96c32a2f6aeeb46336 |