-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/react-native
SDK Version
10.15.0
Framework Version
@sentry/react-native": "7.2.0"
Link to Sentry event
No response
Reproduction Example/SDK Setup
Sentry.init({
dsn: SENTRY_DSN,
environment:
__DEV__ || process.env.E2E_MODE === 'true' ? 'development' : 'production',
release,
dist,
// Keep disabled to avoid attaching stacktraces to non-exception events (can affect event titles in UI).
attachStacktrace: false,
// Generic targets (no company/app domains).
tracePropagationTargets: ['localhost'],
// Keep the same behavior as the original wrapper.
tracesSampleRate: 1,
integrations: [
routingInstrumentation,
Sentry.hermesProfilingIntegration?.({ platformProfilers: false }),
Sentry.breadcrumbsIntegration?.({
dom: false,
fetch: false,
history: false,
sentry: false,
xhr: false,
console: false,
}),
Sentry.reactNativeTracingIntegration?.({ idleTimeoutMs: 1500 }),
].filter(Boolean),
// denyUrls: [...],
// ignoreErrors: [...],
// beforeSend: (event) => event,
// beforeSendTransaction: (tx) => tx,
// tracesSampler: (ctx) => 0.1,
// maxBreadcrumbs: 50,
});
// Initial config needs to be done after Sentry.init is called.
setSentryConfig({
tracesSampleRate: baseTransactionSampleRate,
tracesSampleRateByName: {
// Low importance transactions (generic example).
'GET /example/low-importance-endpoint': baseTransactionSampleRate / 2,
},
sessionRateLimit: {
maxDuplicatedEvents: process.env.E2E_MODE === 'true' || __DEV__ ? 1 : 10,
totalMaxEvents: process.env.E2E_MODE === 'true' || __DEV__ ? 10 : 5_000,
},
identification: {
domain: 'example.com',
},
});
Steps to Reproduce
Making request in the app, found
node_modules/@sentry/core/build/esm/utils/tracing.js
/**
* Create sentry-trace header from span context values.
*/
function generateSentryTraceHeader(
traceId = generateTraceId(),
spanId = generateSpanId(),
sampled,
) {
let sampledString = '';
if (sampled !== undefined) {
sampledString = sampled ? '-1' : '-0';
}
return `${traceId}-${spanId}${sampledString}`;
}
function generateTraceparentHeader(
traceId = generateTraceId(),
spanId = generateSpanId(),
sampled,
) {
return `00-${traceId}-${spanId}-${sampled ? '01' : '00'}`;
}
the generateTraceId and generateSpanId because are there as default the are being executed always, no matter if you call the function passing values.
Expected Result
calling the function generateSentryTraceHeader and generateTraceparentHeader, shouldn't generate extra calls to getRandomValues when generating a uuid4
Actual Result
calling the function generateSentryTraceHeader and generateTraceparentHeader, generate more than 90 calls to the getRandomValues to generate the uuid4
Additional Context
No response
Priority
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.
Metadata
Metadata
Assignees
Projects
Status