From 5107f205a06d5495731b85962b9bd823a33ec158 Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Thu, 1 Oct 2026 04:46:59 -0700 Subject: [PATCH] refactor: clean up fresh tech debt from 2026-09-30 (#43993) * refactor: clean up fresh tech debt from 2026-09-30 Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * refactor: keep agent tracing route comment in LiteLLMRoutes Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * refactor: move agent tracing route comment above the trace routes Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * refactor: drop route comment that duplicates the trace handler docstring Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- 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 a8c6278c62f..b3f5b0471f4 100644 --- a/litellm/constants.py +++ b/litellm/constants.py @@ -46,7 +46,6 @@ ROUTER_SETTINGS_MANAGED_OUTSIDE_CONFIG: Final[frozenset[str]] = frozenset( ) 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 7b1ba2ec1ac..649381f24a2 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 200cc38f5c6..4cb211f9cb0 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 d82b0d60f14..e1800fd0620 100644 --- a/litellm/proxy/roi_calculator/pull_cache.py +++ b/litellm/proxy/roi_calculator/pull_cache.py @@ -2,7 +2,6 @@ import hashlib 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 60ae7732444..c310a339593 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 be9641a602b..8b157e260a8 100644 --- a/litellm/tracing/receiver.py +++ b/litellm/tracing/receiver.py @@ -82,8 +82,6 @@ class TraceReceiver: spend_log_retention_days=AGENT_TRACING_SPEND_LOG_RETENTION_DAYS, ) - # ------------------------------------------------------------ write - async def ingest( self, body: bytes, @@ -108,8 +106,6 @@ class TraceReceiver: 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)