Skip to content

Profiling not working on latest version of react native sdk #5041

@BishalSaha

Description

@BishalSaha

What React Native libraries do you use?

React Native without Frameworks, React Navigation, Hermes

Are you using sentry.io or on-premise?

sentry.io (SaS)

@sentry/react-native SDK Version

6.19.0

How does your development environment look like?

⬇  Place the `npx react-native@latest info` output here. ⬇ 
System:
  OS: macOS 15.5
  CPU: (14) arm64 Apple M4 Pro
  Memory: 150.36 MB / 24.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.1.0
    path: /opt/homebrew/bin/node
  Yarn:
    version: 3.6.4
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.8.1
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2024.05.06.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.0
      - iOS 18.0
      - macOS 15.0
      - tvOS 18.0
      - visionOS 2.0
      - watchOS 11.0
  Android SDK:
    API Levels:
      - "31"
      - "33"
      - "34"
      - "35"
      - "36"
    Build Tools:
      - 30.0.3
      - 31.0.0
      - 33.0.0
      - 34.0.0
      - 35.0.0
      - 36.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 APIs ARM 64 v8a
      - android-35 | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.1 AI-241.19072.14.2412.12360217
  Xcode:
    version: 16.0/16A242d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.9
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.5
    wanted: 0.74.5
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Sentry.init()

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

Sentry.init({
  dsn: 'https://...@sentry.io/...'
  debug: true,
  sendDefaultPii: true,
  tracesSampleRate: 1.0,
  profilesSampleRate: 1.0,
  environment: __DEV__ ? 'development' : 'production',
  // replaysSessionSampleRate: 0.1,
  // replaysOnErrorSampleRate: 1.0,
  // integrations: [Sentry.mobileReplayIntegration()],
  integrations: [routingInstrumentation, Sentry.hermesProfilingIntegration()],
});

Steps to Reproduce

  1. Add sentry init with sentry wizard as mentioned above
  2. add the following to 'app.tsx'
  3. add the following to '@react-navigation/native' 's :
    --- navigationIntegration.registerNavigationContainer(NAVIGATION_REF)
  4. navigationIntegration.registerNavigationContainer(NAVIGATION_REF)
  5. Install the app on physical devices
  6. Traces, Replays and general errors are working as expected
  7. Expects profiling info on Sentry Dashboard

Expected Result

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

Also to reduce any confusion we have removed Replays for now.

Actual Result

Waiting for this project's first profile ❓❓❓

Here is the logs:


 LOG  Sentry Logger [log]: Using Hermes native promise rejection tracking
 LOG  Sentry Logger [log]: Unhandled promise rejections will be caught by Sentry.
 LOG  Sentry Logger [log]: Integration installed: ReactNativeErrorHandlers
 LOG  Sentry Logger [log]: Integration installed: NativeLinkedErrors
 LOG  Sentry Logger [log]: Integration installed: InboundFilters
 LOG  Sentry Logger [log]: Integration installed: FunctionToString
 LOG  Sentry Logger [log]: Integration installed: Breadcrumbs
 LOG  Sentry Logger [log]: Integration installed: Dedupe
 LOG  Sentry Logger [log]: Integration installed: HttpContext
 LOG  Sentry Logger [log]: Integration installed: Release
 LOG  Sentry Logger [log]: Integration installed: EventOrigin
 LOG  Sentry Logger [log]: Integration installed: SdkInfo
 LOG  Sentry Logger [log]: Integration installed: ReactNativeInfo
 LOG  Sentry Logger [log]: Integration installed: RewriteFrames
 LOG  Sentry Logger [log]: Integration installed: DeviceContext
 LOG  Sentry Logger [log]: Integration installed: ModulesLoader
 LOG  Sentry Logger [log]: Integration installed: HermesProfiling
 LOG  Sentry Logger [log]: Integration installed: AppStart
 LOG  Sentry Logger [log]: Integration installed: NativeFrames
 LOG  Sentry Logger [log]: Integration installed: StallTracking
 LOG  Sentry Logger [log]: Integration installed: AppRegistry
 LOG  Sentry Logger [log]: Integration installed: ReactNativeTracing
 LOG  Sentry Logger [log]: Integration installed: TimeToDisplay
 LOG  Sentry Logger [log]: Integration installed: ExpoContext
 LOG  Sentry Logger [log]: Integration installed: DebugSymbolicator
 LOG  Sentry Logger [log]: Integration installed: ReactNavigation
 LOG  Sentry Logger [log]: [NATIVE] Start Profiling
 LOG  Sentry Logger [log]: [Profiling] started profiling:  971f280b17504dc5b0baa10f4eb82a87
 DEBUG  Sentry Logger [debug]: [AppStart] First started active root span id recorded. 80bcd98f5027b1c9
 DEBUG  Sentry Logger [debug]: [NativeFrames] Fetching frames for root span start (80bcd98f5027b1c9).
 LOG  Sentry Logger [log]: [Tracing] Starting sampled root span
  op: navigation
  name: Route Change
  ID: 80bcd98f5027b1c9
 LOG  Sentry Logger [log]: [Tracing] Started span is an idle span
 LOG  Sentry Logger [log]: [startIdleNavigationSpan] Starting navigation transaction "Route Change" on scope
 LOG  Sentry Logger [log]: [Tracing] Starting sampled span
  op: navigation.processing
  name: Navigation dispatch to navigation cancelled or screen mounted
  ID: a54fc5ae7280ee6d
  parent ID: 80bcd98f5027b1c9
  root ID: 80bcd98f5027b1c9
  root op: navigation
  root description: Route Change
 LOG  Sentry Logger [log]: [AppStartIntegration] Waiting for initial app start was flush, before updating based on runApplication call.
 LOG  Running "Bhasha" with {"rootTag":1,"initialProps":{"concurrentRoot":false}}
 LOG  Sentry Logger [log]: [Tracing] Starting sampled span
  op: ui.react.mount
  name: <Root>
  ID: 818f4e11f5659489
  parent ID: 80bcd98f5027b1c9
  root ID: 80bcd98f5027b1c9
  root op: navigation
  root description: Route Change
 LOG  Sentry Logger [log]: [Tracing] Finishing "ui.react.mount" span "<Root>" with ID 818f4e11f5659489
 DEBUG  Sentry Logger [debug]: [NativeFrames] Fetch frames for child span end (818f4e11f5659489).
 LOG  Sentry Logger [log]: Integration installed: ReactNativeProfiler
 LOG  Sentry Logger [log]: Integration installed: TouchEventBoundary
 DEBUG  Sentry Logger [debug]: [AppStart] Captured end frames for app start. {"frozenFrames": 0, "slowFrames": 2, "totalFrames": 2}
 DEBUG  Sentry Logger [debug]: [AppStart] App start tracking is enabled. App start will be added to the first transaction as a child span.
 LOG  Sentry Logger [log]: [Tracing] Finishing "navigation.processing" span "Navigation dispatch to screen Home mounted" with ID a54fc5ae7280ee6d
 DEBUG  Sentry Logger [debug]: [NativeFrames] Fetch frames for child span end (a54fc5ae7280ee6d).
 LOG  Sentry Logger [log]: [Tracing] Idle span "navigation" finished
 LOG  Sentry Logger [log]: [Tracing] Finishing "navigation" root span "Home" with ID 80bcd98f5027b1c9
 LOG  Sentry Logger [log]: [Profiling] finished profiling:  971f280b17504dc5b0baa10f4eb82a87
 DEBUG  Sentry Logger [debug]: [NativeFrames] Fetch frames for root span end (80bcd98f5027b1c9).
 LOG  Sentry Logger [log]: [Tracing] Adding an event to span: stall_count
 LOG  Sentry Logger [log]: [Tracing] Adding an event to span: stall_total_time
 LOG  Sentry Logger [log]: [Tracing] Adding an event to span: stall_longest_time
 DEBUG  Sentry Logger [debug]: Removing AppState listener for navigation transaction.
 LOG  Sentry Logger [log]: [Measurements] Adding measurements to transaction event {
  "stall_count": {
    "value": 0,
    "unit": "none"
  },
  "stall_total_time": {
    "value": 0,
    "unit": "millisecond"
  },
  "stall_longest_time": {
    "value": 0,
    "unit": "millisecond"
  }
}
 DEBUG  Sentry Logger [debug]: [AppStart] Attached frame data to span. {"frameData": {"frozen": 0, "slow": 2, "total": 2}, "spanId": "9e15d9f6ac4b0fc4"}
 DEBUG  Sentry Logger [debug]: [AppStart] Added app start spans to transaction event. [
  {
    "status": "ok",
    "op": "app.start.cold",
    "description": "Cold App Start",
    "start_timestamp": 1754253944.367757,
    "timestamp": 1754253947.4373572,
    "trace_id": "dd47a6272ba34e929bd038a6b993c1df",
    "parent_span_id": "80bcd98f5027b1c9",
    "origin": "auto.app.start",
    "span_id": "9e15d9f6ac4b0fc4",
    "data": {
      "sentry.op": "app.start.cold",
      "sentry.origin": "auto.app.start",
      "frames.total": 2,
      "frames.slow": 2,
      "frames.frozen": 0
    }
  },
  {
    "status": "ok",
    "op": "app.start.cold",
    "trace_id": "dd47a6272ba34e929bd038a6b993c1df",
    "parent_span_id": "9e15d9f6ac4b0fc4",
    "origin": "auto.app.start",
    "description": "JS Bundle Execution Before React Root",
    "start_timestamp": 1754253946.4887354,
    "timestamp": 1754253947.3771908,
    "span_id": "aef4943194482d8b",
    "data": {
      "sentry.op": "app.start.cold",
      "sentry.origin": "auto.app.start"
    }
  },
  {
    "status": "ok",
    "op": "app.start.cold",
    "trace_id": "dd47a6272ba34e929bd038a6b993c1df",
    "parent_span_id": "9e15d9f6ac4b0fc4",
    "origin": "auto.app.start",
    "description": "UIKit Init to JS Exec Start",
    "start_timestamp": 1754253945.7709122,
    "timestamp": 1754253946.4884384,
    "span_id": "b85e4c61cbde5821",
    "data": {
      "sentry.op": "app.start.cold",
      "sentry.origin": "auto.app.start",
      "thread.name": "main"
    }
  }
]
 DEBUG  Sentry Logger [debug]: [AppStart] Added app start measurement to transaction event. {
  "value": 3069.60009765625,
  "unit": "millisecond"
}
 DEBUG  Sentry Logger [debug]: [NativeFrames] Using native frames from last child span end (spanId, 80bcd98f5027b1c9).
 LOG  Sentry Logger [log]: [NativeFrames] Adding measurements to ui.load transaction Home: {
  "frames_total": {
    "value": 17,
    "unit": "none"
  },
  "frames_frozen": {
    "value": 0,
    "unit": "none"
  },
  "frames_slow": {
    "value": 4,
    "unit": "none"
  }
}
 DEBUG  Sentry Logger [debug]: [TimeToDisplay] No manual ttid end timestamp found for span 80bcd98f5027b1c9.
 LOG  Sentry Logger [log]: [Profiling] Created profile 971f280b17504dc5b0baa10f4eb82a87 for transaction c6f63758d69441d78e5bc6fa009af09b

Metadata

Metadata

Assignees

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions