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
capacityint
Properties
Capacity
Maximum number of envelopes the ring retains.
public int Capacity { get; }
Property Value
Count
Total envelopes currently retained in the ring.
public int Count { get; }
Property Value
Methods
Append(OtlpEnvelope)
Add an envelope to the ring and notify every subscriber.
public void Append(OtlpEnvelope envelope)
Parameters
envelopeOtlpEnvelope
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
kindOtlpSignalKind
Returns
Snapshot()
Returns a snapshot copy of every envelope currently retained.
public IReadOnlyList<OtlpEnvelope> Snapshot()
Returns
Snapshot(OtlpSignalKind)
Returns the snapshot filtered to a single signal kind.
public IReadOnlyList<OtlpEnvelope> Snapshot(OtlpSignalKind kind)
Parameters
kindOtlpSignalKind
Returns
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
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.