Problem
Hub-side OTel recorders (dbmetrics, dispatchmetrics) are created with NewDisabled() at cmd/server_foreground.go:1174. The SetDBMetrics() and SetDispatchMetrics() methods on hub.Server exist but are never called from any entrypoint. All hub operational metrics — pg LISTEN/NOTIFY latency, notifications published/delivered/dropped, subscriber lag, dispatch lifecycle, pool stats — silently record to no-op sinks.
Solution
Create a GCP Cloud Monitoring MeterProvider during hub server startup and wire the existing recorders to it. This is Phase 1 of the metrics-delivery project.
Changes
- New:
pkg/observability/hubmetrics/hubmetrics.go — creates a MeterProvider with a GCP metric exporter and periodic reader (60s)
- Modified:
cmd/server_foreground.go — wire SetDBMetrics() and SetDispatchMetrics() after initHubServer(), pass real recorder to newEventPublisher()
- Metric groups (db-notify, db-pool, dispatch, hub-auth, hub-gcp) can be independently disabled via env vars
- Graceful degradation when
GCPProjectID is empty
Verification
- Unit tests pass for all observability packages
- Build succeeds
- Live infrastructure verification pending (metrics should appear in Cloud Monitoring when deployed with a valid GCP project ID)
Problem
Hub-side OTel recorders (dbmetrics, dispatchmetrics) are created with
NewDisabled()atcmd/server_foreground.go:1174. TheSetDBMetrics()andSetDispatchMetrics()methods onhub.Serverexist but are never called from any entrypoint. All hub operational metrics — pg LISTEN/NOTIFY latency, notifications published/delivered/dropped, subscriber lag, dispatch lifecycle, pool stats — silently record to no-op sinks.Solution
Create a GCP Cloud Monitoring MeterProvider during hub server startup and wire the existing recorders to it. This is Phase 1 of the metrics-delivery project.
Changes
pkg/observability/hubmetrics/hubmetrics.go— creates aMeterProviderwith a GCP metric exporter and periodic reader (60s)cmd/server_foreground.go— wireSetDBMetrics()andSetDispatchMetrics()afterinitHubServer(), pass real recorder tonewEventPublisher()GCPProjectIDis emptyVerification