Class OtlpEnvelopeStore

Namespace
Kuestenlogik.Bowire.Protocol.Otlp
Assembly
Kuestenlogik.Bowire.Protocol.Otlp.dll

In-memory ring buffer of received OTLP envelopes plus a fan-out publish/subscribe channel.

public sealed class OtlpEnvelopeStore
Inheritance
OtlpEnvelopeStore
Inherited Members

Remarks

Phase 1 keeps the bound deliberately small (1024 envelopes) — the workbench's channel UX surfaces the latest envelopes and operators who want full retention should point their exporters at a proper collector. Phase 2 may grow the bound + add disk spill, but the passive-listener-for-debugging story stays in-memory.

The store is registered as a singleton so every POST /v1/* request and every BowireOtlpProtocol subscriber sees the same envelopes. Subscribers receive only envelopes published after they subscribe — late subscribers can call Snapshot() first to read what's already in the ring.

Constructors

OtlpEnvelopeStore()

public OtlpEnvelopeStore()

OtlpEnvelopeStore(int)

public OtlpEnvelopeStore(int capacity)

Parameters

capacity int

Properties

Capacity

Maximum number of envelopes the ring retains.

public int Capacity { get; }

Property Value

int

Count

Total envelopes currently retained in the ring.

public int Count { get; }

Property Value

int

Methods

Append(OtlpEnvelope)

Add an envelope to the ring and notify every subscriber.

public void Append(OtlpEnvelope envelope)

Parameters

envelope OtlpEnvelope

Clear()

Reset the ring (test helper). Subscribers stay attached and continue receiving new envelopes.

public void Clear()

Latest(OtlpSignalKind)

Returns the most recently appended envelope of the given kind, or null when none retained.

public OtlpEnvelope? Latest(OtlpSignalKind kind)

Parameters

kind OtlpSignalKind

Returns

OtlpEnvelope

Snapshot()

Returns a snapshot copy of every envelope currently retained.

public IReadOnlyList<OtlpEnvelope> Snapshot()

Returns

IReadOnlyList<OtlpEnvelope>

Snapshot(OtlpSignalKind)

Returns the snapshot filtered to a single signal kind.

public IReadOnlyList<OtlpEnvelope> Snapshot(OtlpSignalKind kind)

Parameters

kind OtlpSignalKind

Returns

IReadOnlyList<OtlpEnvelope>

SubscribeAsync(CancellationToken)

Subscribe to incoming envelopes. The returned reader yields every envelope published after the subscription begins.

public IAsyncEnumerable<OtlpEnvelope> SubscribeAsync(CancellationToken ct = default)

Parameters

ct CancellationToken

Returns

IAsyncEnumerable<OtlpEnvelope>

An IAsyncEnumerable<T> the caller awaits across the lifetime of the subscription. The subscription stays open until the caller cancels via the supplied token.