Skip to content

feat: Add Prometheus metrics export endpoint #57

@Patrick-Ehimen

Description

@Patrick-Ehimen

Summary

Expose metrics in Prometheus format to enable integration with standard monitoring stacks (Prometheus, Grafana, Datadog).

Background

The MetricsCollector already tracks useful metrics internally. Exposing these in Prometheus format enables production observability without custom tooling.

Acceptance Criteria

  • Add /metrics endpoint with Prometheus text format
  • Export existing metrics from MetricsCollector:
    • lighthouse_auth_total{status="success|failure"}
    • lighthouse_cache_hits_total
    • lighthouse_cache_misses_total
    • lighthouse_cache_size
    • lighthouse_request_duration_seconds{operation="upload|download|..."}
    • lighthouse_security_events_total{type="..."}
  • Add histogram for request latencies
  • Include process metrics (memory, uptime)
  • Document metrics in README

Example Output

# HELP lighthouse_auth_total Total authentication attempts
# TYPE lighthouse_auth_total counter
lighthouse_auth_total{status="success"} 1542
lighthouse_auth_total{status="failure"} 23

# HELP lighthouse_cache_hit_rate Cache hit rate
# TYPE lighthouse_cache_hit_rate gauge
lighthouse_cache_hit_rate 0.87

Related Files

  • apps/mcp-server/src/auth/MetricsCollector.ts
  • apps/mcp-server/src/server.ts

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions