forked from phoenix/litellm-mirror
fix prometheus track cooldown events on custom logger (#6060)
This commit is contained in:
parent
6e97bc4404
commit
224460d4c9
2 changed files with 18 additions and 8 deletions
|
@ -3,8 +3,14 @@ model_list:
|
||||||
litellm_params:
|
litellm_params:
|
||||||
model: openai/gpt-5
|
model: openai/gpt-5
|
||||||
api_key: fake-key
|
api_key: fake-key
|
||||||
api_base: https://exampleopenaiendpoint-production.up.railway.app/
|
api_base: https://exampleopenaiendpoint-production.up.railwaz.app/
|
||||||
|
- model_name: db-openai-endpoint
|
||||||
|
litellm_params:
|
||||||
|
model: openai/gpt-5
|
||||||
|
api_key: fake-key
|
||||||
|
api_base: https://exampleopenaiendpoint-production.up.railwxaz.app/
|
||||||
|
|
||||||
|
litellm_settings:
|
||||||
|
callbacks: ["prometheus"]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ Callbacks triggered on cooling down deployments
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
from typing import TYPE_CHECKING, Any, Union
|
from typing import TYPE_CHECKING, Any, Optional, Union
|
||||||
|
|
||||||
import litellm
|
import litellm
|
||||||
from litellm._logging import verbose_logger
|
from litellm._logging import verbose_logger
|
||||||
|
@ -57,12 +57,16 @@ async def router_cooldown_event_callback(
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Trigger cooldown on Prometheus
|
# Trigger cooldown on Prometheus
|
||||||
|
from litellm.integrations.custom_logger import CustomLogger
|
||||||
from litellm.integrations.prometheus import PrometheusLogger
|
from litellm.integrations.prometheus import PrometheusLogger
|
||||||
|
from litellm.litellm_core_utils.litellm_logging import (
|
||||||
|
get_custom_logger_compatible_class,
|
||||||
|
)
|
||||||
|
|
||||||
prometheusLogger = None
|
# get the prometheus logger from in memory loggers
|
||||||
for callback in litellm.callbacks:
|
prometheusLogger: Optional[CustomLogger] = get_custom_logger_compatible_class(
|
||||||
if isinstance(callback, PrometheusLogger):
|
logging_integration="prometheus",
|
||||||
prometheusLogger = callback
|
)
|
||||||
|
|
||||||
if prometheusLogger is not None:
|
if prometheusLogger is not None:
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue