mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 11:43:54 +00:00
feat return alert types on /config/get/callback
This commit is contained in:
parent
2e62b0059c
commit
58eea0f330
2 changed files with 24 additions and 1 deletions
|
@ -2283,6 +2283,7 @@ class ProxyConfig:
|
||||||
proxy_logging_obj.update_values(
|
proxy_logging_obj.update_values(
|
||||||
alerting=general_settings.get("alerting", None),
|
alerting=general_settings.get("alerting", None),
|
||||||
alerting_threshold=general_settings.get("alerting_threshold", 600),
|
alerting_threshold=general_settings.get("alerting_threshold", 600),
|
||||||
|
alert_types=general_settings.get("alert_types", None),
|
||||||
redis_cache=redis_usage_cache,
|
redis_cache=redis_usage_cache,
|
||||||
)
|
)
|
||||||
### CONNECT TO DATABASE ###
|
### CONNECT TO DATABASE ###
|
||||||
|
@ -8354,7 +8355,15 @@ async def get_config():
|
||||||
)
|
)
|
||||||
_slack_env_vars[_var] = _decrypted_value
|
_slack_env_vars[_var] = _decrypted_value
|
||||||
|
|
||||||
_data_to_return.append({"name": "slack", "variables": _slack_env_vars})
|
_alerting_types = proxy_logging_obj.alert_types
|
||||||
|
|
||||||
|
_data_to_return.append(
|
||||||
|
{
|
||||||
|
"name": "slack",
|
||||||
|
"variables": _slack_env_vars,
|
||||||
|
"alerting_types": _alerting_types,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
_router_settings = llm_router.get_settings()
|
_router_settings = llm_router.get_settings()
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -85,6 +85,17 @@ class ProxyLogging:
|
||||||
alerting: Optional[List],
|
alerting: Optional[List],
|
||||||
alerting_threshold: Optional[float],
|
alerting_threshold: Optional[float],
|
||||||
redis_cache: Optional[RedisCache],
|
redis_cache: Optional[RedisCache],
|
||||||
|
alert_types: Optional[
|
||||||
|
List[
|
||||||
|
Literal[
|
||||||
|
"llm_exceptions",
|
||||||
|
"llm_too_slow",
|
||||||
|
"llm_requests_hanging",
|
||||||
|
"budget_alerts",
|
||||||
|
"db_exceptions",
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
):
|
):
|
||||||
self.alerting = alerting
|
self.alerting = alerting
|
||||||
if alerting_threshold is not None:
|
if alerting_threshold is not None:
|
||||||
|
@ -93,6 +104,9 @@ class ProxyLogging:
|
||||||
if redis_cache is not None:
|
if redis_cache is not None:
|
||||||
self.internal_usage_cache.redis_cache = redis_cache
|
self.internal_usage_cache.redis_cache = redis_cache
|
||||||
|
|
||||||
|
if alert_types is not None:
|
||||||
|
self.alert_types = alert_types
|
||||||
|
|
||||||
def _init_litellm_callbacks(self):
|
def _init_litellm_callbacks(self):
|
||||||
print_verbose(f"INITIALIZING LITELLM CALLBACKS!")
|
print_verbose(f"INITIALIZING LITELLM CALLBACKS!")
|
||||||
litellm.callbacks.append(self.max_parallel_request_limiter)
|
litellm.callbacks.append(self.max_parallel_request_limiter)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue