Skip to content

feat(cli): Ask about tracing in the React Native wizard - #2673

Merged
BYK merged 1 commit into
mainfrom
antonis/wizard-rn-tracing
Dec 1, 2026
Merged

BYK merged 1 commit into
mainfrom
antonis/wizard-rn-tracing

Conversation

@antonis

@antonis antonis commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The React Native wizard never sets up tracing. Its Sentry.init has no tracesSampleRate, and sentry wizard reactNative --tracing is accepted but ignored: the shared tracing question applies to every integration, but the React Native wizard never asked it.

Key Changes

  • The React Native wizard asks the shared tracing question ("Do you want to enable Tracing to track the performance of your application?") before Logs and Session Replay, with "Yes" first and hinted as recommended, as in the Next.js wizard. --tracing / --no-tracing answer it without a prompt. A yes logs that every trace is sampled and should be lowered in production, and sets an enable-tracing telemetry tag.
  • With tracing on, the generated Sentry.init (react-native/javascript.ts) gets, after sendDefaultPii:
    // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
    tracesSampleRate: 1.0,
    The wording matches the Next.js wizard. This applies both when the wizard writes the App file and in the copy-paste instructions. With tracing off, the snippet is unchanged.
  • Tests in javascript.test.ts: the exact block, with its blank lines, with tracing on; no tracesSampleRate with it off.

Not included: React Navigation and Expo Router integration, which is still to do (#2642).

Verification

  • On a fresh create-expo-app (Expo 58, @sentry/react-native 8.28.1), the wizard's Sentry.init with tracing, logs and replay, inserted into src/app/_layout.tsx, adds no TypeScript errors: none in _layout.tsx, and the app's tsc --noEmit reports the same 3 errors with and without it, all in the template's web components.
  • sentry wizard --help lists --tracing/--no-tracing for every integration.
  • Wizard tests, typecheck and lint pass.

End to end (comment): sentry wizard <org>/<project> reactNative from source on a fresh Expo 58.1 / React Native 0.88.1 app with default answers, then npx expo run:ios on an iOS 18.1 simulator (Debug). The wizard asked the tracing question with "Yes (recommended)" first and wrote the block above. On launch, the app sent a ui.load transaction (origin auto.app.start) with app.start.cold spans and the app start, frames and stall measurements: trace. There were no navigation transactions, as expected without the Expo Router integration.

Part of #2642.

🤖 Generated with Claude Code

The React Native wizard never set up tracing: its `Sentry.init` had no
`tracesSampleRate`, and it ignored `--tracing`. It now asks the shared
tracing question, with yes recommended as in the Next.js wizard, and on
yes writes `tracesSampleRate: 1.0` with a note to lower it in
production.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cli Ready Ready Preview Dec 1, 2026 3:55pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Dec 1, 2026 3:55pm UTC

Request Review

@antonis

antonis commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

Tested 5f6a8c9 end to end on a fresh create-expo-app (Expo 58.1, React Native 0.88.1). I ran sentry wizard <org>/<project> reactNative from source with default answers, then built and ran the app on an iOS 18.1 simulator (Debug, npx expo run:ios), with the React Native sample app's DSN.

  • The wizard asks "Do you want to enable Tracing to track the performance of your application?" with "Yes (recommended)" first. After a yes, it logs "Tracing will be enabled with tracesSampleRate: 1.0, which captures every trace. Lower it in production."
  • The generated Sentry.init in src/app/_layout.tsx has the tracing block between sendDefaultPii and Logs, with one blank line around it:
    // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
    tracesSampleRate: 1.0,
  • On launch, the app sent a ui.load transaction (origin auto.app.start, release com.anonymous.Expo2663@1.0.0+1, @sentry/react-native 8.37.0) with app.start.cold spans and the app_start_cold, frames and stall measurements. Tracing is on with no other setup: https://sentry-sdks.sentry.io/explore/traces/trace/d7558a667ab64d26b79e504283d0ac1a/

As expected, there are no navigation transactions: Expo Router instrumentation isn't part of this PR (getsentry/sentry-react-native#5139).

@antonis
antonis marked this pull request as ready for review December 1, 2026 16:12
@antonis
antonis requested a review from BYK December 1, 2026 16:12
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Dec 1, 2026
@BYK
BYK added this pull request to the merge queue Dec 1, 2026
Merged via the queue into main with commit 232408b Dec 1, 2026
33 checks passed
@BYK
BYK deleted the antonis/wizard-rn-tracing branch December 1, 2026 16:19
github-actions Bot pushed a commit to Fields-Education/sentry-mcp that referenced this pull request Dec 3, 2026
…sentry#2808)

Testing `sentry wizard android` on fresh Android Studio projects
(getsentry/sentry-java#6797) showed that the Android wizard turns on
tracing for every app without asking: the manifest always gets
`io.sentry.traces.sample-rate = 1.0` and
`io.sentry.traces.user-interaction.enable = true`. It never offers
profiling. This follows getsentry#2800, which made the same
change for iOS. The React Native wizard already asks about tracing
(getsentry#2673).

The wizard now asks Tracing, then Logs as before. It asks Profiling only
when Tracing is yes. Profiling uses the `trace` lifecycle, which
profiles only during traces, so it needs tracing. When Tracing is no,
the wizard skips the question, ignores any `--profiling` flag, and logs
`Profiling: no (it only runs during traces, so it needs Tracing)`. It
sets the `enable-tracing`, `enable-profiling`, and `enable-logs` tags.

`manifest` now takes `{ dsn, enableLogs, enableTracing, enableProfiling
}`:

- The traces sample rate and user-interaction tracing lines are written
only with tracing. User-interaction tracing creates transactions, so it
needs tracing. The user-interaction breadcrumbs are a separate option
that is on by default, so they don't change. The comment above
`traces.user-interaction.enable` now says it enables transactions, not
breadcrumbs.
- With profiling, the `io.sentry.traces.profiling.session-sample-rate`
(1.0) and `io.sentry.traces.profiling.lifecycle` (`trace`) lines come
after the tracing lines, as in the Android docs
(`docs/platforms/android/index.mdx` in getsentry/sentry-docs).
- Everything else stays in the same order, and leaving a block out
leaves no extra blank lines.

All three questions default to yes, so pressing Enter gives today's
manifest plus profiling.

<!-- junior-request-attribution:start -->
via **Antonis Lilis**.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AD0CAPGCFLSC%3A1796225521.324199 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/slack%3AD0CAPGCFLSC%3A1796225521.324199)
[[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AD0CAPGCFLSC%3A1796225521.324199/?project=4510944073809921)

<!-- junior-session-footer:end -->

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Antonis Lilis <antonis.lilis@sentry.io>

This branch was successfully deployed

1 active and 1 inactive deployments
Preview – cli — 5f6a8c9b Deployed Dec 1, 2026 by vercel[bot]
Preview – sentry-local — 5f6a8c9b Deployed Dec 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants