From 44ab5703d7333e03874411190b7528c6a2294730 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Thu, 1 Oct 2026 07:55:19 +0000 Subject: [PATCH 1/4] refactor: clean up fresh tech debt from 2026-09-30 Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- litellm/constants.py | 1 - litellm/proxy/_types.py | 1 - litellm/proxy/roi_calculator/estimator.py | 26 ---------------------- litellm/proxy/roi_calculator/pull_cache.py | 5 ----- litellm/tracing/decode.py | 6 ----- litellm/tracing/receiver.py | 4 ---- 6 files changed, 43 deletions(-) diff --git a/litellm/constants.py b/litellm/constants.py index a8c6278c62f7..b3f5b0471f4f 100644 --- a/litellm/constants.py +++ b/litellm/constants.py @@ -46,7 +46,6 @@ ) DEFAULT_BATCH_SIZE: Final = int(os.getenv("DEFAULT_BATCH_SIZE", 512)) DEFAULT_FLUSH_INTERVAL_SECONDS: Final = int(os.getenv("DEFAULT_FLUSH_INTERVAL_SECONDS", 5)) -# Agent tracing / ClickHouse CLICKHOUSE_BATCH_SIZE: Final = get_env_int("CLICKHOUSE_BATCH_SIZE", 10_000) CLICKHOUSE_FLUSH_INTERVAL_SECONDS: Final = float(os.getenv("CLICKHOUSE_FLUSH_INTERVAL_SECONDS", "1.0")) CLICKHOUSE_MAX_BUFFERED_ROWS: Final = get_env_int("CLICKHOUSE_MAX_BUFFERED_ROWS", 200_000) diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py index 7b1ba2ec1aca..649381f24a28 100644 --- a/litellm/proxy/_types.py +++ b/litellm/proxy/_types.py @@ -520,7 +520,6 @@ class LiteLLMRoutes(enum.Enum): "/v1/rag/ingest", "/rag/query", "/v1/rag/query", - # agent tracing: OTLP ingest + reads (scoped to the caller's team in the handler) "/engine", "/engine/{engine_id}", "/engine/{engine_id}/runs", diff --git a/litellm/proxy/roi_calculator/estimator.py b/litellm/proxy/roi_calculator/estimator.py index 200cc38f5c63..4cb211f9cb06 100644 --- a/litellm/proxy/roi_calculator/estimator.py +++ b/litellm/proxy/roi_calculator/estimator.py @@ -92,32 +92,6 @@ def cache_context(settings: ROISettings, models: tuple[EstimatorModel, ...] | No return hashlib.sha256(context.encode()).hexdigest() -def pull_cache_key( - settings: ROISettings, - pull: ROIPullEvidence, - models: tuple[EstimatorModel, ...] | None = None, -) -> str: - evidence: Final = json.dumps( - metadata_evidence(pull).model_dump(exclude_unset=True), - ensure_ascii=False, - ) - key: Final = json.dumps( - ( - ESTIMATE_VERSION, - settings.estimator_model, - settings.estimator_prompt, - RESPONSE_CONTRACT, - estimator_options(_configured_models(settings, models)), - pull["repo"], - pull["number"], - pull["head_sha"], - evidence, - ), - ensure_ascii=False, - ) - return hashlib.sha256(key.encode()).hexdigest() - - class Estimator: def __init__( self, diff --git a/litellm/proxy/roi_calculator/pull_cache.py b/litellm/proxy/roi_calculator/pull_cache.py index d82b0d60f14a..e1800fd06201 100644 --- a/litellm/proxy/roi_calculator/pull_cache.py +++ b/litellm/proxy/roi_calculator/pull_cache.py @@ -2,7 +2,6 @@ import json from typing import Final -from litellm.proxy.roi_calculator.estimator import cache_context from litellm.proxy.roi_calculator.github import GitHubPullListItem from litellm.types.roi_calculator import ROISettings @@ -46,7 +45,3 @@ def settings_fingerprint(settings: ROISettings) -> str: ensure_ascii=False, ) return hashlib.sha256(value.encode()).hexdigest() - - -def current_cache_context(settings: ROISettings) -> str: - return cache_context(settings) diff --git a/litellm/tracing/decode.py b/litellm/tracing/decode.py index 60ae7732444c..c310a3395931 100644 --- a/litellm/tracing/decode.py +++ b/litellm/tracing/decode.py @@ -52,9 +52,6 @@ class OTLPPayloadTooLargeError(OverflowError): pass -# ---------------------------------------------------------------- decode - - def _truncate(value: str) -> str: size = len(value.encode("utf-8")) if size <= OTLP_MAX_ATTRIBUTE_VALUE_BYTES: @@ -123,9 +120,6 @@ def _span_row(span: DecodedSpan) -> SpanRow: return row -# ---------------------------------------------------------------- normalize - - def _loads(value: str) -> object: try: return json.loads(value) diff --git a/litellm/tracing/receiver.py b/litellm/tracing/receiver.py index be9641a602b8..8b157e260a88 100644 --- a/litellm/tracing/receiver.py +++ b/litellm/tracing/receiver.py @@ -82,8 +82,6 @@ async def start(self) -> None: spend_log_retention_days=AGENT_TRACING_SPEND_LOG_RETENTION_DAYS, ) - # ------------------------------------------------------------ write - async def ingest( self, body: bytes, @@ -108,8 +106,6 @@ async def ingest( raise TracingPayloadTooLargeError(str(error)) from error return len(rows) - # ------------------------------------------------------------ read - async def list_traces(self, scope: TraceScope, start_ms: int, end_ms: int, cursor: str | None = None) -> TracePage: return await self.store.list_traces(scope, start_ms, end_ms, cursor) From 1cced64585d85ad8276589957ce4e692a89457f5 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Thu, 1 Oct 2026 08:51:31 +0000 Subject: [PATCH 2/4] refactor: keep agent tracing route comment in LiteLLMRoutes Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- litellm/proxy/_types.py | 1 + 1 file changed, 1 insertion(+) diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py index 649381f24a28..7b1ba2ec1aca 100644 --- a/litellm/proxy/_types.py +++ b/litellm/proxy/_types.py @@ -520,6 +520,7 @@ class LiteLLMRoutes(enum.Enum): "/v1/rag/ingest", "/rag/query", "/v1/rag/query", + # agent tracing: OTLP ingest + reads (scoped to the caller's team in the handler) "/engine", "/engine/{engine_id}", "/engine/{engine_id}/runs", From bf48b12903b422633267f3ad9e2d6ea6e82229fe Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Thu, 1 Oct 2026 09:01:40 +0000 Subject: [PATCH 3/4] refactor: move agent tracing route comment above the trace routes Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- litellm/proxy/_types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py index 7b1ba2ec1aca..739fb64d013a 100644 --- a/litellm/proxy/_types.py +++ b/litellm/proxy/_types.py @@ -520,7 +520,6 @@ class LiteLLMRoutes(enum.Enum): "/v1/rag/ingest", "/rag/query", "/v1/rag/query", - # agent tracing: OTLP ingest + reads (scoped to the caller's team in the handler) "/engine", "/engine/{engine_id}", "/engine/{engine_id}/runs", @@ -531,6 +530,7 @@ class LiteLLMRoutes(enum.Enum): "/engine/preview/sample", "/engine/workers/register", "/engine/workers/{worker_id}", + # agent tracing: OTLP ingest + reads (scoped to the caller's team in the handler) "/v1/traces", "/v1/traces/{trace_id}", "/v1/traces/{trace_id}/spans/{span_id}", From ea2d1410e54d727445608720be7f2c30d4f3ee2f Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Thu, 1 Oct 2026 09:07:04 +0000 Subject: [PATCH 4/4] refactor: drop route comment that duplicates the trace handler docstring Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- litellm/proxy/_types.py | 1 - 1 file changed, 1 deletion(-) diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py index 739fb64d013a..649381f24a28 100644 --- a/litellm/proxy/_types.py +++ b/litellm/proxy/_types.py @@ -530,7 +530,6 @@ class LiteLLMRoutes(enum.Enum): "/engine/preview/sample", "/engine/workers/register", "/engine/workers/{worker_id}", - # agent tracing: OTLP ingest + reads (scoped to the caller's team in the handler) "/v1/traces", "/v1/traces/{trace_id}", "/v1/traces/{trace_id}/spans/{span_id}",