From e6995f432a180a0a22907a92006574a4be4548e7 Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Thu, 10 Sep 2026 11:28:25 +0200 Subject: [PATCH] ref: Remove _ai_pipeline_name context variable --- sentry_sdk/ai/monitoring.py | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/sentry_sdk/ai/monitoring.py b/sentry_sdk/ai/monitoring.py index a43f25234d..5f096cc8cc 100644 --- a/sentry_sdk/ai/monitoring.py +++ b/sentry_sdk/ai/monitoring.py @@ -1,4 +1,3 @@ -from contextvars import ContextVar from typing import TYPE_CHECKING from sentry_sdk.ai.utils import _set_span_data_attribute @@ -11,18 +10,6 @@ F = TypeVar("F", bound=Union[Callable[..., Any], Callable[..., Awaitable[Any]]]) -_ai_pipeline_name: "ContextVar[Optional[str]]" = ContextVar( - "ai_pipeline_name", default=None -) - - -def set_ai_pipeline_name(name: "Optional[str]") -> None: - _ai_pipeline_name.set(name) - - -def get_ai_pipeline_name() -> "Optional[str]": - return _ai_pipeline_name.get() - def record_token_usage( span: "Union[Span, StreamedSpan]", @@ -33,11 +20,6 @@ def record_token_usage( output_tokens_reasoning: "Optional[int]" = None, total_tokens: "Optional[int]" = None, ) -> None: - # TODO: move pipeline name elsewhere - ai_pipeline_name = get_ai_pipeline_name() - if ai_pipeline_name: - _set_span_data_attribute(span, SPANDATA.GEN_AI_PIPELINE_NAME, ai_pipeline_name) - if input_tokens is not None: _set_span_data_attribute(span, SPANDATA.GEN_AI_USAGE_INPUT_TOKENS, input_tokens)