Commit 6aee916
committed
Fix metric loss: drain exportQueue before cancelling workers in close()
flushSync() only flushes agg.batch, but flushUnlocked() (triggered by
terminal ops like CLOSE_STATEMENT) moves batch items into agg.exportQueue
for async worker processing. When agg.close() called cancel() immediately
after flushSync(), those queue items were silently dropped because workers
exited before picking them up — causing EXECUTE_STATEMENT and
CLOSE_STATEMENT metrics to never reach the telemetry endpoint.
Fix: drain the exportQueue synchronously between flushSync and cancel,
processing any pending export jobs directly before workers stop.
Co-authored-by: Isaac1 parent 242fad2 commit 6aee916
1 file changed
Lines changed: 24 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
284 | 287 | | |
285 | 288 | | |
286 | | - | |
287 | | - | |
288 | | - | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
289 | 306 | | |
290 | 307 | | |
291 | 308 | | |
| |||
0 commit comments