tracesSampleRate is random per-transaction — the same device may be sampled for one session and not the next. This makes before/after regression comparison unreliable. A deterministic per-installation sampler that hashes a stable device identifier would ensure the same device is always in/out of sample across launches and releases.
Feasibility Assessment (Jul 2026)
Not yet covered — no deterministic per-installation sampling exists in the RN SDK. tracesSampleRate uses Math.random() per-transaction.
Cross-SDK alignment: No other Sentry SDK offers per-device/installation sampling. Existing "consistent sampling" across SDKs is:
- Per-trace:
sample_rand propagation ensures all spans in a distributed trace get the same decision (JS, Python, Dart)
- Per-session: JS SDK's
consistentTraceSampling ensures linked browser navigations in one session are consistent
- None hashes a persistent device/installation ID for cross-session, cross-release consistency
Spec: No develop.sentry.dev spec exists for per-device sampling. The sampling spec covers per-trace determinism only.
tracesSampler workaround: The callback is synchronous, but the installation ID is only accessible via async fetchNativeDeviceContexts(). Users would need to pre-fetch and cache before Sentry.init(), which is cumbersome. A sync getInstallationId() native bridge method would be needed.
Native bridge: Installation ID is available on both platforms:
- iOS:
PrivateSentrySDKOnly.installationID (used in RNSentry.mm:499)
- Android: Via
InternalSentrySdk.serializeScope() (RNSentryModuleImpl.java:1093)
Dashboard visibility: Transactions sampled this way appear normally. The value is statistical — same 10% of devices always sampled enables reliable regression comparison — but no dashboard UI exists for cohort comparison.
Implementation
- Add a synchronous
getInstallationId() native bridge method
- Ship a named export like
installationBasedSampler(rate) that hashes the installation ID
- Users pass it as
tracesSampler
Note: Consider proposing a cross-SDK spec at develop.sentry.dev so Cocoa, Java/Android, and Dart/Flutter can follow the same API shape, since all mobile SDKs face the same problem.
tracesSampleRateis random per-transaction — the same device may be sampled for one session and not the next. This makes before/after regression comparison unreliable. A deterministic per-installation sampler that hashes a stable device identifier would ensure the same device is always in/out of sample across launches and releases.Feasibility Assessment (Jul 2026)
Not yet covered — no deterministic per-installation sampling exists in the RN SDK.
tracesSampleRateusesMath.random()per-transaction.Cross-SDK alignment: No other Sentry SDK offers per-device/installation sampling. Existing "consistent sampling" across SDKs is:
sample_randpropagation ensures all spans in a distributed trace get the same decision (JS, Python, Dart)consistentTraceSamplingensures linked browser navigations in one session are consistentSpec: No develop.sentry.dev spec exists for per-device sampling. The sampling spec covers per-trace determinism only.
tracesSamplerworkaround: The callback is synchronous, but the installation ID is only accessible via asyncfetchNativeDeviceContexts(). Users would need to pre-fetch and cache beforeSentry.init(), which is cumbersome. A syncgetInstallationId()native bridge method would be needed.Native bridge: Installation ID is available on both platforms:
PrivateSentrySDKOnly.installationID(used inRNSentry.mm:499)InternalSentrySdk.serializeScope()(RNSentryModuleImpl.java:1093)Dashboard visibility: Transactions sampled this way appear normally. The value is statistical — same 10% of devices always sampled enables reliable regression comparison — but no dashboard UI exists for cohort comparison.
Implementation
getInstallationId()native bridge methodinstallationBasedSampler(rate)that hashes the installation IDtracesSamplerNote: Consider proposing a cross-SDK spec at develop.sentry.dev so Cocoa, Java/Android, and Dart/Flutter can follow the same API shape, since all mobile SDKs face the same problem.