From a46ae19f0a41d35794a8c17107ae0aed76f07670 Mon Sep 17 00:00:00 2001 From: maplexu Date: Mon, 20 Jul 2026 12:51:01 -0400 Subject: [PATCH] Fix stale workflow.tracer() references in OpenTelemetry contrib workflow.tracer() does not exist; point the plugin and completed_span docstrings and the README at opentelemetry.trace.get_tracer(). --- temporalio/contrib/opentelemetry/README.md | 2 +- temporalio/contrib/opentelemetry/_plugin.py | 2 +- temporalio/contrib/opentelemetry/workflow.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/temporalio/contrib/opentelemetry/README.md b/temporalio/contrib/opentelemetry/README.md index 9f1e1303b..2c6e39817 100644 --- a/temporalio/contrib/opentelemetry/README.md +++ b/temporalio/contrib/opentelemetry/README.md @@ -68,7 +68,7 @@ worker = Worker( - **Accurate Duration Spans**: Workflow spans have real durations reflecting actual execution time - **Direct OpenTelemetry Usage**: Use `opentelemetry.trace.get_tracer()` directly within workflows - **Better Span Hierarchy**: More accurate parent-child relationships within workflows -- **Workflow Context Access**: Access spans within workflows using `temporalio.contrib.opentelemetry.workflow.tracer()` +- **Workflow Context Access**: Access spans within workflows using `opentelemetry.trace.get_tracer()` #### ⚠️ Considerations: - **Experimental Status**: Subject to breaking changes in future versions diff --git a/temporalio/contrib/opentelemetry/_plugin.py b/temporalio/contrib/opentelemetry/_plugin.py index 2a0e1e06c..2537c1776 100644 --- a/temporalio/contrib/opentelemetry/_plugin.py +++ b/temporalio/contrib/opentelemetry/_plugin.py @@ -18,7 +18,7 @@ class OpenTelemetryPlugin(SimplePlugin): It uses the new OpenTelemetryInterceptor implementation. Unlike the prior TracingInterceptor, this allows for accurate duration spans and parenting inside a workflow - with temporalio.contrib.opentelemetry.workflow.tracer() + using opentelemetry.trace.get_tracer() directly. Your tracer provider should be created with `create_tracer_provider` for it to be used within a Temporal worker. """ diff --git a/temporalio/contrib/opentelemetry/workflow.py b/temporalio/contrib/opentelemetry/workflow.py index 299e72b24..e872979a4 100644 --- a/temporalio/contrib/opentelemetry/workflow.py +++ b/temporalio/contrib/opentelemetry/workflow.py @@ -30,7 +30,7 @@ def completed_span( 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(). + To create a long-running span or to create a span that actually spans other code use OpenTelemetryPlugin and opentelemetry.trace.get_tracer(). Args: name: Name of the span.