Skip to content

feat(remix): Rewrite RemixInstrumentation to orchestrion#22244

Draft
mydea wants to merge 2 commits into
developfrom
francesconovy/js-2483-rewrite-remixinstrumentation-to-orchestrion
Draft

feat(remix): Rewrite RemixInstrumentation to orchestrion#22244
mydea wants to merge 2 commits into
developfrom
francesconovy/js-2483-rewrite-remixinstrumentation-to-orchestrion

Conversation

@mydea

@mydea mydea commented Jul 14, 2026

Copy link
Copy Markdown
Member

Rewrites the vendored RemixInstrumentation (an OpenTelemetry InstrumentationBase that patched @remix-run/server-runtime) to a diagnostics-channel listener, with orchestrion injecting the channels into the instrumented module at build time — mirroring the mysql/mysql2/kafkajs ports.

SDK changes

  • @sentry/server-utils — populated the orchestrion config for @remix-run/server-runtime (orchestrion/config/remix.ts): one channel each for requestHandler, matchServerRoutes, callRouteLoader, and callRouteAction (the pre-2.9 …RR names collapse onto the same channels), across the CJS and ESM builds. requestHandler is a named function expression returned by createRequestHandler, which name-based matching can't target, so it uses the astQuery escape hatch.
  • @sentry/remix — added remixChannelIntegration, a diagnostics-channel subscriber that reproduces the old instrumentation:
    • requestHandler → the remix.request http.server server span,
    • matchServerRoutes → enriches the active request span with the matched route (http.route, name, match.route.id) — no span of its own,
    • callRouteLoader / callRouteActionLOADER / ACTION spans (the action path awaits form-data extraction from a pre-consumption request clone).
  • Exported remixChannelIntegration from @sentry/remix. The OTel remixIntegration stays the default; the channel integration replaces it (same Remix name) when diagnostics-channel injection is enabled.

E2E changes

  • Folded the standalone remix-orchestrion test app into create-remix-app-v2 as an INJECT_ORCHESTRION-gated sentryTest variant, so one codebase runs both the OpenTelemetry and orchestrion paths (build-time injection via the orchestrion Vite plugin, DB routes + docker for mysql/ioredis, and a build-injection assertion). The base transaction tests run in both variants as a parity check.
  • To make @remix-run/server-runtime reachable by the build-time transform, @remix-run/node is force-bundled (it re-exports server-runtime, which otherwise stays external and is loaded by remix-serve at runtime, outside the Vite bundle).

Fixes #20910

@linear-code

linear-code Bot commented Jul 14, 2026

Copy link
Copy Markdown

JS-2483

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8d64ae5. Configure here.

subscribeCallRouteLoader();
if (actionFormDataAttributes) {
subscribeCallRouteAction(actionFormDataAttributes);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action spans gated on form data

High Severity

instrumentRemix only calls subscribeCallRouteAction when actionFormDataAttributes is truthy, so ACTION spans are never created unless form-data capture is configured. The old OTel instrumentation always patched callRouteAction and only used those keys for optional attribute extraction.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 8d64ae5. Configure here.

MATCH_SERVER_ROUTES: 'orchestrion:@remix-run/server-runtime:matchServerRoutes',
CALL_ROUTE_LOADER: 'orchestrion:@remix-run/server-runtime:callRouteLoader',
CALL_ROUTE_ACTION: 'orchestrion:@remix-run/server-runtime:callRouteAction',
} as const;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicated remix channel names

Low Severity

Channel name strings are duplicated locally even though remixChannels already exists in @sentry/server-utils, and NestJS already exports nestjsChannels from @sentry/server-utils/orchestrion for the same purpose. Drift between the two copies would silently stop Remix channel spans from firing.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 8d64ae5. Configure here.

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 27.65 kB - -
@sentry/browser - with treeshaking flags 26.1 kB - -
@sentry/browser (incl. Tracing) 46.42 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.21 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.2 kB - -
@sentry/browser (incl. Tracing, Replay) 85.67 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 75.31 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 90.38 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 103.04 kB - -
@sentry/browser (incl. Feedback) 44.83 kB - -
@sentry/browser (incl. sendFeedback) 32.45 kB - -
@sentry/browser (incl. FeedbackAsync) 37.58 kB - -
@sentry/browser (incl. Metrics) 28.74 kB - -
@sentry/browser (incl. Logs) 28.98 kB - -
@sentry/browser (incl. Metrics & Logs) 29.67 kB - -
@sentry/react 29.45 kB - -
@sentry/react (incl. Tracing) 48.68 kB - -
@sentry/vue 33.08 kB - -
@sentry/vue (incl. Tracing) 48.4 kB - -
@sentry/svelte 27.67 kB - -
CDN Bundle 30.05 kB - -
CDN Bundle (incl. Tracing) 48.41 kB - -
CDN Bundle (incl. Logs, Metrics) 31.64 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.71 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 70.87 kB - -
CDN Bundle (incl. Tracing, Replay) 85.9 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 87.21 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 91.7 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.97 kB - -
CDN Bundle - uncompressed 89.58 kB - -
CDN Bundle (incl. Tracing) - uncompressed 146.33 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 94.29 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 150.31 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 219.02 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 265.54 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 269.5 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279.24 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 283.19 kB - -
@sentry/nextjs (client) 51.22 kB - -
@sentry/sveltekit (client) 46.86 kB - -
@sentry/core/server 78.47 kB - -
@sentry/core/browser 64.82 kB - -
@sentry/node-core 62.79 kB -0.01% -1 B 🔽
@sentry/node 125.2 kB - -
@sentry/node (incl. diagnostics channel injection) 140.06 kB +0.14% +189 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 69.96 kB - -
@sentry/node/light 50.8 kB - -
@sentry/node - without tracing 74.17 kB - -
@sentry/aws-serverless 83.39 kB +0.01% +1 B 🔺
@sentry/cloudflare (withSentry) - minified 181.79 kB - -
@sentry/cloudflare (withSentry) 449.98 kB - -

View base workflow run

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.

Rewrite RemixInstrumentation to orchestrion

1 participant