Skip to content

Instrument Remix 3 server requests via fetch-router #24663

Description

@chargome

Add the orchestrion config and server middleware that produce spans for Remix 3 requests.

  • Patch createRouter in @remix-run/fetch-router and prepend the Sentry middleware. Supply the matcher too, since the router does not expose the matched route pattern on the request context.
  • Resolve the route at middleware entry, so errors thrown downstream already carry it.
  • Set http.route, response status and a low cardinality span name. router.mount() prefixes must be included.
  • Ship the --import @sentry/remix/v3/node entry, which registers Remix's TypeScript loader and Sentry's module hook together, so the start command keeps one flag.

The middleware does not open a span. It enriches the one @sentry/node already opened for node:http. That is what keeps it working on other runtimes later.

Channel subscription happens in the --import entry, not in Sentry.init(). createRouter() runs while app modules are being imported, which is before any init() call in the server entry.

Done when e2e covers parameterised routes, mounted routes and response status, and the raw id never appears in a span name.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions