diff --git a/changelog/3733.deprecated.md b/changelog/3733.deprecated.md new file mode 100644 index 000000000..8b1fb29bb --- /dev/null +++ b/changelog/3733.deprecated.md @@ -0,0 +1 @@ +- Deprecated unused `Traceable`, `@traceable`, `@traced`, and `AttachmentStrategy` in `pipecat.utils.tracing.class_decorators`. This module will be removed in a future release. diff --git a/src/pipecat/utils/tracing/class_decorators.py b/src/pipecat/utils/tracing/class_decorators.py index 571a74804..73dacbe51 100644 --- a/src/pipecat/utils/tracing/class_decorators.py +++ b/src/pipecat/utils/tracing/class_decorators.py @@ -7,6 +7,11 @@ """Base OpenTelemetry tracing decorators and utilities for Pipecat. +.. deprecated:: 0.0.103 + This module is unused and will be removed in a future release. + Service tracing is handled by the decorators in + :mod:`pipecat.utils.tracing.service_decorators`. + This module provides class and method level tracing capabilities similar to the original NVIDIA implementation. """ @@ -16,8 +21,16 @@ import contextlib import enum import functools import inspect +import warnings from typing import Callable, Optional, TypeVar +warnings.warn( + "pipecat.utils.tracing.class_decorators is deprecated and will be removed in a future " + "release. Use pipecat.utils.tracing.service_decorators instead.", + DeprecationWarning, + stacklevel=2, +) + from pipecat.utils.tracing.setup import is_tracing_available # Import OpenTelemetry if available diff --git a/src/pipecat/utils/tracing/service_decorators.py b/src/pipecat/utils/tracing/service_decorators.py index fae7f7e77..0fd939162 100644 --- a/src/pipecat/utils/tracing/service_decorators.py +++ b/src/pipecat/utils/tracing/service_decorators.py @@ -82,11 +82,12 @@ def _get_parent_service_context(self): if not is_tracing_available(): return None - # The parent span was created when Traceable was initialized and stored as self._span + # TODO: Remove this block and delete class_decorators.py once Traceable is removed. + # Legacy: support for classes inheriting from Traceable (currently unused, deprecated). if hasattr(self, "_span") and self._span: return trace.set_span_in_context(self._span) - # Fall back to conversation context if available + # Use the conversation context set by TurnTraceObserver via TracingContext. tracing_ctx = getattr(self, "_tracing_context", None) conversation_context = tracing_ctx.get_conversation_context() if tracing_ctx else None if conversation_context: