MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / getTraceId

Function getTraceId

packages/browser/src/profiling/utils.ts:116–131  ·  view source on GitHub ↗
(event: Event)

Source from the content-addressed store, hash-verified

114}
115
116function getTraceId(event: Event): string {
117 const traceId: unknown = event.contexts?.trace?.trace_id;
118 // Log a warning if the profile has an invalid traceId (should be uuidv4).
119 // All profiles and transactions are rejected if this is the case and we want to
120 // warn users that this is happening if they enable debug flag
121 if (typeof traceId === 'string' && traceId.length !== 32) {
122 if (DEBUG_BUILD) {
123 debug.log(`[Profiling] Invalid traceId: ${traceId} on profiled event`);
124 }
125 }
126 if (typeof traceId !== 'string') {
127 return '';
128 }
129
130 return traceId;
131}
132/**
133 * Creates a profiling event envelope from a Sentry event. If profile does not pass
134 * validation, returns null.

Callers 1

createProfilePayloadFunction · 0.85

Calls 1

logMethod · 0.65

Tested by

no test coverage detected