Skip to content

Add Prometheus metrics endpoint for HTTP observability#986

Open
kskarimi wants to merge 2 commits intothedevs-network:mainfrom
kskarimi:metrics
Open

Add Prometheus metrics endpoint for HTTP observability#986
kskarimi wants to merge 2 commits intothedevs-network:mainfrom
kskarimi:metrics

Conversation

@kskarimi
Copy link
Copy Markdown

This PR adds a Prometheus scrape endpoint to improve black-box monitoring visibility for Kutt HTTP traffic.

What changed

  • Added a new /metrics endpoint (configurable via METRICS_PATH) that returns Prometheus text format.
  • Added request metrics middleware to capture:
    • Request duration histogram (http_server_requests_seconds)
    • Request counters (total/success/error)
    • In-flight requests
    • Throughput gauges (RPS/RPM)
    • Per-status-code request counts and rate metrics
  • Added new env vars:
    • METRICS_ENABLED (default: true)
    • METRICS_PATH (default: /metrics)
  • Updated .example.env and README with metrics configuration and Kubernetes scrape annotation example.

Why

This provides operational visibility for:

  • Response time
  • Throughput
  • Error/success behavior by HTTP status code
  • Prometheus-based scraping in Kubernetes environments

Kubernetes scrape annotations example

prometheus.io/scrape: "true"
prometheus.io/path: "/metrics"
prometheus.io/port: "3000"

Notes

  • Metrics are in-memory per app instance and reset on process restart.
  • Suitable for per-pod scraping in Kubernetes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant