Skip to content

Commit 718be4f

Browse files
committed
change envelope typing
1 parent 3c6ed94 commit 718be4f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/browser/src/profiling/session/traceLifecycleProfiler.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
type ProfileChunkEnvelope,
44
createEnvelope,
55
debug,
6+
dsnToString,
67
getRootSpan,
78
getSdkMetadataForEnvelopeHeader,
89
spanToJSON,
@@ -237,16 +238,20 @@ export class BrowserTraceLifecycleProfiler {
237238
private _sendProfileChunk(chunk: ProfileChunk): void {
238239
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
239240
const client = this._client!;
241+
240242
const sdkInfo = getSdkMetadataForEnvelopeHeader(client.getSdkMetadata?.());
243+
const dsn = client.getDsn();
244+
const tunnel = client.getOptions().tunnel;
241245

242-
const envelope: ProfileChunkEnvelope = createEnvelope(
246+
const envelope = createEnvelope<ProfileChunkEnvelope>(
243247
{
244248
event_id: uuid4(),
245249
sent_at: new Date().toISOString(),
246250
...(sdkInfo && { sdk: sdkInfo }),
251+
...(!!tunnel && dsn && { dsn: dsnToString(dsn) }),
247252
},
248253
[[{ type: 'profile_chunk' }, chunk]],
249-
) as ProfileChunkEnvelope;
254+
);
250255

251256
client.sendEnvelope(envelope).then(null, reason => {
252257
DEBUG_BUILD && debug.error('Error while sending profile chunk envelope:', reason);

0 commit comments

Comments
 (0)