Skip to content

Add Prometheus Metrics #166

@JE4GLE

Description

@JE4GLE

Introduce Prometheus metrics support in pgbackweb to enable monitoring of key service performance and health metrics (backup counts, durations, errors, database connection stats, queue status, etc.).

Currently pgbackweb provides backup scheduling and monitoring via UI but no native Prometheus metrics endpoint exists. With this enhancement, the app should expose a /metrics HTTP endpoint that Prometheus can scrape. 

Goals

  • Expose a Prometheus-compatible /metrics endpoint.
  • Publish useful metrics such as:
    • total backups executed
    • backup success/failure counts
    • last backup duration
    • backup queue length
    • DB connection status
    • health check results
  • Use Prometheus client library in Go for instrumentation.
  • Provide example Prometheus scrape config and optional Grafana dashboards.

Acceptance Criteria

  • /metrics endpoint returns valid Prometheus format metrics.
  • Metrics cover at minimum backup operations and health.
  • Configurable listen address and path via env vars.
  • Updated README with instructions for enabling metrics and Prometheus scrape config.
  • Tests verifying metrics exposure.

Technical Notes

  • Use the official Prometheus Go client (github.com/prometheus/client_golang/prometheus).
  • Register custom counters/gauges for backup lifecycle events.
  • Ensure metrics don’t adversely impact performance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions