Skip to content

ITraceStore

Namespace AgentPrism · Assembly AgentPrism.Abstractions.dll

The store for persisted spans.

public interface ITraceStore

An error from this store does not stop the run. Observability must not break functionality; the caller (RunTraceCollector) catches and logs errors.

The write path is sampled. Writing every span would bottleneck the database at high volume; the sampling decision belongs to the caller (AgentPrismObservabilityOptions), not the store.

GetTraceByRunAsync(Guid, CancellationToken)

Section titled “ GetTraceByRunAsync(Guid, CancellationToken)”

Fetches a run’s span tree.

ValueTask<RunTrace?> GetTraceByRunAsync(Guid runId, CancellationToken cancellationToken = default)

runId Guid

The run identifier.

cancellationToken CancellationToken

The cancellation token.

ValueTask<RunTrace?>

The trace; null if no record exists.

WriteSpansAsync(TraceSpanBatch, CancellationToken)

Section titled “ WriteSpansAsync(TraceSpanBatch, CancellationToken)”

Writes a trace’s spans. Can be called multiple times for the same trace; spans are merged by identifier.

ValueTask WriteSpansAsync(TraceSpanBatch batch, CancellationToken cancellationToken = default)

batch TraceSpanBatch

The span set to write.

cancellationToken CancellationToken

The cancellation token.

ValueTask

The completion task.