Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

FastStream Prometheus Collector

FastStream Based Metrics Collection for Prometheus

PyPI PyPI - Python Version GitLab last commit Docs

Test coverage Downloads GitLab stars

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

Metadata

Release files for faststream-prometheus 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for faststream-prometheus 0.1.5
File Size Uploaded
faststream_prometheus-0.1.5.tar.gz 5.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for faststream-prometheus 0.1.5
File Interpreter ABI Platform
faststream_prometheus-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 10.7 kB

Release files / faststream_prometheus-0.1.5.tar.gz

Download URL faststream_prometheus-0.1.5.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
69e200e535577b239215057485ace97d56d853c174e2ff1257de08d528e1277e
BLAKE2b-256 checksum
How to use checksums
3bcecabbd854f6cedc55eb4866c3de2f5adf858c786cc7434cd6bb4927edc721
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.9.19 Linux/6.8.0-40-generic

Release files / faststream_prometheus-0.1.5-py3-none-any.whl

Download URL faststream_prometheus-0.1.5-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fc00b21c9da56e5bda96074769e812ee5b7f1e27c2511a265130237ba3138b9f
BLAKE2b-256 checksum
How to use checksums
b2f48b43941c00d593119c21673620015a523f85274fe0a01f2106d793fec430
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.9.19 Linux/6.8.0-40-generic
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page