The code above is just a sample—I have adapted it from a production codebase and I can't guarantee it will work as-is. It's just here to illustrate what a solution should look like.
The main things you need to do to get everything hooked up are:
- Rewrite
instrumentBuildto accept a passed-throughHubinstance, rather than usinggetCurrentHub()(including, perniciously, in helper functions such ashasTracingEnabled()) - In
server/index.ts, create a root transaction from the current route’s name and wrap the loaders and actions in spans viainstrumentBuild. - In
root.tsx, pass through your tracing & baggage into the meta function. - In
root.tsx, include the current domain intracePropagationTargets(because Remix fetchers will fetch from the entire URL rather than/root, which will confuse Sentry) - (Remix v2) In
root.tsx, create anErrorBoundarycomponent (with thev2_errorBoundaryflag set if you're
