(event: Event)
| 114 | } |
| 115 | |
| 116 | function 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. |
no test coverage detected