mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-03 02:22:24 +00:00
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>
This commit is contained in:
parent
0980f756bd
commit
5107f205a0
6 changed files with 0 additions and 43 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue