class documentation

Interceptor that supports client and worker OpenTelemetry span creation and propagation.

This should be created and used for interceptors on the temporalio.client.Client.connect call to apply to all client calls and worker calls using that client. To only apply to workers, set as worker creation option instead of in client.

To customize the header key, text map propagator, or payload converter, a subclass of this and TracingWorkflowInboundInterceptor should be created. In addition to customizing those attributes, the subclass of this class should return the workflow interceptor subclass from workflow_interceptor_class. That subclass should also set the custom attributes desired.

Method __init__ Initialize a OpenTelemetry tracing interceptor.
Method intercept_activity Implementation of temporalio.worker.Interceptor.intercept_activity.
Method intercept_client Implementation of temporalio.client.Interceptor.intercept_client.
Method workflow_interceptor_class Implementation of temporalio.worker.Interceptor.workflow_interceptor_class.
Instance Variable header_key Undocumented
Instance Variable payload_converter Undocumented
Instance Variable text_map_propagator Undocumented
Instance Variable tracer Undocumented
Method _completed_workflow_span Undocumented
Method _context_from_headers Undocumented
Method _context_to_headers Undocumented
Method _start_as_current_span Undocumented
Instance Variable _always_create_workflow_spans Undocumented
def __init__(self, tracer: opentelemetry.trace.Tracer | None = None, *, always_create_workflow_spans: bool = False): (source)

Initialize a OpenTelemetry tracing interceptor.

Parameters
tracer:opentelemetry.trace.Tracer | NoneThe tracer to use. Defaults to opentelemetry.trace.get_tracer.
always_create_workflow_spans:boolWhen false, the default, spans are only created in workflows when an overarching span from the client is present. In cases of starting a workflow elsewhere, e.g. CLI or schedules, a client-created span is not present and workflow spans will not be created. Setting this to true will create spans in workflows no matter what, but there is a risk of them being orphans since they may not have a parent span after replaying.
header_key: str = (source)

Undocumented

payload_converter = (source)

Undocumented

Undocumented

def _completed_workflow_span(self, params: _CompletedWorkflowSpanParams) -> _CarrierDict | None: (source)

Undocumented

@contextmanager
def _start_as_current_span(self, name: str, *, attributes: opentelemetry.util.types.Attributes, input: _InputWithHeaders | None = None, kind: opentelemetry.trace.SpanKind) -> Iterator[None]: (source)

Undocumented

_always_create_workflow_spans = (source)

Undocumented