#OpenTelemetry Trace SDK

This package implements the trace SDK pipeline: tracer providers, tracers, spans, sampling, processors, exporters, and in-memory test helpers.

#Main objects

  • SdkTracerProvider: owns configuration, processors, and resource
  • SdkTracer: starts spans for one instrumentation scope
  • Span: mutable handle used while the operation is in flight
  • SpanData: immutable snapshot exported at end
  • Sampler: decides whether a span is recorded and sampled
  • SpanProcessor: start/end hooks around span lifecycle
  • SimpleSpanProcessor, BatchSpanProcessor: processor implementations
  • SpanExporter, InMemorySpanExporter: exporter abstraction and test helper

#Sampling

The default sampler is Sampler::parent_based(Sampler::always_on()), which matches the common SDK default in OpenTelemetry implementations.

Sampler::trace_id_ratio(ratio) samples by comparing the high 32 bits of the trace ID against a threshold derived from ratio.

Config::default() also reads the common OpenTelemetry sampler environment variables:

  • OTEL_TRACES_SAMPLER
  • OTEL_TRACES_SAMPLER_ARG

#Limits

SpanLimits currently bound:

  • attributes per span
  • events per span
  • links per span
  • attributes per event
  • attributes per link

When a limit is exceeded, new items are dropped and the corresponding dropped count is incremented in SpanData. Event and link attribute truncation also updates the per-item dropped attribute counts exported through OTLP.

Span::set_status() follows the OpenTelemetry precedence order Ok > Error > Unset.

#Batch processing

BatchSpanProcessor keeps a bounded in-memory queue. It flushes synchronously when the queue reaches the export batch size, or periodically when run() is spawned in the background.

BatchConfig::default() reads:

  • OTEL_BSP_SCHEDULE_DELAY
  • OTEL_BSP_MAX_QUEUE_SIZE
  • OTEL_BSP_MAX_EXPORT_BATCH_SIZE
  • OTEL_BSP_EXPORT_TIMEOUT

BatchConfig

pub struct BatchConfig {
max_queue_size : Int
max_export_batch_size : Int
scheduled_delay_millis : Int
export_timeout_millis : Int
} derive(Compare, Eq, Hash, ToJson,
Debug
)

Configuration for batch span processing. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#batching-processor

BatchConfig::new

fn BatchConfig::new(max_queue_size? : Int, max_export_batch_size? : Int, scheduled_delay_millis? : Int, export_timeout_millis? : Int) -> BatchConfig

Creates normalized batch processor configuration. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#batching-processor

BatchProcessorState

type BatchProcessorState

BatchSpanProcessor

pub struct BatchSpanProcessor {
inner : SpanProcessor
state :
Ref
[BatchProcessorState]
}

Processor that buffers ended spans and exports them in batches.

The background loop is not started automatically. Register the provider globally and call spawn_background_tasks() from the application runtime. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#batching-processor

BatchSpanProcessor::into_span_processor

fn BatchSpanProcessor::into_span_processor(self : BatchSpanProcessor) -> SpanProcessor

Erases the concrete batch processor type into SpanProcessor. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#batching-processor

BatchSpanProcessor::new

Creates a batch span processor with a bounded in-memory queue. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#batching-processor

BatchSpanProcessor::run

async fn BatchSpanProcessor::run(self : BatchSpanProcessor) -> Unit

Background loop for scheduled batch exports. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#batching-processor

Config

pub struct Config {
sampler : Sampler
id_generator : IdGenerator
span_limits : SpanLimits
resource :
Resource

}

Provider-wide trace configuration.

Configuration is read when a span starts. Builder methods override defaults derived from environment variables. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#tracer-provider
impl Default for Config

Config::new

fn Config::new(sampler? : Sampler, id_generator? : IdGenerator, span_limits? : SpanLimits, resource? :
Resource
) -> Config

Creates trace provider configuration.

Omitted arguments use default sampler, ID generator, span limits, and resource. Environment variables are applied through Default. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#tracer-provider

IdGenerator

Strategy object for generating trace and span identifiers. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#id-generators

IdGenerator::new

Builds an ID generator from callbacks. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#id-generators

IdGenerator::new_span_id

Returns a new span ID. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#id-generators

IdGenerator::new_trace_id

Returns a new trace ID. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#id-generators

InMemorySpanExporter

pub struct InMemorySpanExporter {
state :
Ref
[InMemorySpanExporterState]
}

Test exporter that keeps finished spans in memory. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#span-exporter

InMemorySpanExporter::finished_spans

Returns the finished spans accumulated so far. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#span-exporter

InMemorySpanExporter::into_span_exporter

fn InMemorySpanExporter::into_span_exporter(self : InMemorySpanExporter) -> SpanExporter

Erases the concrete in-memory exporter type into SpanExporter. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#interface-definition

InMemorySpanExporter::is_shutdown

fn InMemorySpanExporter::is_shutdown(self : InMemorySpanExporter) -> Bool

Returns whether the exporter has been shut down. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#shutdown

InMemorySpanExporter::new

Creates an empty in-memory span exporter. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#span-exporter

InMemorySpanExporter::reset

fn InMemorySpanExporter::reset(self : InMemorySpanExporter) -> Unit

Clears the in-memory span buffer. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#span-exporter

InMemorySpanExporterState

type InMemorySpanExporterState

ProviderState

type ProviderState

RandomIdGenerator

pub struct RandomIdGenerator {
inner : IdGenerator
}

Default random ID generator. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#id-generators

RandomIdGenerator::into_id_generator

fn RandomIdGenerator::into_id_generator(self : RandomIdGenerator) -> IdGenerator

Erases the concrete random generator type into IdGenerator. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#id-generators

RandomIdGenerator::new

Creates the default random ID generator. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#id-generators

Sampler

pub struct Sampler {
should_sample_fn : (SamplingParameters) -> SamplingResult
description_fn : () -> String
}

Sampling policy wrapper. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#sampling
impl Default for Sampler

Sampler::always_off

fn Sampler::always_off() -> Sampler

Sampler that drops every span.

Dropped spans still carry a valid context for propagation, but they do not record events, attributes, or processor callbacks. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#sampling

Sampler::always_on

fn Sampler::always_on() -> Sampler

Sampler that records and samples every span.

This is useful for development but can be expensive in high-throughput production services. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#sampling

Sampler::description

fn Sampler::description(self : Sampler) -> String

Returns a human-readable description of the sampler. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#sampling

Sampler::new

fn Sampler::new(should_sample_fn : (SamplingParameters) -> SamplingResult, description_fn : () -> String) -> Sampler

Builds a sampler from callbacks. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#sampling

Sampler::parent_based

fn Sampler::parent_based(root : Sampler) -> Sampler

Sampler that honors a valid parent sampling decision and otherwise delegates to the supplied root sampler. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#sampling

Sampler::should_sample

fn Sampler::should_sample(self : Sampler, parameters : SamplingParameters) -> SamplingResult

Evaluates the sampling policy. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#shouldsample

Sampler::trace_id_ratio

fn Sampler::trace_id_ratio(ratio : Double) -> Sampler

Sampler that records and samples according to a trace ID ratio. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#sampling

SamplingDecision

pub(all) enum SamplingDecision {
Drop
RecordOnly
RecordAndSample
} derive(Compare, Eq, Hash, ToJson,
Debug
)

Result of a sampler decision.

Drop creates a non-recording span context, RecordOnly records locally without setting the sampled flag, and RecordAndSample records and marks the context as sampled for downstream services. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#sampling

SamplingParameters

Inputs provided to a sampler when a span is started. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#sampling

SamplingResult

Full sampler output, including attributes and trace state to apply to the started span. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#sampling

SamplingResult::new

Creates a sampling result. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#sampling

SdkTracer

Tracer scoped to one instrumentation library.

Tracers are lightweight handles. The instrumentation scope is attached to every span they create. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#tracer

SdkTracer::start

fn SdkTracer::start(self : SdkTracer, name : StringView, parent_context? :
Context
, kind? : SpanKind, attributes? : ArrayView[
KeyValue
], links? : ArrayView[SpanLink], start_time_unix_nano? : Int64) -> Span

Starts a span using the provider configuration, sampler, and resource.

This evaluates the sampler, generates IDs, applies limits, and notifies processors when the span is recording. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#tracer

SdkTracerProvider

pub struct SdkTracerProvider {
state :
Ref
[ProviderState]
}

Owns trace configuration, processors, and resource metadata.

Applications create one provider, configure processors/exporters, and shut it down during application teardown. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#tracer-provider

SdkTracerProvider::builder

Starts building a tracer provider.

Add processors or exporters before calling build(). A provider with no processors records spans in memory only long enough to return span handles; no telemetry is exported. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#tracer-provider

SdkTracerProvider::force_flush

Flushes every configured span processor. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#forceflush

SdkTracerProvider::into_tracer_provider

Erases this SDK provider into the public trace API provider. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#tracer-provider

SdkTracerProvider::resource

Returns the provider resource. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#tracer-provider

SdkTracerProvider::shutdown

Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#shutdown

SdkTracerProvider::shutdown_with_timeout

async fn SdkTracerProvider::shutdown_with_timeout(self : SdkTracerProvider, timeout_millis : Int) -> Result[Unit,
OTelSdkError
]

Shuts down every configured span processor and marks the provider unusable. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#shutdown

SdkTracerProvider::spawn_batch_processor_tasks

fn SdkTracerProvider::spawn_batch_processor_tasks(self : SdkTracerProvider, group :
TaskGroup
[Unit], allow_failure? : Bool) -> Unit

Spawns background tasks for all configured batch processors. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#tracer-provider

SdkTracerProvider::tracer

fn SdkTracerProvider::tracer(self : SdkTracerProvider, name : StringView, version? : String?, schema_url? : String?, attributes? : ArrayView[
KeyValue
]) -> SdkTracer

Creates a tracer scoped to the supplied instrumentation library metadata. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#tracer-creation

SdkTracerProviderBuilder

pub struct SdkTracerProviderBuilder {
config : Config
processors : Array[SpanProcessor]
batch_processors : Array[BatchSpanProcessor]
}

Builder for SdkTracerProvider. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#tracer-provider

SdkTracerProviderBuilder::build

Builds the tracer provider. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#tracer-provider

SdkTracerProviderBuilder::with_batch_exporter

Appends a batch processor around the exporter and registers it for background execution.

The processor is registered with the provider, but its export loop only runs after spawn_batch_processor_tasks() or the facade/global equivalent is called. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#tracer-provider

SdkTracerProviderBuilder::with_config

Replaces the entire trace provider configuration. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#tracer-provider

SdkTracerProviderBuilder::with_id_generator

Replaces the ID generator. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#tracer-provider

SdkTracerProviderBuilder::with_resource

Replaces the provider resource. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#tracer-provider

SdkTracerProviderBuilder::with_sampler

Replaces the sampler. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#tracer-provider

SdkTracerProviderBuilder::with_simple_exporter

Appends a simple processor around the exporter.

Finished spans are exported from Span::end(). Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#tracer-provider

SdkTracerProviderBuilder::with_span_limits

Replaces the span limits. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#tracer-provider

SdkTracerProviderBuilder::with_span_processor

Appends a span processor to the provider pipeline. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#tracer-provider

SimpleSpanProcessor

pub struct SimpleSpanProcessor {
inner : SpanProcessor
}

Processor that exports spans immediately when Span::end() is awaited.

This is useful for tests and local debugging. For network exporters, prefer BatchSpanProcessor to reduce request-path latency. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#simple-processor

SimpleSpanProcessor::into_span_processor

fn SimpleSpanProcessor::into_span_processor(self : SimpleSpanProcessor) -> SpanProcessor

Erases the concrete simple processor type into SpanProcessor. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#simple-processor

SimpleSpanProcessor::new

Creates a simple processor that exports each ended span immediately. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#simple-processor

Span

pub struct Span {
state :
Ref
[SpanState]
}

Mutable span handle used while an operation is in flight. Spec: https://opentelemetry.io/docs/specs/otel/trace/api/#span

Span::add_event

fn Span::add_event(self : Span, name : StringView, attributes? : ArrayView[
KeyValue
], timestamp_unix_nano? : Int64, dropped_attributes_count? : Int) -> Unit

Adds one event if the span is still recording. Spec: https://opentelemetry.io/docs/specs/otel/trace/api/#add-events

Adds one link if the span is still recording. Spec: https://opentelemetry.io/docs/specs/otel/trace/api/#add-link

Span::context

Returns a context carrying this span as the active local span. Spec: https://opentelemetry.io/docs/specs/otel/trace/api/#get-context

Span::end

async fn Span::end(self : Span, end_time_unix_nano? : Int64) -> Unit

Ends the span once and forwards the final snapshot to processors when the span is recording. Spec: https://opentelemetry.io/docs/specs/otel/trace/api/#end

Span::has_ended

fn Span::has_ended(self : Span) -> Bool

Returns whether end() has already been called. Spec: https://opentelemetry.io/docs/specs/otel/trace/api/#end

Span::is_recording

fn Span::is_recording(self : Span) -> Bool

Returns whether the span is still recording mutations. Spec: https://opentelemetry.io/docs/specs/otel/trace/api/#isrecording

Span::set_attribute

fn Span::set_attribute(self : Span, key : StringView, value :
Value
) -> Unit

Adds one attribute if the span is still recording. Spec: https://opentelemetry.io/docs/specs/otel/trace/api/#set-attributes

Span::set_status

fn Span::set_status(self : Span, status : Status) -> Unit

Sets the span status if the span is still recording. Spec: https://opentelemetry.io/docs/specs/otel/trace/api/#set-status

Span::snapshot

fn Span::snapshot(self : Span) -> SpanData

Returns an immutable snapshot of the current span state. Spec: https://opentelemetry.io/docs/specs/otel/trace/api/#span

Span::span_context

Returns the immutable span context. Spec: https://opentelemetry.io/docs/specs/otel/trace/api/#get-context

Span::update_name

fn Span::update_name(self : Span, name : StringView) -> Unit

Updates the span name. Spec: https://opentelemetry.io/docs/specs/otel/trace/api/#updatename

SpanData

pub struct SpanData {
name : String
span_context :
SpanContext

parent_span_context :
SpanContext
?
kind : SpanKind
start_time_unix_nano : Int64
end_time_unix_nano : Int64?
attributes : Array[
KeyValue
]
dropped_attributes_count : Int
events : Array[SpanEvent]
dropped_events_count : Int
links : Array[SpanLink]
dropped_links_count : Int
status : Status
resource :
Resource

instrumentation_scope :
InstrumentationScope

} derive(Eq, ToJson,
Debug
)

Immutable snapshot of a completed or in-flight span. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#span-exporter

SpanEvent

pub struct SpanEvent {
name : String
timestamp_unix_nano : Int64
attributes : Array[
KeyValue
]
dropped_attributes_count : Int
} derive(Eq, ToJson,
Debug
)

Event recorded on a span timeline. Spec: https://opentelemetry.io/docs/specs/otel/trace/api/#add-events

SpanEvent::new

fn SpanEvent::new(name : StringView, attributes? : ArrayView[
KeyValue
], timestamp_unix_nano? : Int64, dropped_attributes_count? : Int) -> SpanEvent

Creates a span event. Spec: https://opentelemetry.io/docs/specs/otel/trace/api/#add-events

SpanExporter

pub struct SpanExporter {
export_fn : async (ArrayView[SpanData]) -> Result[Unit,
OTelSdkError
]
force_flush_fn : async () -> Result[Unit,
OTelSdkError
]
shutdown_fn : async () -> Result[Unit,
OTelSdkError
]
name_fn : () -> String
}

Exporter callback wrapper for finished span batches. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#span-exporter

SpanExporter::export_batch

Exports one batch of finished spans. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#interface-definition

SpanExporter::force_flush

Requests exporter flush. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#forceflush

SpanExporter::name

fn SpanExporter::name(self : SpanExporter) -> String

Returns a human-readable exporter name. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#span-exporter

SpanExporter::new

fn SpanExporter::new(export_fn : async (ArrayView[SpanData]) -> Result[Unit,
OTelSdkError
], force_flush_fn? : async () -> Result[Unit,
OTelSdkError
], shutdown_fn? : async () -> Result[Unit,
OTelSdkError
], name_fn? : () -> String) -> SpanExporter

Builds a span exporter from callbacks. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#span-exporter

SpanExporter::shutdown

Requests exporter shutdown. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#shutdown

SpanExporter::shutdown_with_timeout

async fn SpanExporter::shutdown_with_timeout(self : SpanExporter, timeout_millis : Int) -> Result[Unit,
OTelSdkError
]

Requests exporter shutdown with an optional timeout budget in milliseconds. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#shutdown

SpanKind

pub(all) enum SpanKind {
Internal
Client
Server
Producer
Consumer
} derive(Compare, Eq, Hash, ToJson,
Debug
)

OpenTelemetry span kinds.

Span kind describes the relationship between this operation and remote systems. It affects how backends render service maps and client/server relationships. Spec: https://opentelemetry.io/docs/specs/otel/trace/api/#spankind

SpanLimits

pub struct SpanLimits {
max_attributes_per_span : Int
max_events_per_span : Int
max_links_per_span : Int
max_attributes_per_event : Int
max_attributes_per_link : Int
} derive(Compare, Eq, Hash, ToJson,
Debug
)

Per-span limits for attributes, events, and links. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#span-limits

SpanLimits::new

fn SpanLimits::new(max_attributes_per_span? : Int, max_events_per_span? : Int, max_links_per_span? : Int, max_attributes_per_event? : Int, max_attributes_per_link? : Int) -> SpanLimits

Creates bounded span limits. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#span-limits

Link from one span to another span context. Spec: https://opentelemetry.io/docs/specs/otel/trace/api/#link

SpanLink::new

Creates a span link. Spec: https://opentelemetry.io/docs/specs/otel/trace/api/#link

SpanProcessor

pub struct SpanProcessor {
on_start_fn : (
Context
, SpanData) -> Unit
on_end_fn : async (SpanData) -> Unit
force_flush_fn : async () -> Result[Unit,
OTelSdkError
]
shutdown_fn : async () -> Result[Unit,
OTelSdkError
]
}

Processing hook interface around span start and end.

Processors should avoid expensive work on on_start. Exporters usually run from on_end through simple or batch processor implementations. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#span-processor

SpanProcessor::force_flush

Requests processor flush. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#span-processor

SpanProcessor::new

fn SpanProcessor::new(on_start_fn? : (
Context
, SpanData) -> Unit, on_end_fn? : async (SpanData) -> Unit, force_flush_fn? : async () -> Result[Unit,
OTelSdkError
], shutdown_fn? : async () -> Result[Unit,
OTelSdkError
]) -> SpanProcessor

Builds a span processor from callbacks. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#span-processor

SpanProcessor::on_end

async fn SpanProcessor::on_end(self : SpanProcessor, span_data : SpanData) -> Unit

Invokes the processor end hook. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#span-processor

SpanProcessor::on_start

Invokes the processor start hook. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#span-processor

SpanProcessor::shutdown

Requests processor shutdown. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#span-processor

SpanProcessor::shutdown_with_timeout

async fn SpanProcessor::shutdown_with_timeout(self : SpanProcessor, timeout_millis : Int) -> Result[Unit,
OTelSdkError
]

Requests processor shutdown with an optional timeout budget in milliseconds. Spec: https://opentelemetry.io/docs/specs/otel/trace/sdk/#span-processor

SpanState

type SpanState

Status

pub struct Status {
code : StatusCode
description : String?
} derive(Eq, ToJson,
Debug
)

Span status consisting of a code and optional description. Spec: https://opentelemetry.io/docs/specs/otel/trace/api/#set-status
impl Default for Status

Status::error

fn Status::error(description? : String?) -> Status

Returns an error status with an optional description. Spec: https://opentelemetry.io/docs/specs/otel/trace/api/#set-status

Status::new

fn Status::new(code : StatusCode, description? : String?) -> Status

Creates a span status. Spec: https://opentelemetry.io/docs/specs/otel/trace/api/#set-status

Status::ok

fn Status::ok() -> Status

Returns an ok status. Spec: https://opentelemetry.io/docs/specs/otel/trace/api/#set-status

Status::unset

fn Status::unset() -> Status

Returns the default unset status. Spec: https://opentelemetry.io/docs/specs/otel/trace/api/#set-status

StatusCode

pub(all) enum StatusCode {
Unset
Ok
Error
} derive(Compare, Eq, Hash, ToJson,
Debug
)

OpenTelemetry status code attached to a completed span. Spec: https://opentelemetry.io/docs/specs/otel/trace/api/#set-status

Source Files