diff --git a/litellm/constants.py b/litellm/constants.py index 7b18adc0688..613df5ebf8f 100644 --- a/litellm/constants.py +++ b/litellm/constants.py @@ -1677,8 +1677,6 @@ LITELLM_LOGGING_NO_UPSTREAM_LLM_CALL: Final = "litellm_no_upstream_llm_call" # the key's values after the team metadata merge so a key outranks its team). OTEL_SERVICE_NAME_METADATA_KEYS: Final = ("otel_service_name_override", "otel_service_name") -# ``litellm_settings: otel_tenant_internal_spans`` value (and its env equivalent) that -# keeps the proxy's own SERVICE and DB_CALL spans out of tenant OTel destinations. OTEL_EXCLUDE_INTERNAL_SPANS: Final = "exclude" OTEL_TENANT_INTERNAL_SPANS_ENV: Final = "LITELLM_OTEL_TENANT_INTERNAL_SPANS" diff --git a/litellm/integrations/otel/plumbing/context.py b/litellm/integrations/otel/plumbing/context.py index e6d94747f7d..dd3d60305bf 100644 --- a/litellm/integrations/otel/plumbing/context.py +++ b/litellm/integrations/otel/plumbing/context.py @@ -403,11 +403,7 @@ def tenant_destinations_are_additive() -> bool: def tenant_internal_spans_default() -> OtelInternalSpans: - """The ``internal_spans`` a tenant destination gets when its own callback vars name none. - - Include is the default, so a destination keeps the whole request tree unless the - operator or the team asks for the proxy's own SERVICE and DB_CALL spans to stay home. - """ + """The ``internal_spans`` a tenant destination gets when its own callback vars name none.""" import litellm configured: Final = litellm.otel_tenant_internal_spans or os.environ.get(OTEL_TENANT_INTERNAL_SPANS_ENV) diff --git a/litellm/integrations/otel/plumbing/providers.py b/litellm/integrations/otel/plumbing/providers.py index 2752bd473ec..194f1657712 100644 --- a/litellm/integrations/otel/plumbing/providers.py +++ b/litellm/integrations/otel/plumbing/providers.py @@ -441,12 +441,7 @@ def _in_scope(span: ReadableSpan, scope: "OtelSpanScope") -> bool: def _is_internal_span(span: ReadableSpan) -> bool: - """Whether ``span`` is the proxy's own work rather than the request or the tenant's call. - - The request root is the SERVER span; the model call, the MCP call and the guardrail - each carry one of the tenant-owned keys. Everything else the proxy emits inside a - request is a SERVICE or DB_CALL span: auth, Redis, Postgres, spend writes. - """ + """A SERVICE or DB_CALL span: neither the request root nor a tenant-owned model, MCP or guardrail span.""" return span.kind is not SpanKind.SERVER and not _is_tenant_owned_span(span.attributes or _NO_ATTRIBUTES)