Skip to content

Transaction names are not properly parameterized with react-router v6 #5513

Closed
@jamesbvaughan

Description

@jamesbvaughan

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/react

SDK Version

7.8.0

Framework Version

18.1.0

Link to Sentry event

https://sentry.io/organizations/arcol-og/performance/summary/?environment=dev&project=6576795&query=transaction.duration%3A%3C15m+transaction.op%3Apageload&statsPeriod=1h&transaction=%2Fprojects%2Fe7962d8a-e041-4006-9f44-d84ffabbdad9%2Fviews%2F982ebfaa-1e51-4726-9ca4-b04869e395b5&unselectedSeries=p100%28%29

Steps to Reproduce

Here's a simplified version of my relevant react-router (react-router-dom version 6.2.1) and Sentry config:

Sentry.init({
  ...
  integrations: [
    new BrowserTracing({
      routingInstrumentation: Sentry.reactRouterV6Instrumentation(
        useEffect,
        useLocation,
        useNavigationType,
        createRoutesFromChildren,
        matchRoutes,
      ),
    }),
  ],
});

const SentryRoutes = Sentry.withSentryReactRouterV6Routing(Routes);

const MyRoutes = () => {
  return (
    <SentryRoutes>
      <Route index element={<Navigate to="/projects" />} />

      <Route path="/account" element={<AccountPage />} />

      <Route path="/projects">
        <Route index element={<ProjectBrowser />} />

        <Route path=":projectId" element={<ProjectPage />}>
          <Route index element={<ProjectPageRoot />} />

          <Route element={<EditorPage />}>
            <Route path="views/:viewId" element={<ViewCanvas />} />
            <Route path="spaces/:spaceId" element={<SpaceCanvas />} />
          </Route>
        </Route>
      </Route>

      <Route path="*" element={<NoMatchPage />} />
    </SentryRoutes>
  );
};

export default MyRoutes

As far as I can tell, I'm not doing anything unusual, except possibly the use of react router's Outlets and Layout Routes.

Expected Result

With this config, I'd expect to get transactions with names like /projects/:projectId/views/:viewId.

Actual Result

Instead, I'm getting transactions with names like /projects/e7962d8a-e041-4006-9f44-d84ffabbdad9/views/982ebfaa-1e51-4726-9ca4-b04869e395b5.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions