πͺ’ Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
Sentry capture contract β depth reference
Load when authoring a beforeSend/denylist rule, hardening a capture path, or
triaging a noise family. Read the SKILL.md first β this file is
the detail behind its rules.
Contents
- Where Sentry is wired
- PII and the HIPAA compliance boundary
- The shared capture helpers
- beforeSend / denylist authoring protocol
- Fingerprinting, tagging, messages
- Known noise families
- Workstream levers (case studies)
Where Sentry is wired
- The only
Sentry.initisweb/instrumentation-client.tsβ client-side only. It configuresbeforeSend,captureConsoleIntegration({ levels: ["error"] }),httpClientIntegration(),replayIntegration(...)(unconditional masking), anddenyUrls(browser-extension origins). - The worker and web server have no Sentry SDK β backend signal lives in the server-side observability/APM stack, not Sentry. Do not assume a backend error reaches Sentry; it does not. (Treat "Sentry = frontend-only" until a decision says otherwise.)
- Filter predicates live in
web/src/utils/sentryFilters.tswith unit tests insentryFilters.clienttest.ts;beforeSendonly calls these named predicates and holds no inline checks (the former invalid-href and React-devtools inline checks were removed / migrated toisReactDevtoolsInternalEventin #15276). Add new filters only as predicates here, never inline. - The tRPC seam is
handleTrpcErrorinweb/src/utils/api.ts: every query/mutation error flows through it β the single place to classify. PR #15243 drops expecteddata.codes (NOT_FOUND/FORBIDDEN/UNAUTHORIZED) there with a breadcrumb and tags the rest (trpc.code/trpc.path).
PII and the HIPAA compliance boundary
ALL cloud regions β including HIPAA β report to the same US Sentry org. Two mechanisms keep user content (prompts, traces, PII/PHI) out of it, and they cover different channels. Do not conflate them.
- Session Replay β the unconditional mask.
instrumentation-client.tsconfiguresreplayIntegration({ maskAllText, maskAllInputs, blockAllMedia })so replays are fully masked in every deployment. The mask must never be removed or weakened, and it must be covered by a CI regression test that executes the real module per region and fails on any change to the options (the mask-guardinstrumentation-client-replay-mask.clienttest.ts; landing with #15802). A diff that trips that guard is a compliance change, not a broken test; a diff that touches Replay masking without the guard passing must be rejected. - Error events β the capture discipline (SKILL rule 7). The mask covers
Session Replay ONLY. Error-event payloads β message, breadcrumbs,
extra, tags β are not masked in any region. The rule "no user content in messages/extra/tags" IS the compliance boundary for error events; there is no downstream scrub to catch a leak.sendDefaultPiistays unset (false), so the SDK attaches no cookies, headers, request/response bodies, or user IP.
Reviewer checklist β any diff touching instrumentation-client.ts or the
replay integration:
maskAllText,maskAllInputs, andblockAllMediaremaintruein every deployment, and the mask-guard clienttest (landing with #15802) asserts against the real module β not a copy of the config or an uncalled predicate.- No new replay option weakens masking (e.g.
maskAllInputs: false, unmask/unblock selectors). sendDefaultPiiremains unset/false; no integration starts attaching bodies, headers, or cookies.- Changes to the mask-guard test itself (skipped cases, loosened assertions, region list edits) are reviewed as compliance changes.
The shared capture helpers
Prefer these over a raw captureException:
// A caught value of unknown shape (catch block, rejected promise, event handler).
captureUnknownError("io-parse", value, { traceId }); // real Error passes through; else synthesized. tags:{area}, warns (no double-capture)
// A Web Worker onerror ErrorEvent (script failed to load / threw during init).
reportParserWorkerError("useJsonParse", event); // extracts message/filename/lineno; tags:{area:"io-parse-worker"}
Both log via console.warn (not console.error) on purpose β console.error
would be re-captured by captureConsoleIntegration as a second, opaque event.
If you must capture directly: pass a real Error, add { tags: { area }, extra },
keep the message static, and log any companion console line at warn.
beforeSend / denylist authoring protocol
A suppression rule is a loaded gun aimed at your own signal. Every rule:
- Is a named predicate in
sentryFilters.ts(e.g.isNoisyHttpClientPollEvent), never an inline check inbeforeSend. - Keys on an unambiguous signature β the Sentry-set exception
mechanism.type, a whole-message match, or astartsWith-anchored prefix. Never a looseincludesthat could match a real error. - Reads the right event field. Exception events carry text on
event.exception.values[0].value; message events (console captures, benign strings,[next-auth]logs,Invalid href β¦) carry it onevent.messageorevent.logentry.message. A predicate must coalesce all three (exception value ?? event.message ?? event.logentry?.message) or it silently never fires on message events β the exact bug that left the original invalid-href filter dead. - Has a written rationale in a comment: why this signature cannot represent a real, actionable error, and where the real signal still lives (usually server-side).
- Has a NEGATIVE fixture in
sentryFilters.clienttest.tsproving a real error still passes β a 5xx / unknown code / genuine thrown Error must returnfalsefrom the predicate.
Prefer root-causing the emission over a filter whenever the source is a small, identifiable set of call sites (see Rule 5 / the invalid-href case).
Fingerprinting, tagging, messages
- Static message β correct grouping. Sentry groups by message; an
interpolated id (
Trace ${id} not found) mints a new fingerprint per id. Keep the message constant; put variability inextra. areatag on every real capture (tags: { area: "io-parse-worker" }) so issues route/group by surface. The tRPC seam addstrpc.code/trpc.path.- Explicit
fingerprintonly when a message legitimately must vary and you still want one group β set it on the scope; do not rely on the default.
Known noise families
The recurring shapes and their correct disposition:
- Expected tRPC codes β
Trace not found(NOT_FOUND),not a member(FORBIDDEN), expired session (UNAUTHORIZED). β dropped at the seam (#15243). - Transport / next-auth β
Failed to fetch,[next-auth] CLIENT_FETCH_ERROR, poll 5xx. β server owns the signal; scoped/denylisted (#15145, #15238). - Opaque non-Error captures β
[object Object],[object ErrorEvent], "Object captured as exception". β capture a real Error via the helpers (#15173, #15175). - User-content URL validation β
Invalid href β¦ passed to next/router. β render user URLs as native<a>, not a framework<Link>(#15245). - Perf detectors / third-party β N+1, HTTP-overhead
infoissues, browser extensions, crawlers. β Sentry project settings (inbound filters, detectors), not code. Stackless Chromechrome.runtimelastError (Could not establish connection. Receiving end does not exist) is the exception:denyUrlscannot match with no frames, so a named predicate drops it (LANGFUSE-614). - Stale-deploy β chunk 404s,
importScriptsfailures, version-skew. β a reload-on-new-version prompt + release-aware handling (open work).
Workstream levers (case studies)
Each row names the PR that established the pattern; verify a cited symbol/swap against the current tree before relying on it.
| PR | Family | Lever |
|---|---|---|
| #15145 | 418 httpClient poll 5xx (~44kβ8/24h) | isNoisyHttpClientPollEvent (mechanism + path) |
| #15173 | parse-worker [object ErrorEvent] |
reportParserWorkerError (real Error) |
| #15174 | JSON-viewer meta-root offsets (456) | fingerprint/render fix |
| #15175 | opaque non-Error captures (5EX) | captureUnknownError (real Error) |
| #15238 | transport / next-auth / benign (~1.9k/24h) | isDenylistedNoiseEvent in sentryFilters.ts β reads all event fields, negative fixtures |
| #15243 | expected tRPC codes (54F #2, ~30k) | handleTrpcError classify + breadcrumb + tags |
| #15245 | Invalid href (5DZ/5EA/5ER, ~40k) |
native <a> at the source |
Each is a worked example of one rule: prefer real Errors, prefer root-cause over filter, read the right field, keep a negative fixture, verify in the browser.