Skip to content

P1: Add Prometheus metrics for observability #66

@BadgerOps

Description

@BadgerOps

No Metrics/Observability

Priority: P1 - High
Estimate: 3 hours
Review Reference: REVIEW.md (P1-5)

Issue

No visibility into:

  • Request rates and latency
  • Error rates
  • Resource utilization
  • Pool/account counts

Impact: High - Cannot monitor production health

Solution

Add Prometheus metrics with /metrics endpoint.

Key Metrics:

  • cloudpam_http_requests_total - Counter with method, path, status labels
  • cloudpam_http_duration_seconds - Histogram for latency
  • cloudpam_pools_total - Gauge for pool count
  • cloudpam_accounts_total - Gauge for account count

Implementation:

  1. Add github.com/prometheus/client_golang dependency
  2. Create internal/http/metrics.go
  3. Instrument key operations
  4. Add /metrics endpoint in RegisterRoutes()

See REVIEW.md (P1-5) for complete code.

Acceptance Criteria

  • Prometheus client_golang dependency added
  • metrics.go created with key metrics
  • HTTP requests instrumented with counters and histograms
  • Pool/account counts exposed as gauges
  • /metrics endpoint returns Prometheus format
  • Tests verify metric collection
  • CLAUDE.md updated with metrics documentation

Related

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions