Skip to content

ref(replay): Move earliest timestamp tracking to eventBuffer #7983

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
Apr 28, 2023

Conversation

mydea
Copy link
Member

@mydea mydea commented Apr 27, 2023

In preparation to allow us to handle this better for buffering sessions. IMHO the event buffer should "know" about this, and we load it on-demand from there.

Extracted this out from #7025

@mydea mydea added the Package: replay Issues related to the Sentry Replay SDK label Apr 27, 2023
@mydea mydea requested a review from billyvg April 27, 2023 11:55
@mydea mydea self-assigned this Apr 27, 2023
const _context = {
initialTimestamp: this._context.initialTimestamp,
initialUrl: this._context.initialUrl,
errorIds: Array.from(this._context.errorIds).filter(Boolean),
Copy link
Member Author

Choose a reason for hiding this comment

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

Noticed these here, we actually check if the ids are non-empty before adding them to the set, so IMHO we do not need these checks anymore.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 27, 2023

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 21.03 KB (-0.01% 🔽)
@sentry/browser - ES5 CDN Bundle (minified) 65.66 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 19.56 KB (-0.01% 🔽)
@sentry/browser - ES6 CDN Bundle (minified) 58.12 KB (0%)
@sentry/browser - Webpack (gzipped + minified) 21.17 KB (0%)
@sentry/browser - Webpack (minified) 69.07 KB (0%)
@sentry/react - Webpack (gzipped + minified) 21.19 KB (-0.01% 🔽)
@sentry/nextjs Client - Webpack (gzipped + minified) 49.03 KB (0%)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 28.59 KB (-0.01% 🔽)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 26.82 KB (-0.01% 🔽)
@sentry/replay ES6 CDN Bundle (gzipped + minified) 46.88 KB (+0.15% 🔺)
@sentry/replay - Webpack (gzipped + minified) 40.67 KB (+0.2% 🔺)
@sentry/browser + @sentry/tracing + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 65.68 KB (+0.11% 🔺)
@sentry/browser + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 58.65 KB (+0.14% 🔺)

In preparation to allow us to handle this better for buffering sessions.
@mydea mydea force-pushed the fn/improve-buffer-handling branch from 7774612 to af01fbe Compare April 27, 2023 12:25
Comment on lines +52 to +56
const timestamp = timestampToMs(event.timestamp);
if (!this._earliestTimestamp || timestamp < this._earliestTimestamp) {
this._earliestTimestamp = timestamp;
}

Copy link
Member

Choose a reason for hiding this comment

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

Why not do the same thing in array buffer?

Copy link
Member Author

Choose a reason for hiding this comment

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

My thought was that we write this much more often than we read it (we really only read it on the first checkout), so felt it would be more efficient to do work only at read time then?

@mydea mydea merged commit 646b54d into develop Apr 28, 2023
@mydea mydea deleted the fn/improve-buffer-handling branch April 28, 2023 11:36
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