mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-30 01:52:18 +00:00
style(otel v2): trim the internal-spans docstrings and constant comment to one line
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
35937f57e7
commit
3a835bbf3c
3 changed files with 2 additions and 13 deletions
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue