emitConnTrace function
void
emitConnTrace(})
Emits one trace event: onto the board (+ sink) and stderr. always
keeps the line alive when the trace is off (the pool-eviction and
dump signals are ops-critical regardless of the knob).
Implementation
void emitConnTrace(
ConnTraceKind kind,
String line, {
int? port,
bool? freshConn,
int? afterMs,
int? connAgeMs,
int? idleTimeoutMs,
bool always = false,
}) {
if (!always && !connTraceEnabled) return;
final event = ConnTraceEvent._(
kind,
line,
port: port,
freshConn: freshConn,
afterMs: afterMs,
connAgeMs: connAgeMs,
idleTimeoutMs: idleTimeoutMs,
);
connTraceEvents.add(event);
if (connTraceEvents.length > _connTraceBoardCap) {
connTraceEvents.removeAt(0);
}
try {
connTraceSink?.call(event);
} on Object {
// A broken consumer must never break the request path.
}
try {
connTraceStderrSink?.call('[conn-trace] $line');
} on Object {
// Same contract for the live stderr surface.
}
}