Skip to content

feat(replays): add replay_id to dynamic sampling context#7493

Closed
JoshFerge wants to merge 3 commits intodevelopfrom
jferg/add-replay_id-to-dsc
Closed

feat(replays): add replay_id to dynamic sampling context#7493
JoshFerge wants to merge 3 commits intodevelopfrom
jferg/add-replay_id-to-dsc

Conversation

@JoshFerge
Copy link
Copy Markdown
Member

Only used for testing // as a reference for what we want to do. need to determine how to do this while preserving tree shaking, etc.

@JoshFerge JoshFerge force-pushed the jferg/add-replay_id-to-dsc branch from 170e040 to 0c5e17a Compare March 16, 2023 18:56
@AbhiPrasad
Copy link
Copy Markdown
Contributor

AbhiPrasad commented Mar 16, 2023

We should do this via hooks:

// Keep on() & emit() signatures in sync with types' client.ts interface

So:

// packages/core/src/tracing/transaction.ts
const client = getCurrentHub().getClient();
client.emit('dscCreate', dsc);

And then in Replay:

// packages/replay/src/integration.ts
const client = getCurrentHub().getClient();
client.on('dscCreate', (dsc) => {
  if (!this._replay || !this._replay.session) {
    return;
  }
  dsc.replay_id = this._replay.session.id;
});

This will mean Replay is treeshaken if not used, and will have minimal bundle size impact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants