Skip to content

Txn source: "url" even though set manually in beforeNavigate() #8182

Closed as not planned
@realkosty

Description

@realkosty

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/browser

SDK Version

7.51.1

Framework Version

No response

Link to Sentry event

*** See linked Jira ticket ***

SDK Setup

Sentry.init({
      dsn: _dsn,
     
      integrations: [
        new Sentry.BrowserTracing({
          tracingOrigins: [
            // ...
          ],
          beforeNavigate: (context) => {
            return {
              ...context,
              name: transactionName()
            };
          }
        }),
       
      // ...

      routingInstrumentation: Sentry.reactRouterV5Instrumentation(
        history,
        REACT_ROUTER_ROUTES,
        matchPath
      ),

      // ...

    });

// ...

export const transactionName = () => {
  const { pathname } = window.location;

  // ...

  // temporarily fixes <<unparameterized>> grouping as recommended by sentry engineers
  // this unblocks analytics performance monitoring until sentry fixes an issue
  // with transaction grouping on their end. 
  // ref - https://develop.sentry.dev/transaction-clustering/
  if (pathname === '/') {
    return '/';
  }

  // ...

};

Steps to Reproduce

Go to customer website *** see linked Jira ticket ***
Capture a few dozen pageloads until transaction is sampled (their tracesSampleRate is 0.1), get the id
Look at txn in Sentry.
Examine their sentry.js if needed for more detail

Expected Result

transaction.source: "custom"

Actual Result

transaction.source: "url"

ROOT CAUSE: https://github.com/getsentry/sentry-javascript/blob/ff4b1a85b3c04d2782880629b0d5be591568deaf/packages/tracing-internal/src/browser/browsertracing.ts#LL297C49-L297C49

Original PR: #5396

┆Issue is synchronized with this Jira Improvement by Unito

Metadata

Metadata

Assignees

No one assigned

    Labels

    Sync: Jiraapply to auto-create a Jira shadow ticket

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions