class TracingInterceptor(temporalio.client.Interceptor, temporalio.worker.Interceptor): (source)
Constructor: TracingInterceptor(tracer, always_create_workflow_spans)
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 |
Implementation of temporalio.worker.Interceptor.intercept_activity . |
Method | intercept |
Implementation of temporalio.client.Interceptor.intercept_client . |
Method | workflow |
Implementation of temporalio.worker.Interceptor.workflow_interceptor_class . |
Instance Variable | header |
Undocumented |
Instance Variable | payload |
Undocumented |
Instance Variable | text |
Undocumented |
Instance Variable | tracer |
Undocumented |
Method | _completed |
Undocumented |
Method | _context |
Undocumented |
Method | _context |
Undocumented |
Method | _start |
Undocumented |
Instance Variable | _always |
Undocumented |
opentelemetry.trace.Tracer | None
= None, *, always_create_workflow_spans: bool
= False):
(source)
¶
Initialize a OpenTelemetry tracing interceptor.
Parameters | |
tracer:opentelemetry.trace.Tracer | None | The tracer to use. Defaults to
opentelemetry.trace.get_tracer . |
alwaysbool | When 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. |
temporalio.worker.ActivityInboundInterceptor
) -> temporalio.worker.ActivityInboundInterceptor
:
(source)
¶
Implementation of
temporalio.worker.Interceptor.intercept_activity
.
temporalio.client.OutboundInterceptor
) -> temporalio.client.OutboundInterceptor
:
(source)
¶
Implementation of
temporalio.client.Interceptor.intercept_client
.
temporalio.worker.WorkflowInterceptorClassInput
) -> type[ TracingWorkflowInboundInterceptor]
:
(source)
¶
Implementation of
temporalio.worker.Interceptor.workflow_interceptor_class
.
_CompletedWorkflowSpanParams
) -> _CarrierDict | None
:
(source)
¶
Undocumented
Mapping[ str, temporalio.api.common.v1.Payload]
) -> opentelemetry.context.context.Context | None
:
(source)
¶
Undocumented
Mapping[ str, temporalio.api.common.v1.Payload]
) -> Mapping[ str, temporalio.api.common.v1.Payload]
:
(source)
¶
Undocumented
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