Skip to content

Commit 170e040

Browse files
committed
feat(replays): add replays to dsc
1 parent 4582d56 commit 170e040

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

packages/replay/src/integration.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,14 @@ Sentry.init({ replaysOnErrorSampleRate: ${errorSampleRate} })`,
226226
return this._replay.flushImmediate();
227227
}
228228

229+
/** returns the current replayId if there is an existing session */
230+
public getCurrentReplayId(): string | undefined {
231+
if (!this._replay || !this._replay.session) {
232+
return;
233+
}
234+
return this._replay.session.id;
235+
}
236+
229237
/** Setup the integration. */
230238
private _setup(): void {
231239
// Client is not available in constructor, so we need to wait until setupOnce

packages/tracing/src/transaction.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,10 @@ export class Transaction extends SpanClass implements TransactionInterface {
258258
const source = this.metadata.source;
259259

260260
const replay = client.getIntegration(Replay);
261-
262-
console.log(replay);
263-
// @ts-ignore
264-
const replayId = replay?._replay.session.id;
261+
let replay_id;
262+
if (replay) {
263+
replay_id = replay.getCurrentReplayId();
264+
}
265265

266266
// We don't want to have a transaction name in the DSC if the source is "url" because URLs might contain PII
267267
const transaction = source && source !== 'url' ? this.name : undefined;
@@ -274,7 +274,7 @@ export class Transaction extends SpanClass implements TransactionInterface {
274274
public_key,
275275
trace_id: this.traceId,
276276
sample_rate,
277-
replayId,
277+
replay_id,
278278
});
279279

280280
// Uncomment if we want to make DSC immutable

0 commit comments

Comments
 (0)