Skip to content
Tracon

ITraceStore

Namespace Tracon · Assembly Tracon.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 (TraconObservabilityOptions), not the store.

Tenant behavior is not uniform across this interface’s methods. ITraceStore.WriteSpansAsync is EXPECTED tenant: it reads TraceSpanBatch.TenantId, never the ambient tenant, for the same reason IRunStore.AppendEventAsync does — the writing thread may not belong to the trace’s own tenant. ITraceStore.GetTraceByRunAsync is AMBIENT tenant: it takes no explicit tenant parameter and filters by the current ITenantContext internally.

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.