Skip to content

feat(sentry): wire the diagnostic metric emitters for shutdown, IPC errors, and telemetry failures#195

Merged
gmaclennan merged 3 commits into
mainfrom
claude/sentry-wire-diagnostic-metrics
Jul 8, 2026
Merged

feat(sentry): wire the diagnostic metric emitters for shutdown, IPC errors, and telemetry failures#195
gmaclennan merged 3 commits into
mainfrom
claude/sentry-wire-diagnostic-metrics

Conversation

@gmaclennan

Copy link
Copy Markdown
Member

Closes #190.

backend/lib/metrics.js shipped three emitters with no production call sites, so their metrics never reached Sentry. This wires them.

shutdownPhase now records via sentry.withSpan, which routes the always-on phase metric by op prefix (shutdown.*comapeo.shutdown.phase_duration_ms, everything else → the boot metric as before). The backend's control-socket shutdown handler wraps its close steps in three spans — shutdown.close-servers (control + fastify + RPC in parallel), shutdown.close-manager, and shutdown.close-map-server — mirroring how the boot phases record and matching the three-phase cardinality budget in the plan doc.

ipcError records comapeo.ipc.errors where socket errors surface: the messageerror listeners on the control socket (SimpleRpcServer) and the comapeo socket (ComapeoRpc), plus the broadcast catch when a client postMessage throws.

telemetryForwardingFailure records comapeo.telemetry.forwarding_failures at the envelope sink's three failure points in backend/lib/sentry.js: the forwarding transport when the sink throws, the pre-listen queue when it overflows and drops a frame, and the setSink drain when the sink throws.

Each emitter gets a test through its real call path: withSpan("shutdown.*") and a throwing sink in sentry.test.mjs (against the real SDK), and a malformed frame on each socket in simple-rpc.test.mjs / comapeo-rpc.test.mjs. The two #190 "not yet wired" markers are removed from the §9.2 tier table; the sync rows' markers stay — #80 owns those.

Verified with npm run lint, npm run build, npm run test (69 passed), and npm run backend:test (77 passed).

@github-actions github-actions Bot added the feature New feature (changelog) label Jul 7, 2026
Comment thread backend/index.js Outdated
Comment thread backend/index.js Outdated
@gmaclennan
gmaclennan enabled auto-merge July 8, 2026 10:46
@gmaclennan
gmaclennan added this pull request to the merge queue Jul 8, 2026
Merged via the queue into main with commit f8f0174 Jul 8, 2026
24 checks passed
@gmaclennan
gmaclennan deleted the claude/sentry-wire-diagnostic-metrics branch July 8, 2026 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature (changelog)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sentry: wire the remaining diagnostic metric emitters (shutdown phases, ipc.errors, telemetry.forwarding_failures)

1 participant