Observability

Include custom Prometheus metrics and logging configuration.

The following section covers adding monitoring and logging to the project, with a small observability stack:

  • Prometheus collects metrics: numbers that change over time, such as how many requests the application has handled, and how long they took. It “scrapes” them, by regularly fetching a page of metrics from each application it monitors, and stores them in its time series database. It also evaluates alerting rules.
  • Alertmanager sends notifications, such as emails, when alerts fire.
  • Loki stores logs, and Grafana Alloy collects them and sends them to Loki.
  • Grafana brings it all together in dashboards.

Each one runs in a container with Podman, using the official images from the projects themselves. They talk to each other over a Podman network, so they can find each other by container name.

note

Earlier versions of this guide used Bitnami’s container images. Bitnami stopped publishing its free images on Docker Hub in 2025, so this guide now uses the official prom/* and grafana/* images. It also replaces Promtail, which reached end of life in March 2026, with Grafana Alloy.

Image versions are pinned in the commands (for example prom/prometheus:v3.16.0), so a new release can’t change things unexpectedly. Check each project’s releases for the latest.

Podman Desktop#

You can do everything here from the command line, but there is also a desktop app for Podman, Podman Desktop, which is handy for seeing what’s running, viewing logs and opening a shell in a container. On Fedora, install it from Flathub:

flatpak install flathub io.podman_desktop.PodmanDesktop

A network for the containers#

Create a Podman network for the monitoring containers:

podman network create monitoring-network

Containers on the same network can reach each other by name: Prometheus will reach Alertmanager at alertmanager:9093, for example. To reach services running on your own machine, such as the FastAPI application, containers use the special name host.containers.internal.