Skip to content

feat(service): Add Sentry spans and cache metrics - #13

Merged
dcramer merged 1 commit into
mainfrom
feat/sentry-cache-telemetry
Oct 16, 2026
Merged

dcramer merged 1 commit into
mainfrom
feat/sentry-cache-telemetry

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Adds Sentry tracing and new metrics (Sentry.metrics.*, @sentry/node 11.6.0, no upgrade needed), so the hit rate of each tenant and rule shows in Sentry.

Metrics (attributes: tenant, mode, rule, origin, result; no key or run). They replace roach.recording.

  • roach.request: counter, result = replayed | live | missed | passthrough
  • roach.request.duration: distribution (ms), by result
  • roach.recording.write: counter, result = written | dropped (failed session)

Hit rate = replayed / (replayed + live + missed), from roach.request grouped by result.

Spans (each has tenant, mode, run): roach.run.start, roach.request (the root of each proxied request, with rule, result, status), roach.key (key), roach.store.read (hit/miss), roach.upstream (status), roach.store.write. The sample rate is 1.

Telemetry has no credentials, bodies, or URL paths. The SDK's HTTP spans, breadcrumbs, and RequestData are off, because they put full URLs, headers, and request bodies on spans (the POST /runs body has the run secrets). tracePropagationTargets: [] means the proxy no longer sends sentry-trace/baggage upstream. main sends them today.

No change to RoachServiceConfig or deploy/gcp/. The README has a new "Sentry" section.

To check: pnpm exec vitest run tests/deployed.test.ts. The fake Sentry server now checks every metric and span, and checks that no envelope has a token, a path, or a body. It also checks that the upstream gets no trace headers.

This branch merges cleanly with #12 (I checked locally, and typecheck and tests pass on the merge).

via David Cramer.

--

View Junior Session [Sentry]

Each proxied request is now a trace, with spans for the key, the store
read, and the live request. New metrics count each request by result
(replayed, live, missed, passthrough) and time it, so the hit rate of
each tenant and rule shows in Sentry. They replace roach.recording, and
they do not have the key or the run.

The SDK no longer adds request data or trace headers: request data had
URLs and bodies, and the proxy sent sentry-trace and baggage upstream.

Co-Authored-By: David Cramer <david@sentry.io>
@dcramer
dcramer merged commit 13d31e6 into main Oct 16, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant