mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-14 09:03:16 +00:00
merge: preserve spend logs as the gateway trace source
This commit is contained in:
commit
dfaae27a6b
3 changed files with 7 additions and 9 deletions
|
|
@ -1971,12 +1971,11 @@ async def _proxy_lifespan(app: FastAPI, resources: AsyncExitStack) -> AsyncGener
|
|||
TypeAdapter(dict[str, object] | None).validate_python(general_settings.get("tracing")),
|
||||
)
|
||||
tracing_enabled: Final = is_lens_tracing_enabled(tracing_settings)
|
||||
async with manage_tracing(
|
||||
enabled=tracing_enabled,
|
||||
settings=tracing_settings,
|
||||
fallback_factory=lambda: _spend_log_trace_receiver(database),
|
||||
) as receiver:
|
||||
state: Final[ProxyLifespanState] = {"tracing_receiver": receiver, "database": database}
|
||||
async with manage_tracing(enabled=tracing_enabled, settings=tracing_settings):
|
||||
state: Final[ProxyLifespanState] = {
|
||||
"tracing_receiver": _spend_log_trace_receiver(database),
|
||||
"database": database,
|
||||
}
|
||||
from litellm.proxy.admin_mcp import admin_mcp_lifespan
|
||||
|
||||
telemetry_settings: Final = load_telemetry_settings()
|
||||
|
|
|
|||
|
|
@ -40,10 +40,9 @@ async def manage_tracing(
|
|||
receiver_factory: Callable[[], TraceReceiver] | None = None,
|
||||
settings: Mapping[str, object] | None = None,
|
||||
client_factory: Callable[[LensConnection], httpx.AsyncClient] = LensConnection.lifespan_client,
|
||||
fallback_factory: Callable[[], TraceReceiver | None] = lambda: None,
|
||||
) -> AsyncGenerator[TraceReceiver | None, None]:
|
||||
if not enabled:
|
||||
yield fallback_factory()
|
||||
yield None
|
||||
return
|
||||
try:
|
||||
connection: Final = LensConnection.from_env()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# Lens gateway boundary
|
||||
|
||||
- Lens owns the canonical trace schemas and its service's normalization, storage, graph assembly and querying in `BerriAI/lens`
|
||||
- This package owns the HTTP client, gateway response validation and asynchronous gateway spend export. When no Lens service is configured, its read-only Postgres spend-log adapter provides embedded agent traces using existing spend-log permissions. It does not ingest OTLP or implement Lens analysis
|
||||
- This package owns the HTTP client, gateway response validation, asynchronous gateway spend export and the read-only Postgres spend-log adapter. Trace reads always come from spend logs, even when a Lens service is configured, using existing spend-log permissions. It does not ingest OTLP or implement Lens analysis
|
||||
- Gateway endpoints preserve authenticated user/team scope, trace references, pagination and public error categories
|
||||
- `generated/` comes from `scripts/generate_trace_types.py` using the Lens schemas pinned in `scripts/lens_assets/source.json`. Update the canonical Lens Rust contracts and import their schema outputs before regenerating. Never edit generated Python
|
||||
- Keep the pinned schema and fixture checksums current. CI verifies assets and regenerated Python without a Rust trace implementation in this repository
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue