🌐
GitHub
github.com › trallnag › prometheus-fastapi-instrumentator
GitHub - trallnag/prometheus-fastapi-instrumentator: Instrument your FastAPI with Prometheus metrics. · GitHub
It also features a modular approach to metrics that should instrument all FastAPI endpoints. You can either choose from a set of already existing metrics or create your own. And every metric function by itself can be configured as well. This chapter contains an example on the advanced usage of the Prometheus FastAPI Instrumentator to showcase most of it's features.
Author: trallnag
🌐
Medium
medium.com › @hitorunajp › prometheus-on-a-fastapi-application-aa25e5223a9e
Prometheus on a FastAPI application | by Hitoruna | Medium
September 1, 2025 - Finally we can go to http://localhost:9090 where we will find the Prometheus UI in which we can query by typing http_requests_total into the query bar and running Execute. ... Notice that even though we did not add them manually our label ...
Discussions

FastAPI and Prometheus endpoint
You won't be able to start 2 servers/processes listening on the same port. First one to start, wins. The other will fail to bind as the port is already in use. What you could do though is start both on different ports, say 8080 and 8081 or something, then put nginx in front of it all and proxy through to which ever backend based on the requested path. As a bonus you can terminate TLS at the nginx level using a single cert etc etc too. More on reddit.com
🌐 r/FastAPI
5
1
December 16, 2022
Traefik 2.2.X + Authelia + Consul Catalog + Prometheus

This is great! Thank you! Awesome work. I hate many lines in compose as well. I'm going to follow your setup on my test server.

More on reddit.com
🌐 r/Traefik
8
14
July 6, 2020
How do you monitor your FastAPI apps?
I usually use Sentry for error tracking More on reddit.com
🌐 r/FastAPI
18
27
February 20, 2024
Prometheus Middleware is out!
This is great work! Thanks for sharing Will try it out soon More on reddit.com
🌐 r/FastAPI
10
14
October 12, 2020
🌐
PyPI
pypi.org › project › prometheus-fastapi-instrumentator
prometheus-fastapi-instrumentator · PyPI
It also features a modular approach to metrics that should instrument all FastAPI endpoints. You can either choose from a set of already existing metrics or create your own. And every metric function by itself can be configured as well. This chapter contains an example on the advanced usage of the Prometheus FastAPI Instrumentator to showcase most of it's features.
🌐
Readthedocs
aioprometheus.readthedocs.io › en › latest › user › index.html
User Guide — aioprometheus Documentation
The metrics route renders Prometheus metrics from the default collector registry into the appropriate format. Run: (venv) $ pip install fastapi uvicorn (venv) $ python fastapi-example.py """ from typing import List from fastapi import FastAPI, Header, Request, Response from aioprometheus import REGISTRY, Counter, render app = FastAPI() app.state.events_counter = Counter("events", "Number of events.") @app.get("/") async def hello(request: Request): request.app.state.events_counter.inc({"path": "/"}) return "FastAPI Hello" @app.get("/metrics") async def handle_metrics( request: Request, # pylint: disable=unused-argument accept: List[str] = Header(None), ) -> Response: content, http_headers = render(REGISTRY, accept) return Response(content=content, media_type=http_headers["Content-Type"]) if __name__ == "__main__": import uvicorn uvicorn.run(app)
🌐
Hashnode
carlosmv.hashnode.dev › adding-prometheus-to-a-fastapi-app-python
Adding Prometheus to a FastAPI app | Python
April 15, 2025 - In this file, we import make_asgi_app from prometheus_client to create a Prometheus metrics app. We pass that registry to make_asgi_app() to create the metrics app. We mount that metrics app at the /metrics route using app.mount("/metrics", ...
🌐
GitHub
github.com › naufalafif › fastapi-prometheus-example
GitHub - naufalafif/fastapi-prometheus-example: Fastapi Prometheus Example · GitHub
Example Implementation of Prometheus Client on Fastapi Framework · Counter Example · Gauge Example · Summmary Example · Histogram Example · using makefile · Counter : make counter · Gauge : make gauge · Summary : make summary · Histogram : make histogram · or simply execute the python file.
Author: naufalafif
🌐
DEV Community
dev.to › ken_mwaura1 › getting-started-monitoring-a-fastapi-app-with-grafana-and-prometheus-a-step-by-step-guide-3fbn
Getting Started: Monitoring a FastAPI App with Grafana and Prometheus - A Step-by-Step Guide - DEV Community
January 30, 2025 - Prometheus is a tool for collecting metrics from your application. It can be used to collect metrics such as CPU usage, memory usage, and network traffic. ... Inorder to keep we'll use an existing FastAPI app for this guide.
🌐
client_python
prometheus.github.io › client_python › exporting › http › fastapi-gunicorn
FastAPI + Gunicorn | client_python
April 15, 2024 - from fastapi import FastAPI from prometheus_client import make_asgi_app app = FastAPI(debug=False) # Using multiprocess collector for registry def make_metrics_app(): registry = CollectorRegistry() multiprocess.MultiProcessCollector(registry) return make_asgi_app(registry=registry) metrics_app = make_metrics_app() app.mount("/metrics", metrics_app)
Find elsewhere
🌐
Medium
dimasyotama.medium.com › building-a-powerful-observability-stack-for-fastapi-with-prometheus-grafana-loki-426822422fd6
Building a Powerful Observability Stack for FastAPI with Prometheus, Grafana & Loki | by Dimas Yoga Pratama | Medium
August 21, 2025 - FastAPI Application (the-app): The Python application we want to monitor. We'll use the prometheus-fastapi-instrumentator library to automatically expose Prometheus-compatible metrics.
🌐
YouTube
youtube.com › watch
PROMETHEUS Metrics for your Python FastAPI App - YouTube
In this video I will show you how to instrument a Python FastAPI to emit or send Prometheus Metrics. I also show those same metrics being captured in Prometh...
Published: January 19, 2025
🌐
Sandeep Pandey
ikespand.github.io › posts › PrometheusBeginnerGuide
Getting started with Prometheus: Setting up and monitoring a FastAPI based python application - Sandeep Pandey
March 29, 2022 - This is usually done via the client libraries which are available in commonaly used languages like Python, Java, Scala etc. These libraries are responsible for properly tracking and formatting the metrics as per the desired format by Prometheus. As a first step, install the prometheus_client via pip : pip install prometheus_client · I have a sample demo app in fast-api, for which script is as follow. You can simply save it as fastapi-demo.py and run uvicorn fastapi-demo:app --host=0.0.0.0 --port=8000 --log-level=debug --reload.
🌐
Reddit
reddit.com › r/fastapi › fastapi and prometheus endpoint
r/FastAPI on Reddit: FastAPI and Prometheus endpoint
December 16, 2022 -

Hi all,

I have a fastapi app which generates some custom prometheus metrics with the prometheus client library.

I can start a separate server with start_http_server method from the prometheus client, but i would like to have the /metrics endpoint be served on the same port as my fastapi app.

I cant seem to find an easy way to do this, i see a prometheus offers integration with ASGI but i cant figure out how to piece everything together. AAnyone here done this before?

🌐
Towards AI
pub.towardsai.net › fastapi-observability-lab-with-prometheus-and-grafana-complete-guide-f12da15a15fd
FastAPI Observability Lab with Prometheus and Grafana: Complete Guide | by Faizulkhan | Towards AI
July 2, 2026 - version: "3.8" services: app: build: . container_name: fastapi-observability-app ports: - "8000:8000" networks: - monitoring environment: - PYTHONUNBUFFERED=1 prometheus: image: prom/prometheus:latest container_name: fastapi-observability-prometheus volumes: - ./prometheus.yml:/etc/prometheus/prometheus.yml ports: - "9090:9090" networks: - monitoring grafana: image: grafana/grafana:latest container_name: fastapi-observability-grafana ports: - "3030:3000" environment: - GF_SECURITY_ADMIN_USER=admin - GF_SECURITY_ADMIN_PASSWORD=admin volumes: - grafana-storage:/var/lib/grafana depends_on: - prometheus networks: - monitoring networks: monitoring: driver: bridge volumes: grafana-storage:
🌐
DEV Community
dev.to › carlosm27 › adding-prometheus-to-a-fastapi-app-python-c62
Adding Prometheus to a FastAPI app | Python - DEV Community
August 25, 2023 - In this file, we import make_asgi_app from prometheus_client to create a Prometheus metrics app. We pass that registry to make_asgi_app() to create the metrics app. We mount that metrics app at the /metrics route using app.mount("/metrics", ...
🌐
DEV Community
dev.to › agardnerit › hands-on-instrument-python-fastapi-with-prometheus-metrics-3m1f
[HANDS ON] Instrument Python FastAPI with Prometheus Metrics - DEV Community
January 19, 2025 - In this 5min hands-on video I explain how to take a Python FastAPI application and instrument it to make it “Prometheus enabled”.
Author: Kludex
🌐
Medium
medium.com › @gribenyukdenis › fastapi-prometheus-graphana-graylog-in-docker-compose-example-c4be14e3057f
FastAPI, Prometheus, Grafana, Graylog in docker-compose example | by Denis Gr | Medium
December 18, 2023 - This exposes a new /metrics endpoint where FastAPI metrics are available. ... In this format, Prometheus expects metrics from our application. Naturally, basic metrics have been added here.
🌐
GitHub
github.com › blueswen › fastapi-observability
GitHub - blueswen/fastapi-observability: Observe FastAPI app with three pillars of observability: Traces (Tempo), Metrics (Prometheus), Logs (Loki) on Grafana through OpenTelemetry. · GitHub
Use Prometheus Python Client to generate OpenTelemetry format metric with exemplars and expose on /metrics for Prometheus. In order to add an exemplar to metrics, we retrieve the trace id from the current span for the exemplar and add the trace ...
Author: blueswen
🌐
DEV Community
dev.to › kaushikcoderpy › fastapi-observability-with-prometheus-loki-grafana-complete-2026-guide-jkj
FastAPI Observability with Prometheus, Loki & Grafana (Complete 2026 Guide) - DEV Community
May 14, 2026 - version: '3.8' volumes: prometheus-data: grafana-data: loki-data: services: api: build: . restart: unless-stopped ports: - "8000:8000" labels: logging_job: fastapi prometheus: image: prom/prometheus:v2.45.0 restart: unless-stopped volumes: - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro - prometheus-data:/prometheus ports: - "9090:9090" loki: image: grafana/loki:2.9.0 restart: unless-stopped volumes: - ./loki-config.yml:/etc/loki/local-config.yaml:ro - loki-data:/loki ports: - "3100:3100" command: -config.file=/etc/loki/local-config.yaml promtail: image: grafana/promtail:2.9.0 restart: unless-stopped volumes: - /var/lib/docker/containers:/var/lib/docker/containers:ro - /var/run/docker.sock:/var/run/docker.sock:ro
🌐
GitHub
github.com › carlosm27 › fastapi-prometheus
GitHub - carlosm27/fastapi-prometheus: A FastAPI demo using Prometheus · GitHub
A FastAPI demo using Prometheus. Contribute to carlosm27/fastapi-prometheus development by creating an account on GitHub.
Author: carlosm27