.NET API
TraceSpan
Tracon.Abstractions.dllA single persisted OpenTelemetry span.
public sealed record TraceSpan : IEquatable<TraceSpan>- Inheritance
- object ← TraceSpan
- Implements
- IEquatable<TraceSpan>
- Inherited Members
- object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”TraceSpan.Id and TraceSpan.ParentId are derived
from the W3C identifiers, not randomly generated. When a span
completes, its parent may not have completed yet, and the parent’s
database identifier is unknown. Deriving it (trace_id + span_id
→ SHA-256 → first 16 bytes) makes matching work without a map and without
ordering; writing the same span twice also produces the same identifier.
The W3C identifiers are stored separately in the TraceSpan.SpanId field: this is needed so the user can find the same span in their own APM system (Jaeger, Application Insights).
Constructors
Section titled “Constructors”TraceSpan()
Section titled “ TraceSpan()”public TraceSpan()Properties
Section titled “Properties”Attributes
Section titled “ Attributes”The span attributes. GenAI semantic convention keys
(gen_ai.request.model, gen_ai.usage.input_tokens) go here.
public IReadOnlyDictionary<string, string> Attributes { get; init; }Property Value
Section titled “Property Value”IReadOnlyDictionary<string, string>
Duration
Section titled “ Duration”The span’s duration. null if the span has not ended.
[JsonIgnore]public TimeSpan? Duration { get; }Property Value
Section titled “Property Value”EndedAt
Section titled “ EndedAt”The end time (UTC).
public DateTimeOffset? EndedAt { get; init; }Property Value
Section titled “Property Value”The database identifier. Derived from the W3C identifiers.
public required Guid Id { get; init; }Property Value
Section titled “Property Value”The span kind.
public TraceSpanKind Kind { get; init; }Property Value
Section titled “Property Value”The span name. Example: chat gpt-5.4-mini, invoke_agent support.
public required string Name { get; init; }Property Value
Section titled “Property Value”ParentId
Section titled “ ParentId”The parent span’s database identifier. null for the root span.
public Guid? ParentId { get; init; }Property Value
Section titled “Property Value”Guid?
SpanId
Section titled “ SpanId”The W3C span identifier (16-character hex).
public required string SpanId { get; init; }Property Value
Section titled “Property Value”StartedAt
Section titled “ StartedAt”The start time (UTC).
public required DateTimeOffset StartedAt { get; init; }Property Value
Section titled “Property Value”Status
Section titled “ Status”The result status.
public TraceSpanStatus Status { get; init; }Property Value
Section titled “Property Value”Methods
Section titled “Methods”Equals(object?)
Section titled “ Equals(object?)”public override bool Equals(object? obj)Parameters
Section titled “Parameters”obj object?
Returns
Section titled “Returns”Equals(TraceSpan?)
Section titled “ Equals(TraceSpan?)”public bool Equals(TraceSpan? other)Parameters
Section titled “Parameters”other TraceSpan?
Returns
Section titled “Returns”GetHashCode()
Section titled “ GetHashCode()”public override int GetHashCode()Returns
Section titled “Returns”ToString()
Section titled “ ToString()”public override string ToString()Returns
Section titled “Returns”Operators
Section titled “Operators”operator ==(TraceSpan?, TraceSpan?)
Section titled “ operator ==(TraceSpan?, TraceSpan?)”public static bool operator ==(TraceSpan? left, TraceSpan? right)Parameters
Section titled “Parameters”left TraceSpan?
right TraceSpan?
Returns
Section titled “Returns”operator !=(TraceSpan?, TraceSpan?)
Section titled “ operator !=(TraceSpan?, TraceSpan?)”public static bool operator !=(TraceSpan? left, TraceSpan? right)Parameters
Section titled “Parameters”left TraceSpan?
right TraceSpan?