Table of Contents

Class SpanContext

Namespace
DotCompute.Core.Telemetry.Spans
Assembly
DotCompute.Core.dll

Represents the context and metadata for a single span within a distributed trace. Contains timing information, status, attributes, and hierarchical relationships.

public sealed class SpanContext
Inheritance
SpanContext
Inherited Members

Properties

Activity

Gets or sets the Activity associated with this span. Provides integration with .NET's built-in activity tracing.

public Activity? Activity { get; set; }

Property Value

Activity

The Activity instance or null if not available.

Attributes

Gets or sets the attributes associated with this span. Attributes are key-value pairs providing additional context about the operation.

public Dictionary<string, object?> Attributes { get; init; }

Property Value

Dictionary<string, object>

A dictionary of attribute key-value pairs.

CorrelationId

Gets or sets the correlation identifier for this span. Used for correlating related operations within the trace.

public string CorrelationId { get; set; }

Property Value

string

The correlation identifier as a string.

DeviceId

Gets or sets the identifier of the device where this span executed. Used for tracking operations across different compute devices.

public string DeviceId { get; set; }

Property Value

string

The device identifier as a string.

Duration

Gets or sets the duration of the span. Calculated as the difference between end time and start time.

public TimeSpan Duration { get; set; }

Property Value

TimeSpan

The span duration as a TimeSpan.

EndTime

Gets or sets the timestamp when the span ended. Null if the span is still active.

public DateTimeOffset? EndTime { get; set; }

Property Value

DateTimeOffset?

The end time as a DateTimeOffset or null if not ended.

Events

Gets or sets the events that occurred during this span's lifetime. Events represent point-in-time occurrences within the span.

public IList<SpanEvent> Events { get; init; }

Property Value

IList<SpanEvent>

A list of span events.

ParentSpanId

Gets or sets the identifier of the parent span. Null if this is a root span with no parent.

public string? ParentSpanId { get; set; }

Property Value

string

The parent span identifier as a string or null if root span.

SpanId

Gets or sets the unique span identifier. Used to identify this specific span within the trace.

public string SpanId { get; set; }

Property Value

string

The span identifier as a string.

SpanKind

Gets or sets the kind of span, indicating its role in the trace. Determines how the span relates to other spans and services.

public SpanKind SpanKind { get; set; }

Property Value

SpanKind

The span kind from the SpanKind enumeration.

SpanName

Gets or sets the name of the operation this span represents. Provides a human-readable description of what this span tracks.

public string SpanName { get; set; }

Property Value

string

The span name as a string.

StartTime

Gets or sets the timestamp when the span started. Used for calculating span duration and timeline analysis.

public DateTimeOffset StartTime { get; set; }

Property Value

DateTimeOffset

The start time as a DateTimeOffset.

Status

Gets or sets the status of the span execution. Indicates whether the operation completed successfully or encountered errors.

public SpanStatus Status { get; set; }

Property Value

SpanStatus

The span status from the SpanStatus enumeration.

StatusMessage

Gets or sets an optional message describing the span status. Typically used to provide error details when status is not Ok.

public string? StatusMessage { get; set; }

Property Value

string

The status message as a string or null if not provided.

TraceId

Gets or sets the trace identifier this span belongs to. Links this span to the overall distributed trace.

public string TraceId { get; set; }

Property Value

string

The trace identifier as a string.