sentry-react-native icon indicating copy to clipboard operation
sentry-react-native copied to clipboard

Profiling and Mobile Vitals (insights) not working on latest version of react native sdk

Open ric-sanchez-salesloft opened this issue 7 months ago β€’ 17 comments

What React Native libraries do you use?

React Native without Frameworks, React Navigation, Hermes, RN New Architecture

Are you using sentry.io or on-premise?

sentry.io (SaS)

@sentry/react-native SDK Version

6.10.0

How does your development environment look like?

System:
  OS: macOS 15.4
  CPU: (12) arm64 Apple M2 Pro
  Memory: 273.41 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.17.0
    path: ~/.asdf/installs/nodejs/20.17.0/bin/node
  Yarn: Not Found
  npm:
    version: 11.3.0
    path: ~/.asdf/plugins/nodejs/shims/npm
  Watchman:
    version: 2025.03.10.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/ricardosanchez/.asdf/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK:
    API Levels:
      - "28"
      - "31"
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 30.0.3
      - 31.0.0
      - 33.0.0
      - 33.0.1
      - 33.0.2
      - 34.0.0
      - 34.0.0
      - 34.0.0
      - 34.0.0
      - 35.0.0
      - 35.0.0
    System Images:
      - android-33 | Google APIs ARM 64 v8a
      - android-33 | Google Play ARM 64 v8a
      - android-34 | Google APIs ARM 64 v8a
      - android-35 | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.3 AI-243.22562.218.2431.13114758
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.14
    path: /opt/homebrew/opt/openjdk@17/bin/javac
  Ruby:
    version: 2.7.6
    path: /Users/ricardosanchez/.asdf/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.1.3
    wanted: ^15.0.0
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.7
    wanted: ^0.76.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

info React Native v0.79.1 is now available (your project is running on v0.76.7).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.79.1
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.76.7&to=0.79.1
info For more info, check out "https://reactnative.dev/docs/upgrading?os=macos".




Sentry.init()


  const navigationIntegration = Sentry.reactNavigationIntegration({
    enableTimeToInitialDisplay: true,
  })

  // Sentry integrations
  const mobileReplayIntegration = Sentry.mobileReplayIntegration({
    maskAllText: false,
  })

    Sentry.init({
      dsn: currentConfig.sentry.dsn,
      environment: currentEnvironment,
      tracesSampleRate: 1.0,
      profilesSampleRate: 1.0,
      replaysSessionSampleRate: 1.0,
      replaysOnErrorSampleRate: 1.0,
      integrations: [
        Sentry.reactNativeTracingIntegration(),
        mobileReplayIntegration,
        navigationIntegration,
      ],
    })

Steps to Reproduce

  1. Add sentry init as mentioned above
  2. add the following to '@react-navigation/native' 's <NaviogationContainer>:
  • navigationIntegration.registerNavigationContainer(NAVIGATION_REF)
  1. Install the app on physical devices
  2. Replays and general errors are working as expected
  3. Expects vitals and profiling info on Sentry Dashboard

Expected Result

Mobile vitals should be send to Sentry Dashboard, as for testing we are setting the tracesSampleRate and profilesSampleRate, replaysSessionSampleRate, and replaysOnErrorSampleRate to 1.0.

Actual Result

  • Only Replays and general error are being reportes

ric-sanchez-salesloft avatar Apr 29 '25 13:04 ric-sanchez-salesloft

Hi,
thank you for the message,

can you add debug: true to you Sentry.init and share the log with us.

krystofwoldrich avatar Apr 29 '25 13:04 krystofwoldrich

Hey @krystofwoldrich, I had someone reach out noticing the same problem, they're unable to populate mobile vitals page using the latest sdk version and a basic tracing setup, https://sentry.zendesk.com/agent/tickets/151608. I made a repo to test this out a bit, and followed our routing instrumentation and cannot seem to get my mobile vitals page working with navigation setup - no ui.load spans get captured, instead the transactions just get discarded. In my logs, I am seeing β€œSentry Logger [log]: [Tracing] Discarding transaction because its trace was not chosen to be sampled”.

cobyeastwood183 avatar May 07 '25 18:05 cobyeastwood183

@coby.eastwood thanks for the update and the repro, we'll take a look and follow up here. FYI @antonis @markushi

kahest avatar May 14 '25 18:05 kahest

I made a repo to test this out a bit

Thank you for the repo @cobyeastwood183 πŸ™‡ We were able to reproduce the issue and we will iterate back.

antonis avatar May 23 '25 12:05 antonis

What is the status of this one?

bvedad avatar Jul 09 '25 19:07 bvedad

What is the status of this one?

Thank you for the ping @bvedad πŸ™‡ We’re still investigating this issue. If you have a configuration that reproduces it, please feel free to share it β€” it would be a big help.

antonis avatar Jul 10 '25 07:07 antonis

@antonis When can we get an update on this issue?

Considering this is one of the major features of Sentry and it's pending for quite some time.

saxenanickk avatar Jul 21 '25 08:07 saxenanickk

Thank you for the ping @saxenanickk πŸ™‡ In most cases this issue and the Discarding transaction because its trace was not chosen to be sampled error log seem to be related to the way the navigation container is being registered. If you have a configuration that reproduces it, please feel free to share it β€” it would be a big help.

antonis avatar Jul 21 '25 12:07 antonis

Thank you for the ping @saxenanickk πŸ™‡ In most cases this issue and the Discarding transaction because its trace was not chosen to be sampled error log seem to be related to the way the navigation container is being registered. If you have a configuration that reproduces it, please feel free to share it β€” it would be a big help.

@antonis I have following setup:

"@sentry/react-native": "6.4.0",

---

export const navigationIntegration = Sentry.reactNavigationIntegration({
  enableTimeToInitialDisplay: true,
});

---

Sentry.init({
    dsn: SENTRY_DSN,
    debug: true, // for testing
    normalizeDepth: 5,

    // Tracking
    enableAutoSessionTracking: true,
    enableUserInteractionTracing: true,
    enableAppHangTracking: true,
    sessionTrackingIntervalMillis: 60000,
    appHangTimeoutInterval: 5,

    // Integrations
    integrations: [
      navigationIntegration,
      Sentry.httpClientIntegration(),
      Sentry.reactNativeTracingIntegration({
        enableHTTPTimings: true,
      }),
    ],

    // Sampling
    profilesSampleRate: 1.0, // for testing only, 0.0. on production
    tracesSampleRate: 1.0, // for testing only, 0.05 on production
});

---

<NavigationContainer
    ref={navigationRef}
    onReady={() => {
      handleAppStateReady();
      navigationIntegration.registerNavigationContainer(navigationRef);
    }}
>

saxenanickk avatar Jul 23 '25 05:07 saxenanickk

Thank you for the feedback @saxenanickk πŸ™‡

antonis avatar Jul 24 '25 06:07 antonis

Is there any update on this @antonis? We are still facing the same issue.

sethraj14 avatar Aug 25 '25 05:08 sethraj14

Thank you for the ping @sethraj14. We are still investigating this.

antonis avatar Aug 27 '25 06:08 antonis

I got the same issue :/

PiotrBorowski avatar Sep 11 '25 13:09 PiotrBorowski

I've got the same issue :(

ssarnot avatar Nov 12 '25 12:11 ssarnot

Thank you for bumping this @ssarnot πŸ™‡ Could you share the your @sentry/react-native SDK Version and your configuration?

antonis avatar Nov 12 '25 13:11 antonis

@antonis @sentry/react-native is 7.2.0 and configuration is: JS engine: hermes Expo SDK version: 54.0.0 React-native version: 0.81.5

Sentry init in App.js file:

import { init } from "@sentry/react-native";
init({
  dsn: "XXX",
  debug: false,
  sendDefaultPii: true,
  environment: effectiveEnvironment,
  attachScreenshot: false,
  tracesSampleRate: 0.5,
  profilesSampleRate: 0.5,
  integrations: [reactNativeTracingIntegration(), navigationIntegration],
  enableNativeFramesTracking: true,
  enableAutoSessionTracking: true,
  enableAutoPerformanceTracing: true,
});

ssarnot avatar Nov 13 '25 14:11 ssarnot

Thank you πŸ™‡

antonis avatar Nov 13 '25 14:11 antonis