Check for Sentry span before appending header for WebSocket

Fix CODEOCEAN-FRONTEND-2X
This commit is contained in:
Sebastian Serth
2023-09-07 22:50:14 +02:00
parent aaf1162cf8
commit 6d6851a27a

View File

@ -11,10 +11,12 @@ CodeOceanEditorWebsocket = {
// strip anchor if it is in the url
sockURL.hash = '';
if (span) {
sockURL.searchParams.set('HTTP_SENTRY_TRACE', span.toTraceparent());
const dynamicContext = this.sentryTransaction.getDynamicSamplingContext();
const baggage = SentryUtils.dynamicSamplingContextToSentryBaggageHeader(dynamicContext);
sockURL.searchParams.set('HTTP_BAGGAGE', baggage);
}
return sockURL.toString();
},