Add TracingChannel support for APM instrumentation#1
Open
sergical wants to merge 8 commits into
Open
Conversation
Adds native diagnostics_channel TracingChannel instrumentation to three subsystems so APM tools can subscribe to structured lifecycle events without monkey-patching: - remix:request — traces middleware and route handler execution in fetch-router - remix:render — traces server-side rendering in ui/server - remix:asset — traces on-demand script/style compilation in assets Zero cost when no subscribers are registered (hasSubscribers gating). Includes a demo app (demos/tracing-channels) that logs all three channels. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replaces console logging with real Sentry OTel spans via otel-tracing-channel. All three channels (remix:request, remix:render, remix:asset) now export spans with correct parent-child nesting to a Sentry DSN. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Injects sentry-trace and baggage meta tags into the HTML response. Client-side JS reads these and sends them on fetch requests, linking browser-initiated requests to the server-side trace. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Browser SDK reads sentry-trace meta tag from server-rendered HTML, continues the server trace, and automatically attaches trace headers to fetch() calls — connecting browser and server spans in one trace. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Guard against calling span.end() twice when TracingChannel fires both error and asyncEnd on promise rejection - Mark @sentry/browser as external for the asset server (pnpm store paths fall outside the allow glob) - Simplify client entry to manual header propagation (no browser SDK bundling needed) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use the CDN bundle (v10.51.0) instead of bundling @sentry/browser through the asset server. browserTracingIntegration() reads the sentry-trace meta tag and propagates headers on all fetch() calls, connecting browser pageload + API requests to the server trace. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Handler name is already 'GET /' from the framework, don't prepend the method again - Use op 'remix.handler' instead of 'http.server' to avoid looking like a duplicate of Sentry's built-in HTTP span Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This was referenced May 4, 2026
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.
Summary
diagnostics_channelTracingChannelinstrumentation to Remix 3's three subsystemsremix:request— traces middleware and route handler execution infetch-routerremix:render— traces server-side rendering inui/serverremix:asset— traces on-demand script/style compilation inassetshasSubscribersgating)demos/tracing-channels) that subscribes to all three channels and logs spans with timingThis enables APM tools (Sentry, OpenTelemetry, Datadog, etc.) to subscribe to structured lifecycle events without monkey-patching. Since Remix 3 is a closure-based, ESM-only framework, monkey-patching would be especially fragile — TracingChannel provides a stable, first-party surface from day one.
Traced request flow
Demo output
Test plan
fetch-routertests passtsc --noEmit)@sentry/remix)🤖 Generated with Claude Code