豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

fix(core): route replay events in multiplexed transport#20408

Open
logaretm wants to merge 2 commits intodevelopfrom
awad/js-2199-session-replays-not-routing-to-dedicated-dsn-when-using
Open

fix(core): route replay events in multiplexed transport#20408
logaretm wants to merge 2 commits intodevelopfrom
awad/js-2199-session-replays-not-routing-to-dedicated-dsn-when-using

Conversation

@logaretm
Copy link
Copy Markdown
Member

This PR adds replay_event to the multiplex router matcher events so it can match against replay events, previously it used the plain getEvent() which defaulted to just event envelopes.

Closes #20346

Co-Authored-By: GPT-5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 20, 2026 16:27
@linear-code
Copy link
Copy Markdown

linear-code bot commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for routing Replay envelope events through the multiplexed transport’s default matcher so replay events can be multiplexed based on routing info in event.extra.

Changes:

  • Update the default multiplexed transport matcher to consider replay_event envelope items when extracting an event.
  • Add a core transport test ensuring replay_event envelopes are routed to DSNs provided via event.extra[MULTIPLEXED_TRANSPORT_EXTRA_KEY].

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/core/src/transports/multiplexed.ts Extends default matcher to extract events from replay_event items (in addition to event).
packages/core/test/lib/transports/multiplexed.test.ts Adds coverage verifying default-matcher routing works for replay events using the extra routing key.
Comments suppressed due to low confidence (1)

packages/core/src/transports/multiplexed.ts:109

  • The default matcher now explicitly fetches only ['event', 'replay_event']. This means routing via extra[MULTIPLEXED_TRANSPORT_EXTRA_KEY] still won’t apply to transaction or profile envelope items. If the intent is to support routing for all event-like envelope types (similar to makeOverrideReleaseTransport, which includes transaction/profile/replay_event), consider expanding this list; otherwise it may be worth clarifying in docs/tests that the default matcher intentionally excludes them.
      (args => {
        const event = args.getEvent(['event', 'replay_event']);
        if (
          event?.extra?.[MULTIPLEXED_TRANSPORT_EXTRA_KEY] &&
          Array.isArray(event.extra[MULTIPLEXED_TRANSPORT_EXTRA_KEY])
        ) {

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +339 to +349
const envelope = createEnvelope<EventEnvelope>({ event_id: 'aa3ff046696b4bc6b609ce6d28fde9e2', sent_at: '123' }, [
[
{ type: 'replay_event' },
{
...REPLAY_EVENT,
extra: {
[MULTIPLEXED_TRANSPORT_EXTRA_KEY]: [DSN1, DSN2],
},
},
] as EventItem,
]);
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test creates a replay_event envelope item but asserts it as EventEnvelope / EventItem. Using the wrong envelope/item types in tests can hide real shape differences for replay envelopes. Consider typing the envelope/item as a generic Envelope/EnvelopeItem (or ReplayEnvelope if you include the full replay envelope structure) instead of asserting EventItem.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 20, 2026

size-limit report 📦

Path Size % Change Change
@sentry/browser 25.88 kB - -
@sentry/browser - with treeshaking flags 24.35 kB - -
@sentry/browser (incl. Tracing) 43.81 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 45.5 kB - -
@sentry/browser (incl. Tracing, Profiling) 48.73 kB - -
@sentry/browser (incl. Tracing, Replay) 82.98 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 72.5 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 87.67 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 99.93 kB - -
@sentry/browser (incl. Feedback) 42.7 kB - -
@sentry/browser (incl. sendFeedback) 30.55 kB - -
@sentry/browser (incl. FeedbackAsync) 35.55 kB - -
@sentry/browser (incl. Metrics) 27.16 kB - -
@sentry/browser (incl. Logs) 27.29 kB - -
@sentry/browser (incl. Metrics & Logs) 27.98 kB - -
@sentry/react 27.62 kB - -
@sentry/react (incl. Tracing) 46.05 kB - -
@sentry/vue 30.71 kB - -
@sentry/vue (incl. Tracing) 45.62 kB - -
@sentry/svelte 25.89 kB - -
CDN Bundle 28.55 kB - -
CDN Bundle (incl. Tracing) 44.94 kB - -
CDN Bundle (incl. Logs, Metrics) 29.93 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 46.03 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 68.89 kB - -
CDN Bundle (incl. Tracing, Replay) 81.96 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 83.03 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 87.46 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 88.55 kB - -
CDN Bundle - uncompressed 83.4 kB - -
CDN Bundle (incl. Tracing) - uncompressed 134.3 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 87.55 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 137.72 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 211.12 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 251.75 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 255.14 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 264.66 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 268.05 kB - -
@sentry/nextjs (client) 48.58 kB - -
@sentry/sveltekit (client) 44.22 kB - -
@sentry/node-core 58.02 kB +0.01% +5 B 🔺
@sentry/node 174.89 kB +0.01% +5 B 🔺
@sentry/node - without tracing 97.97 kB +0.01% +9 B 🔺
@sentry/aws-serverless 115.21 kB +0.02% +17 B 🔺

View base workflow run

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

Session replays not routing to dedicated DSN when using makeMultiplexedTransport

2 participants