Kiran
08/25/2025, 12:10 PMMarvin
08/25/2025, 12:10 PMMarvin
08/25/2025, 12:12 PMdocker run -d --name postgres-exporter \
-p 9187:9187 \
-e DATA_SOURCE_NAME="<postgresql://prefect_user:prefect_pass@<db-host>:5432/prefect?sslmode=disable>" \
<http://quay.io/prometheuscommunity/postgres-exporter|quay.io/prometheuscommunity/postgres-exporter>
- Prometheus scrape config:
scrape_configs:
- job_name: 'prefect-postgres'
static_configs:
- targets: ['<exporter-host>:9187']
- Helm (Kubernetes): prometheus-postgres-exporter
- Exporter docs (roles/permissions): postgres_exporter
- Monitor Prefect app/runtime metrics
- Prefect 3 does not expose a built-in Prometheus /metrics endpoint.
- You can:
- Instrument your own flows/infra with the Prometheus client to emit custom metrics.
- Use OpenTelemetry tracing/telemetry from Prefect for observability (spans/logs), and forward via an OTLP collector to your backend. See:
- prefect.telemetry.services
- RunTelemetry
- Telemetry bootstrap
Useful Prefect docs for self-hosting and DB care:
- Self-hosted Prefect (v3)
- Database maintenance
Questions to tailor guidance:
- Are you self-hosting Prefect, or using Prefect Cloud?
- If self-hosted, how is Postgres deployed (Docker, Kubernetes, managed service)?
- Do you want only DB health metrics, or also app/flow-level metrics?Brendan Dalpe
08/25/2025, 1:00 PMKiran
08/25/2025, 1:01 PMKiran
08/25/2025, 1:03 PMBrendan Dalpe
08/25/2025, 1:03 PMKiran
08/25/2025, 1:04 PMBrendan Dalpe
08/25/2025, 1:04 PMKiran
08/25/2025, 1:04 PMBrendan Dalpe
08/25/2025, 1:08 PMprefecthq/prometheus-prefect-exporter:2.0.1
image and set the environment variable:
PREFECT_API_URL="http://<service-discovery-service-name>.<service-discovery-namespace>:4200/api"
Note: if you have basic auth enabled on your Prefect Server, set PREFECT_API_AUTH_STRING="user:pass"
See more about AWS ECS service discovery here: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-discovery.htmlKiran
08/25/2025, 1:17 PM