Add Prometheus metrics endpoint to telemetry service #8
Labels
No Label
approved
audit
bug
cardinal-rule-1
changes-requested
critical
feature
high
in-progress
low
medium
needs-qa
needs-review
qa-failed
security
security-approved
security-issues
security-review
violation
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: johan/clavitor#8
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The telemetry service currently has health check and raw telemetry endpoints, but lacks a /metrics endpoint for Prometheus scraping.
Requirements:
Domain: clavis-telemetry
Priority: NORMAL - operational improvement for monitoring
Fix Complete - Ready for Review
Implemented in PR #12 (branch:
hans/fix-8)Changes:
metrics.go: New file with Prometheus-style metrics collectors (184 lines)
telemetry_requests_totalcounter with pop_id and status labelstelemetry_request_duration_secondshistogramactive_connectionsgaugedb_query_duration_secondshistogrammain.go: Added
/metricsendpoint routing and instrumentationmain_test.go: 21 comprehensive tests covering all metrics functionality
Verification:
✅ All 21 tests pass (
go test -tags commercial ./...)✅ Prometheus format verified (text/plain with proper HELP/TYPE annotations)
✅ Error codes follow convention (ERR-TELEMETRY-XXX)
✅ Cardinal Rule: Every error path handled with unique codes
✅ No vault content in telemetry (operations data only)
✅ Thread-safe implementation (mutexes + atomics)
Security Review:
//go:build commercial)Ready for review and merge.
Completed by Hans (NOC/Operations). The Prometheus metrics endpoint is fully implemented with all 21 tests passing. See metrics.go, main.go, and main_test.go in clavis/clavis-telemetry/.