fix(metrics, logs): Ensure TelemetryBuffer uses own thread for both size based and periodic flushing - #3084
Conversation
There was a problem hiding this comment.
reviewing this with whitespace off recommended
8d91cd4 to
0c02d20
Compare
| end | ||
| end | ||
|
|
||
| it "does not conflict with the Sentry logger patch" do |
There was a problem hiding this comment.
moved this here to avoid logger patch leaking into the other test
solnic
left a comment
There was a problem hiding this comment.
I honestly think that at this point we'd be better off using concurrent-ruby's primitives for this stuff, we already depend on that gem anyway.
f1fbf92 to
f875712
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f875712. Configure here.
11050f1 to
0df4484
Compare
5a47e10 to
a34cdba
Compare
|
ran sol pro on this for deadlock analysis |
90e51ff to
9c5eca4
Compare
9c5eca4 to
5756aa8
Compare
…o that both periodic and size based flushing happen on the buffer thread
5756aa8 to
dc48278
Compare

Before this change, the
add_itemtriggered size based flush on the caller thread which is absolutely incorrect behavior.Changes to
ThreadedPeriodicWorker:@thread_mutexfor syncing its own internal state@wake_conditionthat is used forwakeing the thread from outside (like size based flushing) - otherwise defaults to theintervalwhich makes it backwards compatible@idle_conditionused for the finalflushthat needs to wait for any running task to finishwakeandwait_for_idleThese are then used in
TelemetryEventBuffer:runandflushare now two different methods, both run on the buffer threadflushwaits for a max 2 seconds timeout otherwise returns because we don't want to block too longIssues