@accordkit/tracer - v0.2.1
    Preparing search index...

    Class HttpSink

    HttpSink Buffered POST of JSONL batches to a single endpoint.

    Guarantees:

    • No overlapping flushes (guarded).
    • Deterministic shutdown (close() drains).
    • Full drain with awaited I/O, chunked by batchSize.
    • Per-batch retry with cap; after exhaustion, drop only that batch and continue.
    • Auto-flush on capacity; backpressure only while over capacity (buffered).
    • Retry policy refined: shouldRetry() + Retry-After for 429/503 + 413 downshift.

    Implements

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Persist a single event for a session.

      Parameters

      • sessionId: string

        Unique identifier for grouping related events. Used for partitioning and log file naming.

      • e: TracerEvent

        The trace event to persist. See TracerEvent for structure.

      Returns void | Promise<void>

      Void or Promise for async implementations.

      Implementations should:

      • Handle errors gracefully without throwing
      • Consider batching for performance if needed
      • Maintain order of events within a session
      • Be thread-safe if used in concurrent environments
    • Flush any buffered events to the underlying storage.

      Returns Promise<void>

      Promise that resolves when all buffered events are persisted

    • Optional cleanup method for releasing resources.

      Returns Promise<void>

      Promise that resolves when cleanup is complete

      Implementations should:

      • Flush any remaining buffered events
      • Close network connections or file handles
      • Release any other held resources