Description
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.