Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This removes the fixed sizeEventBuffer
and replaces it with standardVec
.Testing has shown that even under very heavy load the buffer size never grows above 1200 spans or so which is fine IMO.This also adds a periodic timer (40secs with the default config) to resize the internal buffers so acquired capacity will eventually be released.The two downsides are that if you leave your app running for a long time without connecting the devtools the internal buffers will grow unbounded and that clients attaching after one has already been attached will loose all previous events.After more testing and weighing the options I decided it makes more sense to just increase the limit for the fixed-size
EventBuffer
structs to be fitted better.The reasons are:
Vec
will consume unbounded memory. I expect this to happen a lot as commenting out the instrumentation code is very annoying and users will probably only open the client when they actually need itAlternatives
Originally I had considered adjusting the publish interval based on some metric so that it would be reduced the fuller the internal buffers get. However, due to the way the tokio::mpsc channel works this wouldn't really adjust the timing by much anyway and just add extra complexity
Alternatively we can just increase the bounds of the fixed size buffers (from my testing increasing thethis is the approach nowspans
size from512
to2048
would be enough) but that might be a bit fragile