Skip to content

fix(replay): Improve capture of errorIds/traceIds #8678

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 1, 2023

Conversation

mydea
Copy link
Member

@mydea mydea commented Jul 31, 2023

We limit to max. 100 IDs being captured per replay, and ensure we do not capture stuff when replay has been disabled in the meanwhile.

Since our handlers are (sadly) all global, I guess it may have been possible for something "bad" to happen when replay has been disabled in the meanwhile 🤔

ref https://github.com/getsentry/team-replay/issues/131
ref #8672

@mydea mydea added the Package: replay Issues related to the Sentry Replay SDK label Jul 31, 2023
@mydea mydea requested a review from billyvg July 31, 2023 11:31
@mydea mydea self-assigned this Jul 31, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jul 31, 2023

size-limit report 📦

Path Size
@sentry/browser (incl. Tracing, Replay) - Webpack (gzipped) 75.09 KB (+0.03% 🔺)
@sentry/browser (incl. Tracing) - Webpack (gzipped) 31.4 KB (0%)
@sentry/browser - Webpack (gzipped) 21.95 KB (0%)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (gzipped) 69.82 KB (+0.05% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (gzipped) 28.28 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped) 20.33 KB (-0.01% 🔽)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (minified & uncompressed) 221.03 KB (+0.07% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (minified & uncompressed) 85.99 KB (0%)
@sentry/browser - ES6 CDN Bundle (minified & uncompressed) 60.48 KB (0%)
@sentry/browser (incl. Tracing) - ES5 CDN Bundle (gzipped) 30.41 KB (+0.01% 🔺)
@sentry/react (incl. Tracing, Replay) - Webpack (gzipped) 65.16 KB (+0.04% 🔺)
@sentry/react - Webpack (gzipped) 21.96 KB (0%)
@sentry/nextjs Client (incl. Tracing, Replay) - Webpack (gzipped) 92.93 KB (+0.03% 🔺)
@sentry/nextjs Client - Webpack (gzipped) 50.89 KB (0%)

@mydea mydea force-pushed the fn/limit-replay-errors branch from eae9ae5 to 8031e7f Compare July 31, 2023 13:04
We limit to max. 100 IDs being captured per replay, and ensure we do not capture stuff when replay has been disabled in the meanwhile.
@mydea mydea force-pushed the fn/limit-replay-errors branch from 8031e7f to 3aa5c07 Compare July 31, 2023 13:33
// In error mode, _context gets cleared on every checkout
// We limit to max. 100 transactions linked
if (event.contexts && event.contexts.trace && event.contexts.trace.trace_id && replayContext.traceIds.size < 100) {
replayContext.traceIds.add(event.contexts.trace.trace_id as string);
Copy link
Member

Choose a reason for hiding this comment

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

This is good for now, but was thinking in general, how can we communicate the behavior to customers?

Maybe a "custom" breadcrumb? I think I want to document our recording "protocol" a bit with all the different breadcrumb types we have.

Copy link
Member Author

Choose a reason for hiding this comment

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

IMHO the "real" solution to this is to stop using this at all and make the connection on the backend, e.g. update the errorIds server side in a job after the replay is completed or similar 🤔

@billyvg
Copy link
Member

billyvg commented Jul 31, 2023

We should generally only ever hit this max for buffered replays right?

@mydea
Copy link
Member Author

mydea commented Aug 1, 2023

We should generally only ever hit this max for buffered replays right?

Realistically yes, I'd say!

@mydea mydea merged commit f760e6c into develop Aug 1, 2023
@mydea mydea deleted the fn/limit-replay-errors branch August 1, 2023 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: replay Issues related to the Sentry Replay SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants