mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-24 22:09:56 +00:00
* feat(lens): consume the independent Lens service and shared UI * fix(lens): keep embedded setup stable and vendor UI before builds * chore(lens): pin embedded UI provenance to published Lens source * fix(lens): complete embedded UI extraction across CI builds * docs(lens): record latest main and removal-boundary validation * fix(lens): wire external chart credentials and ingestion modes * test(lens): cover adapter failures and fix extraction CI * docs(lens): refresh bundled chart setup instructions * test(lens): restore gateway adapter test package marker * build(lens): pin clean-cut UI and supported storage chart * test(ui): await guardrail scope menu before checking options * perf(lens): omit unused trace-team lookup from product requests * docs(lens): record final-image adapter permission checks * test(lens): assert delegated investigation authorization * refactor(lens): remove copied trace runtime and preserve spend logging * test(lens): verify independent gateway image upgrades and outages * test(lens): pin the chart qualification database image * fix(lens): update embedded UI metadata filters * test: wait for Lens chart pod identity convergence * fix(e2e): select Lens chart pods by deployment ownership * fix(e2e): select Helm migration ownership for Lens upgrades * test(lens): retain migration Jobs through rollout assertions * docs(helm): require existing database for migration hooks * test(lens): qualify release boundaries with embedded navigation update * docs(lens): record browser qualification for embedded tabs * fix(lens): remove unrelated CI and guardrail test changes * test(lens): give qualification tenants unique key aliases * feat(lens): embed the latest canonical Lens interface * fix(lens): qualify split inference through the gateway * fix(lens): preserve scoped auth and isolate delegated credentials * chore(lens): remove unrelated documentation and lint changes * fix(lens): bound concurrent forwarding buffers through response delivery * fix(lens): preserve OAuth2 dispatch without inference policies * chore(lens): adopt current shared onboarding UI * fix(lens): refresh shared setup UI and review context * fix(lens): bound uploads before gateway authentication * docs(lens): remove extraction evidence from the gateway repo * docs(lens): refresh shared setup prompt for paired releases
58 lines
2.4 KiB
Python
58 lines
2.4 KiB
Python
from datetime import datetime, timezone
|
|
from typing import Final
|
|
|
|
from litellm.constants import AGENT_TRACING_AGENT_LIST_LIMIT, AGENT_TRACING_LIST_PAGE_SIZE
|
|
from litellm.tracing.generated.models import TraceAgentsParams
|
|
from litellm.tracing.generated.types import SpanDetail, SpanErrorPage, Trace, TracePage, TraceScope
|
|
from litellm.tracing.storage import LensTraceStorage
|
|
from litellm.tracing.types import TraceAgent, TraceAgentList
|
|
|
|
|
|
class TraceReceiver:
|
|
def __init__(self, storage: LensTraceStorage) -> None:
|
|
self.storage: Final = storage
|
|
|
|
async def list_traces(self, scope: TraceScope, start_ms: int, end_ms: int, cursor: str | None = None) -> TracePage:
|
|
return await self.storage.list_traces(scope, start_ms, end_ms, cursor, AGENT_TRACING_LIST_PAGE_SIZE)
|
|
|
|
async def list_agents(self, scope: TraceScope, start_ms: int, end_ms: int) -> TraceAgentList:
|
|
rows: Final = await self.storage.trace_agents(
|
|
TraceAgentsParams(
|
|
all_teams=scope["all_teams"],
|
|
user_id=scope["user_id"],
|
|
team_ids=tuple(scope["team_ids"]),
|
|
start_ms=start_ms,
|
|
end_ms=end_ms,
|
|
limit=AGENT_TRACING_AGENT_LIST_LIMIT,
|
|
)
|
|
)
|
|
return TraceAgentList(
|
|
agents=tuple(
|
|
TraceAgent(
|
|
name=row.agent_name,
|
|
runs=row.runs,
|
|
failed_runs=row.failed_runs,
|
|
last_seen=datetime.fromtimestamp(row.last_seen_ms / 1000, tz=timezone.utc),
|
|
frameworks=row.frameworks,
|
|
)
|
|
for row in rows
|
|
)
|
|
)
|
|
|
|
async def get_trace(
|
|
self,
|
|
trace_id: str,
|
|
scope: TraceScope,
|
|
trace_ref: str = "",
|
|
cursor: str | None = None,
|
|
page_size: int | None = None,
|
|
) -> Trace | None:
|
|
return await self.storage.get_trace(trace_id, scope, trace_ref, cursor, page_size)
|
|
|
|
async def get_span(self, trace_id: str, span_id: str, scope: TraceScope, trace_ref: str = "") -> SpanDetail | None:
|
|
return await self.storage.get_span(trace_id, span_id, scope, trace_ref)
|
|
|
|
async def get_span_error(
|
|
self, trace_id: str, span_id: str, scope: TraceScope, trace_ref: str = "", cursor: str | None = None
|
|
) -> SpanErrorPage | None:
|
|
return await self.storage.get_span_error(trace_id, span_id, scope, trace_ref, cursor)
|