litellm/litellm/integrations
Yassin Kortam 502d3609af
fix(otel): stamp an MCP tool failure on the request that carried it (#34551)
A failed MCP tool call aimed its error.* attributes at request_root_span(),
a ContextVar written on the ASGI request task. A stateful streamable-HTTP
session runs every message on the single task the session's initialize POST
spawned, so inside the message handler that ContextVar still holds the
initialize request's SERVER span. That span ended long ago, so the SDK
dropped every write (five 'Setting attribute on ended span' warnings plus
set_status and _add_event per failed call) and the POST that actually
failed carried no error at all. The identity attributes seeded onto the
server span went the same way.

Publish the live transport span on the ASGI scope of the request being
handled and read it back in the message handler through req_ctx.request,
the Request the streamable-HTTP transport attaches to each message. That
replaces the session-scoped field with a per-message one: a JSON-RPC
response POST deliberately skips the per-session lock, since it can arrive
while the tool call awaiting it is still in flight, so a field on the
shared auth object could be overwritten mid-call and send the tool call's
telemetry to the response's request. A scope also dies with its request
rather than holding a finished span on idle session state.

Publishing re-anchors the request root for the message so guardrail spans
and identity seeding follow, and only a transport still open for writes is
anchored or stamped: a notification POST can answer before the session task
is done, and moving dropped writes from one finished span to another is no
fix. Live capture goes from seven ended-span warnings and an unmarked
transaction to zero warnings and ERROR on the POST that carried the call.
2026-07-25 17:32:53 +00:00
..
_types style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
agentops style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
arize style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
azure_sentinel fix(azure_sentinel): resolve audit stream from AZURE_SENTINEL_AUDIT_STREAM_NAME (#32010) 2026-07-03 12:09:27 -07:00
azure_storage style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
bitbucket style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
cloudzero style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
code_interpreter_interception feat(sandbox): reuse e2b container across requests when metadata.session_id is set (#31688) 2026-06-30 18:58:09 -07:00
compression_interception feat(spend): track prompt compression saved tokens in daily spend aggregates (#33810) 2026-07-18 17:47:54 -07:00
datadog fix(datadog): split log batches proactively under intake payload limits (#32860) 2026-07-10 20:54:42 -07:00
deepeval style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
dotprompt style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
email_templates fix(email): apply EMAIL_SIGNATURE to budget alert emails (#31712) 2026-06-30 21:11:50 +02:00
focus style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
gcs_bucket style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
gcs_pubsub style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
generic_api style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
generic_prompt_management style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
gitlab style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
langfuse fix(langfuse): send v4 ingestion header for otel callback (#33907) 2026-07-18 20:36:51 -07:00
levo style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
litellm_agent Agent Builder - support new experimental agent builder, to ensure agents pass compliance checks (#21817) 2026-02-21 15:32:47 -08:00
mavvrik_focus style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
newrelic style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
opentelemetry_utils style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
opik chore(ci): merge oss branch (#33784) 2026-07-17 23:22:13 +00:00
otel fix(otel): stamp an MCP tool failure on the request that carried it (#34551) 2026-07-25 17:32:53 +00:00
prometheus_helpers style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
SlackAlerting style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
vantage style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
vector_store_integrations style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
weave style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
websearch_interception fix(websearch): address Responses review findings 2026-07-15 00:52:16 +00:00
__init__.py add linting 2023-08-18 11:05:05 -07:00
additional_logging_utils.py build(deps-dev): bump black to 26.3.1 and apply formatting (#28525) 2026-05-21 17:24:18 -07:00
anthropic_cache_control_hook.py fix(anthropic): carry the stand-down judgment inside written-back injection points 2026-07-18 17:11:03 -07:00
argilla.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
athina.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
braintrust_logging.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
braintrust_mock_client.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
callback_configs.json feat: litellm oss 110626 (#30202) 2026-06-11 22:30:26 -07:00
custom_batch_logger.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
custom_guardrail.py Merge pull request #34458 from BerriAI/litellm_lit4759_guardrail_metadata_bucket 2026-07-24 17:02:48 -07:00
custom_logger.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
custom_prompt_management.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
custom_secret_manager.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
custom_sso_handler.py chore(auth): require trusted proxy for header identity auth 2026-04-29 21:20:21 -07:00
dynamodb.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
email_alerting.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
galileo.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
greenscale.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
helicone.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
helicone_mock_client.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
humanloop.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
lago.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
langsmith.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
langsmith_mock_client.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
langtrace.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
literal_ai.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
logfire_logger.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
lunary.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
mlflow.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
mock_client_factory.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
openmeter.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
opentelemetry.py fix(guardrails): keep guardrail information in spend logs when the caller sends its own metadata 2026-07-24 16:20:44 -07:00
posthog.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
posthog_mock_client.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
prometheus.py feat(prometheus): expose video duration and image count consumption metrics (#33138) 2026-07-13 18:51:13 -07:00
prometheus_services.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
prompt_layer.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
prompt_management_base.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
Readme.md (Feat) - Add GCS Pub/Sub Logging integration for sending DB SpendLogs to BigQuery (#7976) 2025-01-24 20:57:20 -08:00
rubrik.py fix(guardrails): filter Add-Guardrail mode dropdown per provider (#32712) 2026-07-11 14:51:27 -07:00
s3.py fix(s3): sanitize slashes in response-id-derived object key file name (#33271) 2026-07-14 17:26:00 -07:00
s3_v2.py fix(s3_v2): pass usedforsecurity=False to hashlib.md5 for FIPS envs 2026-07-02 01:12:49 +00:00
sqs.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
supabase.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
test_httpx.py fix(utils.py): improved predibase exception mapping 2024-06-08 14:32:43 -07:00
traceloop.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00
weights_biases.py style: unify ruff format width on 120 (#31518) 2026-06-27 12:39:29 -07:00

Integrations

This folder contains logging integrations for litellm

eg. logging to Datadog, Langfuse, Prometheus, s3, GCS Bucket, etc.