@@ -372,10 +372,9 @@ export const makeTraceSink = Effect.fn("makeTraceSink")(function* (options: Trac
372372 } ) ;
373373
374374 let buffer : Array < string > = [ ] ;
375- // Failure episode state. The latest write result says if the disk is
376- // failing. Flush checks it once per window, so a disk that fails and
377- // recovers more than once inside one window stays one episode. Records lost
378- // since the episode started are counted until a flush sees a good write.
375+ // A failure episode starts at the first dropped record and ends when a flush
376+ // sees that the latest write succeeded. Flush checks once per window, so a
377+ // disk that flaps inside one window stays one episode.
379378 let writeFailing = false ;
380379 let droppedCount = 0 ;
381380 let failureReported = false ;
@@ -432,11 +431,8 @@ export const makeTraceSink = Effect.fn("makeTraceSink")(function* (options: Trac
432431 }
433432 } ;
434433
435- // Logs only when writes start failing and when they recover, so a disk that
436- // stays broken costs one line, not one per flush. It drops the parent span:
437- // the timed fiber inherits the makeTraceSink span, which has ended but stays
438- // referenced for the life of the sink, and the tracer logger would add every
439- // log to it as an event.
434+ // Logs once when writes start failing and once when they recover, so a disk
435+ // that stays broken costs one line, not one per flush.
440436 const flush = Effect . gen ( function * ( ) {
441437 flushUnsafe ( ) ;
442438 const stats = pendingFlushStats ;
@@ -464,9 +460,9 @@ export const makeTraceSink = Effect.fn("makeTraceSink")(function* (options: Trac
464460 }
465461 } ) . pipe (
466462 Effect . withTracerEnabled ( false ) ,
467- Effect . updateContext ( ( context : Context . Context < never > ) =>
468- Context . omit ( Tracer . ParentSpan ) ( context ) ,
469- ) ,
463+ // The timed fiber inherits the makeTraceSink span. That span has ended but
464+ // lives as long as the sink, so the tracer logger must not add logs to it.
465+ Effect . updateContext ( Context . omit ( Tracer . ParentSpan ) < never > ) ,
470466 ) ;
471467
472468 yield * Effect . addFinalizer ( ( ) => flush . pipe ( Effect . ignore ) ) ;
0 commit comments