Add Prometheus metrics for connections, firewall, L7, and bytes transferred
Instrument mc-proxy with prometheus/client_golang. New internal/metrics/ package defines counters, gauges, and histograms for connection totals, active connections, firewall blocks by reason, backend dial latency, bytes transferred, L7 HTTP status codes, and L7 policy blocks. Optional [metrics] config section starts a scrape endpoint. Firewall gains BlockedWithReason() to report block cause. L7 handler wraps ResponseWriter to record status codes per hostname. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
23
PROGRESS.md
23
PROGRESS.md
@@ -71,20 +71,21 @@ proceeds. Each item is marked:
|
||||
|
||||
## Phase 8: Prometheus Metrics
|
||||
|
||||
- [ ] 8.1 Dependency: add `prometheus/client_golang`
|
||||
- [ ] 8.2 Config: `Metrics` section (`addr`, `path`)
|
||||
- [ ] 8.3 Package: `internal/metrics/` definitions and HTTP server
|
||||
- [ ] 8.4 Instrumentation: connections, firewall, dial latency, bytes, HTTP status, policy blocks
|
||||
- [ ] 8.5 Firewall: `BlockedWithReason()` method
|
||||
- [ ] 8.6 L7: status recording on ResponseWriter
|
||||
- [ ] 8.7 Startup: conditionally start metrics server
|
||||
- [ ] 8.8 Tests: metric sanity, server endpoint, `BlockedWithReason`
|
||||
- [x] 8.1 Dependency: add `prometheus/client_golang`
|
||||
- [x] 8.2 Config: `Metrics` section (`addr`, `path`)
|
||||
- [x] 8.3 Package: `internal/metrics/` definitions and HTTP server
|
||||
- [x] 8.4 Instrumentation: connections, firewall, dial latency, bytes, HTTP status, policy blocks
|
||||
- [x] 8.5 Firewall: `BlockedWithReason()` method
|
||||
- [x] 8.6 L7: status recording on ResponseWriter
|
||||
- [x] 8.7 Startup: conditionally start metrics server
|
||||
- [x] 8.8 Tests: metric sanity, server endpoint, `BlockedWithReason`
|
||||
|
||||
---
|
||||
|
||||
## Current State
|
||||
|
||||
Phases 1-6 complete. Per-listener connection limits are implemented and
|
||||
tested. L7 policies and Prometheus metrics are next.
|
||||
Phases 1-8 complete. Prometheus metrics are instrumented across
|
||||
connections, firewall, dial latency, bytes transferred, L7 HTTP status
|
||||
codes, and L7 policy blocks.
|
||||
|
||||
`go vet` and `go test` pass across all 13 packages.
|
||||
`go vet` and `go test` pass across all 14 packages.
|
||||
|
||||
Reference in New Issue
Block a user