Skip to content

Conversation

AbhiPrasad
Copy link
Member

@AbhiPrasad AbhiPrasad commented Sep 8, 2025

@AbhiPrasad AbhiPrasad requested a review from a team September 8, 2025 16:30
@AbhiPrasad AbhiPrasad self-assigned this Sep 8, 2025
@AbhiPrasad AbhiPrasad requested review from Lms24 and RulaKhaled and removed request for a team September 8, 2025 16:30
Copy link

linear bot commented Sep 8, 2025

@@ -150,6 +151,9 @@ export function _INTERNAL_captureLog(
setLogAttribute(processedLogAttributes, 'sentry.sdk.name', name);
setLogAttribute(processedLogAttributes, 'sentry.sdk.version', version);

const replay = client.getIntegrationByName<Integration & { getReplayId: () => string }>('Replay');
setLogAttribute(processedLogAttributes, 'sentry.replay_id', replay?.getReplayId());
Copy link

Choose a reason for hiding this comment

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

Bug: Optional Chaining Fails When Method Undefined

The optional chaining replay?.getReplayId() only checks if replay exists. If replay is present but getReplayId is undefined, calling it will throw a runtime TypeError, potentially disrupting log capturing.

Fix in Cursor Fix in Web

Copy link
Contributor

github-actions bot commented Sep 8, 2025

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 8,734 - 8,866 -1%
GET With Sentry 1,326 15% 1,225 +8%
GET With Sentry (error only) 5,811 67% 5,732 +1%
POST Baseline 1,194 - 1,130 +6%
POST With Sentry 457 38% 460 -1%
POST With Sentry (error only) 1,031 86% 994 +4%
MYSQL Baseline 3,292 - 3,259 +1%
MYSQL With Sentry 431 13% 398 +8%
MYSQL With Sentry (error only) 2,658 81% 2,676 -1%

View base workflow run

@AbhiPrasad AbhiPrasad enabled auto-merge (squash) September 8, 2025 17:52
@AbhiPrasad AbhiPrasad merged commit f3f0ba3 into develop Sep 8, 2025
518 of 550 checks passed
@AbhiPrasad AbhiPrasad deleted the abhi-replay-id-in-logs branch September 8, 2025 19:20
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.

Add sentry.replay_id attribute to JavaScript SDK logs
2 participants