(feat) prometheus have well defined latency buckets (#6211)

* fix prometheus have well defined latency buckets

* use a well define latency bucket

* use types file for prometheus logging

* add test for LATENCY_BUCKETS
This commit is contained in:
Ishaan Jaff 2024-10-14 17:16:01 +05:30 committed by GitHub
parent 4d1b4beb3d
commit 603299e3c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 99 additions and 11 deletions

View file

@ -16,13 +16,9 @@ import litellm
from litellm._logging import print_verbose, verbose_logger
from litellm.integrations.custom_logger import CustomLogger
from litellm.proxy._types import UserAPIKeyAuth
from litellm.types.integrations.prometheus import *
from litellm.types.utils import StandardLoggingPayload
REQUESTED_MODEL = "requested_model"
EXCEPTION_STATUS = "exception_status"
EXCEPTION_CLASS = "exception_class"
EXCEPTION_LABELS = [EXCEPTION_STATUS, EXCEPTION_CLASS]
class PrometheusLogger(CustomLogger):
# Class variables or attributes
@ -85,6 +81,7 @@ class PrometheusLogger(CustomLogger):
"team",
"team_alias",
],
buckets=LATENCY_BUCKETS,
)
self.litellm_llm_api_latency_metric = Histogram(
@ -97,6 +94,7 @@ class PrometheusLogger(CustomLogger):
"team",
"team_alias",
],
buckets=LATENCY_BUCKETS,
)
# Counter for spend