mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
(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:
parent
4d1b4beb3d
commit
603299e3c8
4 changed files with 99 additions and 11 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue