feat(sentry): wire the diagnostic metric emitters for shutdown, IPC errors, and telemetry failures#195
Merged
Conversation
…rrors, and telemetry failures Closes #190
gmaclennan
commented
Jul 8, 2026
gmaclennan
enabled auto-merge
July 8, 2026 10:46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #190.
backend/lib/metrics.jsshipped three emitters with no production call sites, so their metrics never reached Sentry. This wires them.shutdownPhasenow records viasentry.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-socketshutdownhandler wraps its close steps in three spans —shutdown.close-servers(control + fastify + RPC in parallel),shutdown.close-manager, andshutdown.close-map-server— mirroring how the boot phases record and matching the three-phase cardinality budget in the plan doc.ipcErrorrecordscomapeo.ipc.errorswhere socket errors surface: themessageerrorlisteners on the control socket (SimpleRpcServer) and the comapeo socket (ComapeoRpc), plus thebroadcastcatch when a clientpostMessagethrows.telemetryForwardingFailurerecordscomapeo.telemetry.forwarding_failuresat the envelope sink's three failure points inbackend/lib/sentry.js: the forwarding transport when the sink throws, the pre-listen queue when it overflows and drops a frame, and thesetSinkdrain when the sink throws.Each emitter gets a test through its real call path:
withSpan("shutdown.*")and a throwing sink insentry.test.mjs(against the real SDK), and a malformed frame on each socket insimple-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), andnpm run backend:test(77 passed).