FastStream Based Metrics Collection for Prometheus
Project description
FastStream Prometheus Collector
FastStream Based Metrics Collection for Prometheus
Functionality
- Collection metrics via
middleware
- Collecting general metrics
- Collecting
details kafka
metrics
Installation
pip install faststream-prometheus
Quick start
See example for details
import uvicorn
from fastapi import FastAPI
from faststream.kafka.fastapi import KafkaRouter
from prometheus_fastapi_instrumentator import Instrumentator
# Import Faststream Middleware for collect metrics
from faststream_prometheus import FaststreamPrometheusMiddleware
# Adding middleware
faststream_router = KafkaRouter(
'localhost:9092',
middlewares=[FaststreamPrometheusMiddleware(prefix='test_faststream')],
)
# Setup export metrics via FastAPI -> HTTP GET /metrics
app = FastAPI(lifespan=faststream_router.lifespan_context)
app.include_router(faststream_router)
instrumentator = Instrumentator().instrument(app, metric_namespace='fastapi').expose(app)
# see default metrics
curl localhost:8000/metrics
Contribute
Issue Tracker: https://gitlab.com/rocshers/python/faststream-prometheus/-/issues
Source Code: https://gitlab.com/rocshers/python/faststream-prometheus
Before adding changes:
make install-dev
After changes:
make format test
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
Built Distribution
Close
Hashes for faststream_prometheus-0.1.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69e200e535577b239215057485ace97d56d853c174e2ff1257de08d528e1277e |
|
MD5 | ed42e02d9caa53ee24ac4aea7f79e587 |
|
BLAKE2b-256 | 3bcecabbd854f6cedc55eb4866c3de2f5adf858c786cc7434cd6bb4927edc721 |
Close
Hashes for faststream_prometheus-0.1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc00b21c9da56e5bda96074769e812ee5b7f1e27c2511a265130237ba3138b9f |
|
MD5 | 4b7e3e21411bb969b1e9ccd32fbc9b28 |
|
BLAKE2b-256 | b2f48b43941c00d593119c21673620015a523f85274fe0a01f2106d793fec430 |