From 5aacd57455261b63e994c851046d152c1714991d Mon Sep 17 00:00:00 2001 From: Yujong Lee Date: Wed, 30 Sep 2026 13:31:48 -0700 Subject: [PATCH] wip --- litellm-rust/crates/traces/tests/migrations.rs | 2 +- litellm/tracing/decode.py | 4 +++- litellm/tracing/receiver.py | 2 +- .../proxy/common_utils/test_http_parsing_utils.py | 6 ++++-- tests/test_litellm/tracing/test_store.py | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/litellm-rust/crates/traces/tests/migrations.rs b/litellm-rust/crates/traces/tests/migrations.rs index 3fbd2207e8f..ac0266409fa 100644 --- a/litellm-rust/crates/traces/tests/migrations.rs +++ b/litellm-rust/crates/traces/tests/migrations.rs @@ -162,7 +162,7 @@ async fn retried_trace_insert_does_not_inflate_rollup( let database = database?; let writer = Connection::writer(&database.url)?; ensure_schema(&database.client, &writer, "trace_test", 7, 14).await?; - let row = serde_json::from_value(serde_json::json!({ + let row: BTreeMap = serde_json::from_value(serde_json::json!({ "Timestamp": time::OffsetDateTime::now_utc().unix_timestamp_nanos() as i64, "TraceId": "retried-trace", "SpanId": "span-1", "ParentSpanId": "", "TeamId": "team-1", "ApiKeyHash": "key-1", "SpanName": "root", "InputTokens": 7 diff --git a/litellm/tracing/decode.py b/litellm/tracing/decode.py index f4534645b55..0748f0a34b0 100644 --- a/litellm/tracing/decode.py +++ b/litellm/tracing/decode.py @@ -160,7 +160,9 @@ def _langsmith_io(row: SpanRow, attributes: Mapping[str, str]) -> None: if row["ObservationType"] == "llm" and isinstance(completion, dict): messages = prompt_payload.get("messages") or [[]] batch = messages[0] if messages and isinstance(messages[0], list) else messages - row["Input"] = json.dumps([_lc_message(m) for m in batch if isinstance(m, dict)]) if isinstance(batch, list) else "" + row["Input"] = ( + json.dumps([_lc_message(m) for m in batch if isinstance(m, dict)]) if isinstance(batch, list) else "" + ) generations: Final = completion.get("generations") first: Final = generations[0] if isinstance(generations, list) and generations else None item: Final = first[0] if isinstance(first, list) and first else None diff --git a/litellm/tracing/receiver.py b/litellm/tracing/receiver.py index cf664d5caef..51081b47105 100644 --- a/litellm/tracing/receiver.py +++ b/litellm/tracing/receiver.py @@ -24,7 +24,7 @@ from litellm.constants import ( ) from litellm.integrations.clickhouse.schema import ensure_schema from litellm.rust_bridge.traces import TraceStorage -from litellm.tracing.decode import InvalidOTLPPayloadError, OTLPPayloadTooLargeError, decode_otlp +from litellm.tracing.decode import OTLPPayloadTooLargeError, decode_otlp from litellm.tracing.store import ClickHouseTraceStore from litellm.tracing.types import ( SpanDetail, diff --git a/tests/test_litellm/proxy/common_utils/test_http_parsing_utils.py b/tests/test_litellm/proxy/common_utils/test_http_parsing_utils.py index bb1bca45c05..0f852b2c5eb 100644 --- a/tests/test_litellm/proxy/common_utils/test_http_parsing_utils.py +++ b/tests/test_litellm/proxy/common_utils/test_http_parsing_utils.py @@ -1,5 +1,5 @@ -import io import gzip +import io import json from typing import get_type_hints from unittest.mock import AsyncMock, MagicMock, patch @@ -31,7 +31,9 @@ from litellm.proxy.common_utils.http_parsing_utils import ( ) -def _starlette_request(body: bytes, content_type: str, path: str = "/v1/messages", content_encoding: str = "") -> Request: +def _starlette_request( + body: bytes, content_type: str, path: str = "/v1/messages", content_encoding: str = "" +) -> Request: scope = { "type": "http", "method": "POST", diff --git a/tests/test_litellm/tracing/test_store.py b/tests/test_litellm/tracing/test_store.py index 04dd84241f5..b0f076da2ac 100644 --- a/tests/test_litellm/tracing/test_store.py +++ b/tests/test_litellm/tracing/test_store.py @@ -11,7 +11,6 @@ sys.path.insert(0, os.path.abspath("../../..")) import pytest -from litellm.tracing.types import TraceScope from litellm.tracing.store import ( ClickHouseTraceStore, agent_nodes, @@ -21,6 +20,7 @@ from litellm.tracing.store import ( trace_from_rows, trace_summary_from_row, ) +from litellm.tracing.types import TraceScope T0 = 1_790_742_989_000_000_000 # ns MS = 1_000_000