module documentation

OpenTelemetry workflow utilities for Temporal SDK.

This module provides workflow-safe OpenTelemetry span creation and context management utilities for use within Temporal workflows. All functions in this module are designed to work correctly during workflow replay.

Function completed_span Create and end an OpenTelemetry span.
def completed_span(name: str, *, attributes: opentelemetry.util.types.Attributes = None, exception: Exception | None = None): (source) ΒΆ

Create and end an OpenTelemetry span.

Note, this will only create and record when the workflow is not replaying and if there is a current span (meaning the client started a span and this interceptor is configured on the worker and the span is on the context).

To create a long-running span or to create a span that actually spans other code use OpenTelemetryPlugin and tracer().

Parameters
name:strName of the span.
attributes:opentelemetry.util.types.AttributesAttributes to set on the span if any. Workflow ID and run ID are automatically added.
exception:Exception | NoneOptional exception to record on the span.