Skip to content

Prometheus (metrics)

Prometheus collects time-series metrics by scraping /metrics endpoints from services.

Services added

  • Prometheus
  • Service name: prometheus
  • Default port: 9090
  • Grafana
  • Configure Prometheus as a datasource to build dashboards/alerts

Multi-Repricer metrics endpoint

The service-multi-repricer backend exposes:

  • GET http://service-multi-repricer:8001/metrics

It contains lightweight counters/gauges for the health audit and alerting.

Other backend services (service-invoice, service-jtl, service-plenty, service-tickets, service-omni) now also expose GET /metrics via prometheus-fastapi-instrumentator.

Debug / test page

In the dashboard: Debug → Observability (Sentry / Prometheus)

  • Backend crash (1 / 0), custom logger.error with exc_info, capture_message
  • Prometheus test counter repricer_debug_test_total
  • Frontend client error / captureMessage (needs VITE_SENTRY_DSN)

API (JWT required, prefix /api/v1/multi):

  • GET /health/debug/status
  • POST /health/debug/sentry/crash
  • POST /health/debug/sentry/log-error
  • POST /health/debug/sentry/capture-message
  • POST /health/debug/prometheus/test

Prometheus scrape config (compose)

In this repo the Prometheus config lives in docker/prometheus/config.yml.

In both compose files (including the Portainer stack), Prometheus is started with an entrypoint that writes /etc/prometheus/config.yml inside the container at startup. This avoids Portainer host-path issues where /etc/prometheus/config.yml ends up missing inside the container.

scraped jobs (from docker/prometheus/config.yml) include:

  • metrics_path: /metrics
  • targets:
  • service-multi-repricer:8001
  • service-invoice:8002
  • service-jtl:8003
  • service-plenty:8005
  • service-tickets:8006
  • service-omni:8007

Grafana usage (how to visualize)

  1. Add datasource in Grafana: type Prometheus
  2. URL: http://prometheus:9090 (inside docker network)
  3. Create dashboards using the repricer_health_audit_* metrics

Portainer / server troubleshooting

If Prometheus fails to start, it should no longer be caused by missing bind-mount files.

Instead, check Prometheus container logs for the entrypoint write step (it writes /etc/prometheus/config.yml before starting Prometheus).