Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Turbopack] use thread local trace collecting (#73615)
### What? Collect trace events in a thread local buffer first and then send a batch of events to the writer thread. But there are some challenges to that: Events might be out of order in the trace file. Usually that should be fine since they have a timestamp, but * span ids might be reused faster than all events are send to the file. So we assign our own globally unique ids instead. * the trace server need to be able to process events out of order. So we queue up events when they are received for spans that are not created yet. And the thread local buffer might also have a problem when the thread is idle or hanging. This would cause events to never be written to the file. To fix that the writer thread will steal the outstanding events from the thread local buffers when it is idle for a second. This ensures that all events are eventually written, even in case of hanging threads.
- Loading branch information