mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-24 02:25:29 +00:00
feat(prometheus): add 7m and 10m latency histogram buckets (#25071)
Extend LATENCY_BUCKETS beyond 5 minutes so request/LLM latency metrics can distinguish long runs up to the typical default LLM request timeout. Made-with: Cursor
This commit is contained in:
@@ -156,6 +156,8 @@ LATENCY_BUCKETS = (
|
||||
180.0,
|
||||
240.0,
|
||||
300.0,
|
||||
420.0, # 7 minutes
|
||||
600.0, # 10 minutes (typical default LLM request timeout)
|
||||
float("inf"),
|
||||
)
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
"""LATENCY_BUCKETS covers long-running LLM calls (histograms are in seconds)."""
|
||||
|
||||
import math
|
||||
|
||||
from litellm.types.integrations.prometheus import LATENCY_BUCKETS
|
||||
|
||||
|
||||
def test_latency_buckets_include_seven_and_ten_minutes():
|
||||
"""Buckets beyond 5 min so histograms resolve requests up to default LLM timeouts."""
|
||||
assert 300.0 in LATENCY_BUCKETS
|
||||
assert 420.0 in LATENCY_BUCKETS # 7 min
|
||||
assert 600.0 in LATENCY_BUCKETS # 10 min
|
||||
assert math.isinf(LATENCY_BUCKETS[-1])
|
||||
idx_300 = LATENCY_BUCKETS.index(300.0)
|
||||
idx_420 = LATENCY_BUCKETS.index(420.0)
|
||||
idx_600 = LATENCY_BUCKETS.index(600.0)
|
||||
assert idx_300 < idx_420 < idx_600
|
||||
Reference in New Issue
Block a user