Skip to content

Update max. breadcrumb handling on scope #12399

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

Open
Tracked by #14149
mydea opened this issue Jun 7, 2024 · 2 comments
Open
Tracked by #14149

Update max. breadcrumb handling on scope #12399

mydea opened this issue Jun 7, 2024 · 2 comments

Comments

@mydea
Copy link
Member

mydea commented Jun 7, 2024

Today, we have a maxBreadcrumbs option on the client. However, due to the way when/how scopes are created (=before the client), plus the fact that a scope may not have a client directly attached to it, we have currently implemented it in a way that we always pass maxBreadcrumbs as a second argument to scope.addBreadcrumb(breadcrumb, maxBreadcrumbs).

This is kind of weird for multiple reasons (it's already weird to have this argument on that API), but especially because you can change the max. size with each addBreadcrumb() call, which is not really ergonomic.

Additionally, it may make sense and be more performant to rewrite this to use a ringbuffer instead - today, we keep cloning the breadcrumbs array every time once you hit the max. breadcrumbs threshold. However, using a ringbuffer with the current implementation is tricky because the size is technically dynamic and handling this becomes quite cumbersome and adds a decent amount of bundle size.

We should revisit if we can find a way to handle this better in the future.

@timfish
Copy link
Collaborator

timfish commented Jun 7, 2024

Additionally there is the issue that it's currently max breadcrumbs per scope.

With current, isolation and global scopes merged, potentially you could end up sending maxBreadcrumbs * 3

@mydea
Copy link
Member Author

mydea commented Jun 10, 2024

Yeah, that too! I think this is "OK", as we generally mostly will have breadcrumbs on the isolation scope only (unless a user really manually adds breadcrumbs somewhere else, and even then, there is still an upper limit).

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

No branches or pull requests

3 participants