Repository navigation
feat(node): Add oRPC v2 integration - #26588
sentry-junior[bot] wants to merge 2 commits into
Conversation
size-limit report 📦Compared: 670a1b9 (PR test merge using develop at 41856af) Against: 41856af (develop) · base run #67448 ✅ Baseline matches: this diff contains only this PR's changes.
|
|
One or more gzipped bundles increased by more than 500 bytes. If this increase is intentional, add the Accept Bundlesize Increase label to this PR to rerun and accept the check. |
Optional E2E testsSome optional checks were not successful. They do not block the merge. 6 not successful, 58 successful. See the run.
Successful checks
|
| 'suites/tracing/openai/v6/test.ts', | ||
| 'suites/tracing/openai/v7/test.ts', | ||
| 'suites/tracing/orchestrion-lazy-registration/test.ts', | ||
| 'suites/tracing/orpc/test.ts', |
There was a problem hiding this comment.
why does this have to be exlucded? should that not work on bun
There was a problem hiding this comment.
It does work on Bun, just not unbundled. NO_AUTO_INSTRUMENTATION only excludes the plain bun run project: bun run can't inject the orchestrion channels (see the comment above the list and #23882), so executeProcedureInternal never publishes and there are no spans or errors. The suite still runs in the bundled node-suites-bun-build project with @sentry/bun/plugin, and it passed there (4/4 locally and in CI). That matches how hono and koa are handled in the same list.
a775f44 to
f018ced
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 4 total unresolved issues (including 3 from previous reviews).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f018ced. Configure here.
|
tests fail, why? if flaky, fix the flakes and rerun |
|
rebase on develop and fix tests |
Squashed rebase of the branch onto develop. The lockfile is regenerated. Co-Authored-By: Francesco Gringl-Novy <2411343+mydea@users.noreply.github.com>
Nested in-process procedure calls no longer rename the http.server root to the inner procedure. A throwing shouldHandleError no longer replaces the original error of an event iterator. The Cloudflare suite now uses the vite plugin with instrument.server.ts, and the tests use span ops from @sentry/conventions. Co-Authored-By: Francesco Gringl-Novy <2411343+mydea@users.noreply.github.com>
6af7248 to
4336ebd
Compare

What
Adds
orpcIntegration()for oRPC v2. It's on by default in the server SDKs, the same as Hono, and is exported from@sentry/cloudflareand@sentry/denotoo.rpcspan named after the procedure path (e.g.planet/find), with originauto.rpc.orpcandrpc.system.name/rpc.methodattributes. When the root span ishttp.server, the transaction is renamed to the procedure. Direct server-side calls outside a request keep their root name.dataCollectionallows incoming request bodies, go into anorpccontext.ORPCErrors that map to 4xx are skipped by default, whichshouldHandleErrorcan change. For event-iterator output, the span ends when the procedure returns, and errors thrown later while the stream is consumed are still captured.Why
Everything runs through one orchestrion hook on
executeProcedureInternalin@orpc/server(>=2.0.0-0 <3, so v2 betas match). This function runs the middleware chain and the handler of a procedure call, and it rejects with the original error before oRPC encodes it into a response. No OpenTelemetry and no runtime@orpc/*dependency.oRPC's global tracer hook (
Symbol.for('ORPC_TRACER')) isn't used. It only receives a lossy copy of errors, and it emits many middleware, handler and validation spans. So middleapi/orpc#2493 isn't needed for this integration. There's no client hook either: fetch/http instrumentation already traces and propagates oRPC client requests.Decided: the integration stays on by default rather than opt-in, and its size growth is accepted. That growth is about +0.6 kB gzipped on
@sentry/node,@sentry/nodewithout tracing, and@sentry/aws-serverless.Supported runtimes: Node, Bun (bundled), Deno and Cloudflare Workers. On Deno,
@orpc/serveris instrumented by the runtime hook.init()covers imports after it, and--preload=npm:@sentry/deno/importcovers static imports. On Cloudflare, the worker must be built with@sentry/cloudflare/vite. The hook runs per request, so a module-scopeRPCHandlerworks on workerd. Limits:executeProcedureInternalname. If oRPC renames it, both are silently lost.@sentry/bun/plugin. Unbundledbun runcan't apply orchestrion, so it gets no oRPC spans and no error capture. Bun treats oRPC like the other orchestrion-based integrations, such as Hono and Koa.@sentry/nodeon Deno doesn't instrument Deno'sfetch, so client calls there don't propagate the trace.@sentry/denoand itsfetchIntegrationdo.Open question: a custom
errorStatusMapneeds a matchingshouldHandleError.Follow-ups: the OpenAPI handler. The lockfile bumps type-fest to 5.10.0 because oRPC requires it.
Ref #16330
via @mydea.
--
View Session [Sentry]