mirror of
https://github.com/BerriAI/litellm.git
synced 2026-12-05 01:59:27 +00:00
Some checks failed
CodSpeed Benchmarks / benchmarks (push) Waiting to run
Deploy main to gateway-dev / dispatch (push) Waiting to run
Publish lint base counts / publish (basedpyright, scripts/type_check_gate.py) (push) Waiting to run
Publish lint base counts / publish (openapi-docs, scripts/openapi_docs_gate.py) (push) Waiting to run
Publish lint base counts / publish (ruff-strict, scripts/ruff_strict_gate.py) (push) Waiting to run
Publish lint base counts / publish (test-quality, scripts/test_quality_gate.py) (push) Waiting to run
Publish lint base counts / publish (type-discipline, scripts/type_discipline_gate.py) (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
LiteLLM Rust / rust-lint (push) Waiting to run
LiteLLM Rust / rust-test (push) Waiting to run
LiteLLM Rust / rust-wheel (push) Waiting to run
unit / proxy-auth (push) Blocked by required conditions
unit / proxy-extras (push) Blocked by required conditions
unit / proxy-feature-endpoints (push) Blocked by required conditions
unit / proxy-hooks-client (push) Blocked by required conditions
unit / mcp-elicitation (push) Blocked by required conditions
unit / mcp-server (push) Blocked by required conditions
unit / proxy-endpoints (push) Blocked by required conditions
unit / proxy-infra (push) Blocked by required conditions
unit / proxy-infra-root (push) Blocked by required conditions
unit / responses-caching-types (push) Blocked by required conditions
unit / router (push) Blocked by required conditions
unit / rust-bridge-harness (push) Blocked by required conditions
unit / auth-checks (push) Blocked by required conditions
unit / custom-logging (push) Blocked by required conditions
unit / db-and-spend (push) Blocked by required conditions
unit / endpoints-and-responses (push) Blocked by required conditions
unit / proxy-runtime (push) Blocked by required conditions
unit / proxy-server-core (push) Blocked by required conditions
unit / proxy-utils (push) Blocked by required conditions
unit / caching-local (push) Blocked by required conditions
unit / core-utils (push) Blocked by required conditions
unit / budgets (push) Blocked by required conditions
unit / enterprise-routing (push) Blocked by required conditions
unit / guardrails-hooks (push) Blocked by required conditions
unit / jwt-and-keys (push) Blocked by required conditions
unit / key-generation (push) Blocked by required conditions
unit / logging-misc (push) Blocked by required conditions
unit / mcp-oauth (push) Blocked by required conditions
unit / root (push) Blocked by required conditions
unit / assert-shard-coverage (push) Waiting to run
unit / enterprise-managed-files (push) Blocked by required conditions
unit / enterprise-repositories-secrets (push) Blocked by required conditions
unit / proxy-server (push) Blocked by required conditions
unit / lens-python-310 (push) Blocked by required conditions
unit / endpoints (push) Blocked by required conditions
unit / enterprise-package (push) Blocked by required conditions
unit / integrations (push) Blocked by required conditions
unit / ui-unit (push) Waiting to run
unit / rust-bridge (push) Waiting to run
unit / llms-anthropic (push) Blocked by required conditions
unit / llms-bedrock (push) Blocked by required conditions
unit / llms-openai-meta (push) Blocked by required conditions
unit / llms-providers (push) Blocked by required conditions
unit / llms-vertex-ai (push) Blocked by required conditions
unit / docs (push) Waiting to run
unit / helm (push) Waiting to run
unit / OpenAI 2.20.0 compatibility (push) Waiting to run
unit / OpenAI 3.0.0 compatibility (push) Waiting to run
unit / OpenAI 3.25.0 compatibility (push) Waiting to run
unit / redis-py 5.3.1 compatibility (push) Blocked by required conditions
unit / redis-py 6.4.0 compatibility (push) Blocked by required conditions
GitHub Actions Security Analysis / zizmor (push) Waiting to run
unit / redis-py 7.4.1 compatibility (push) Blocked by required conditions
unit / redis-py 8.0.1 compatibility (push) Blocked by required conditions
unit / coverage (push) Blocked by required conditions
unit / unit passed (push) Blocked by required conditions
Terraform Provider / gofmt, vet, build, test (push) Has been cancelled
Terraform Provider / Provider endpoints vs proxy OpenAPI schema (push) Has been cancelled
* test(e2e): mixed_size_requests_2rps perf case (coding-agent bodies, JWT and key callers, two guardrails) * test(e2e_harness): test_observe builds DbCounters with statements and expects the background Postgres line --------- Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
73 lines
2.3 KiB
Python
73 lines
2.3 KiB
Python
from __future__ import annotations
|
|
|
|
from dataclasses import replace
|
|
from typing import Final
|
|
|
|
from cases.small_bodies_5rps import CASE
|
|
from memory_readings import RssCapture
|
|
from setup.datastore import DbCounters, StatementCalls
|
|
from setup.observe import Observation, evaluate, junit_properties
|
|
from setup.performance_test_case import Limit
|
|
from setup.wire import WireRecord
|
|
|
|
NO_RSS: Final = RssCapture(readings=(), failures=())
|
|
|
|
|
|
def served(seq: int, total_s: float) -> WireRecord:
|
|
return WireRecord(
|
|
seq=seq,
|
|
marker=f"perfreq-{seq:06d}-n",
|
|
caller="key-a1",
|
|
endpoint="chat_completions",
|
|
stream=False,
|
|
blocked=False,
|
|
started_at=0.0,
|
|
status=200,
|
|
header_s=total_s,
|
|
first_byte_s=total_s,
|
|
first_token_s=None,
|
|
total_s=total_s,
|
|
text="",
|
|
ok=True,
|
|
mock_delay_s=1.0,
|
|
call_id=None,
|
|
error=None,
|
|
)
|
|
|
|
|
|
def _key_lookup(calls: int) -> StatementCalls:
|
|
return StatementCalls(queryid=1, query='SELECT * FROM "LiteLLM_VerificationToken" WHERE token = $1', calls=calls)
|
|
|
|
|
|
def test_junit_properties_carry_each_observed_metric_and_each_limit_including_unobserved_ones() -> None:
|
|
case: Final = replace(
|
|
CASE,
|
|
limits=(
|
|
Limit("gateway_added_seconds", percentile=50, max=0.625),
|
|
Limit("redis_calls_per_request", max=35),
|
|
),
|
|
)
|
|
observation: Final = Observation(
|
|
records=(served(0, 1.25), served(1, 1.5), served(2, 1.75)),
|
|
mock_requests=(),
|
|
guardrail_calls=(),
|
|
rss_before=NO_RSS,
|
|
rss_after=NO_RSS,
|
|
wall_seconds=3.0,
|
|
db_before=DbCounters(commits=100, statements=(_key_lookup(calls=100),)),
|
|
db_after=DbCounters(commits=130, statements=(_key_lookup(calls=130),)),
|
|
)
|
|
rows, _ = evaluate(case, observation)
|
|
|
|
properties: Final = junit_properties(rows)
|
|
|
|
assert len({name for name, _ in properties}) == len(properties)
|
|
assert dict(properties) == {
|
|
"perf_unexpected_status_count": 0.0,
|
|
"perf_gateway_added_seconds_p50": 0.5,
|
|
"perf_gateway_added_seconds_p50_limit": 0.625,
|
|
"perf_gateway_added_seconds_p99": 0.75,
|
|
"perf_postgres_calls_per_request": 10.0,
|
|
"perf_postgres_background_calls_per_request": 0.0,
|
|
"perf_redis_calls_per_request_limit": 35.0,
|
|
}
|