Package 

Interface StreamTelemetryScope


  • 
    public interface StreamTelemetryScope
    
                        

    A named channel that groups related signals.

    Scopes are created via StreamTelemetry.scope. Each scope maintains its own memory buffer and optional disk spill. Signals flow in via emit and out via drain.

    All operations are thread-safe. emit never blocks or suspends.

    val scope = telemetry.scope("connection")
    scope.emit("connected", connectionId)
    scope.emit("disconnected", null)
    
    // Later, when ready to send
    val signals: List<StreamSignal> = scope.drain()
    • Method Summary

      Modifier and Type Method Description
      abstract Result<Unit> emit(String tag, String data) Records a signal into this scope.
      abstract Result<List<StreamSignal>> drain() Atomically consumes all buffered signals, including any that were spilled to disk.
      abstract String getName() The name of this scope (e.g.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • emit

         abstract Result<Unit> emit(String tag, String data)

        Records a signal into this scope.

        The StreamSignalRedactor (if configured) runs synchronously before the signal is buffered. If the redactor returns null, the signal is dropped and not buffered.

        Parameters:
        tag - Identifies what happened.
        data - Optional pre-serialized payload.
      • drain

         abstract Result<List<StreamSignal>> drain()

        Atomically consumes all buffered signals, including any that were spilled to disk.

        After this call, the scope's buffer is empty. Disk-spilled signals are read first (oldest), followed by in-memory signals (newest), preserving FIFO order.

        Disk reads run on Dispatchers.IO.

      • getName

         abstract String getName()

        The name of this scope (e.g. "connection", "sfu", "network").