mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-16 04:29:31 +00:00
* feat(dev): seed linked tracing and spend fixtures * chore(dev): use OpenAI model in tracing config * chore(dev): align tracing credentials with UI E2E * fix(dev): update fixture seeder query scope * feat(dev): seed linked tracing and spend fixtures * chore(dev): use OpenAI model in tracing config * chore(dev): align tracing credentials with UI E2E * fix(dev): update fixture seeder query scope * wip * wip * wip * chore(trace): checkpoint ongoing Rust migration * refactor(trace): group Python bridge under trace package * refactor(traces): read span conventions through a Convention trait Each span format (Claude Code, LangSmith, OpenInference, gen_ai) now lives under normalize/convention/ as a unit struct implementing Convention, owning both its detection and its extraction. Precedence is one ordered registry instead of an if-chain in mod.rs that reached into each module differently. The modules now share one way to read attributes: present() for the first non-empty key and Payload for a text that also reports the key it consumed, replacing three different idioms and the &mut Vec threaded through payload readers. Instrumentation::adjust returns a new Extraction instead of mutating one, with each SDK rule as its own function, and the LangChain middleware suffix list exists once. * feat(trace): export Rust-owned wire schemas and enforce contract bounds * fix(trace): bound quoted counts in ClickHouse wire schemas * feat(trace): generate Python wire contracts with datamodel-code-generator * test(trace): validate migrated callers and generated contracts at the native boundary * refactor(traces): rename normalization convention to format * fix(traces): reconcile spend evidence and preserve unknown costs * feat(traces): normalize additional telemetry formats * test(traces): cover captured normalization fixtures * refactor(traces): isolate SDK normalization rules * feat(tracing): seed all trace exports for local dashboard * fix(clickhouse): preserve custom LiteLLM request metadata * docs(traces): define normalization module boundaries * docs(traces): define resolution and OTLP boundaries * fix(ui): normalize nullable trace message names * refactor(traces): split resolver modules and cover resolution behavior * test(traces): replace normalization snapshots with behavior assertions * fix(ui): align dashboard API contracts with generated types * refactor(traces): type normalization and storage boundaries * fix(traces): seed captured SDK spend and preserve provider identities * wip * test(traces): verify guide discovery and content ordering --------- Co-authored-by: Yujong Lee <yujong@berri.ai> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
60 lines
1.8 KiB
Python
60 lines
1.8 KiB
Python
import subprocess
|
|
from collections.abc import Generator, Iterator
|
|
from contextlib import contextmanager
|
|
from typing import Final
|
|
|
|
import httpx
|
|
import pytest
|
|
from tenacity import Retrying, retry_if_exception_type, stop_after_delay, wait_fixed
|
|
|
|
CLICKHOUSE_IMAGE: Final = (
|
|
"clickhouse/clickhouse-server:26.9.6.6@sha256:eb4870e7ca7ed70c259eebfcfbee6cf797017f6b5436c2926bbbfe3d4d28486e"
|
|
)
|
|
|
|
|
|
@contextmanager
|
|
def clickhouse_service() -> Generator[str]:
|
|
container: Final = subprocess.run(
|
|
(
|
|
"docker",
|
|
"run",
|
|
"--rm",
|
|
"--detach",
|
|
"--env",
|
|
"CLICKHOUSE_SKIP_USER_SETUP=1",
|
|
"--publish",
|
|
"127.0.0.1::8123",
|
|
CLICKHOUSE_IMAGE,
|
|
),
|
|
check=True,
|
|
capture_output=True,
|
|
text=True,
|
|
timeout=60,
|
|
).stdout.strip()
|
|
try:
|
|
address: Final = subprocess.run(
|
|
("docker", "port", container, "8123/tcp"),
|
|
check=True,
|
|
capture_output=True,
|
|
text=True,
|
|
timeout=10,
|
|
).stdout.strip()
|
|
url: Final = f"http://{address}"
|
|
with httpx.Client(timeout=1, trust_env=False) as client:
|
|
for attempt in Retrying(
|
|
retry=retry_if_exception_type((httpx.TransportError, httpx.HTTPStatusError)),
|
|
stop=stop_after_delay(30),
|
|
wait=wait_fixed(0.1),
|
|
reraise=True,
|
|
):
|
|
with attempt:
|
|
client.get(f"{url}/ping").raise_for_status()
|
|
yield url
|
|
finally:
|
|
subprocess.run(("docker", "rm", "--force", container), check=True, capture_output=True, timeout=30)
|
|
|
|
|
|
@pytest.fixture
|
|
def clickhouse_url() -> Iterator[str]:
|
|
with clickhouse_service() as url:
|
|
yield url
|