mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 19:54:13 +00:00
fix bug where slack would get inserting several times
This commit is contained in:
parent
a286a5af75
commit
b334b60c41
1 changed files with 36 additions and 4 deletions
|
@ -8708,11 +8708,11 @@ async def update_config(config_info: ConfigYAML):
|
||||||
# overwrite existing settings with updated values
|
# overwrite existing settings with updated values
|
||||||
if k == "alert_to_webhook_url":
|
if k == "alert_to_webhook_url":
|
||||||
# check if slack is already enabled. if not, enable it
|
# check if slack is already enabled. if not, enable it
|
||||||
if "slack" not in _existing_settings:
|
if "alerting" not in _existing_settings:
|
||||||
if "alerting" not in _existing_settings:
|
_existing_settings["alerting"] = ["slack"]
|
||||||
|
elif isinstance(_existing_settings["alerting"], list):
|
||||||
|
if "slack" not in _existing_settings["alerting"]:
|
||||||
_existing_settings["alerting"] = ["slack"]
|
_existing_settings["alerting"] = ["slack"]
|
||||||
elif isinstance(_existing_settings["alerting"], list):
|
|
||||||
_existing_settings["alerting"].append("slack")
|
|
||||||
_existing_settings[k] = v
|
_existing_settings[k] = v
|
||||||
config["general_settings"] = _existing_settings
|
config["general_settings"] = _existing_settings
|
||||||
|
|
||||||
|
@ -9197,6 +9197,37 @@ def _db_health_readiness_check():
|
||||||
return db_health_cache
|
return db_health_cache
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/active/callbacks",
|
||||||
|
tags=["health"],
|
||||||
|
dependencies=[Depends(user_api_key_auth)],
|
||||||
|
)
|
||||||
|
async def active_callbacks():
|
||||||
|
_alerting = str(general_settings.get("alerting"))
|
||||||
|
# get success callback
|
||||||
|
success_callback_names = []
|
||||||
|
try:
|
||||||
|
# this was returning a JSON of the values in some of the callbacks
|
||||||
|
# all we need is the callback name, hence we do str(callback)
|
||||||
|
success_callback_names = [str(x) for x in litellm.success_callback]
|
||||||
|
except:
|
||||||
|
# don't let this block the /health/readiness response, if we can't convert to str -> return litellm.success_callback
|
||||||
|
success_callback_names = litellm.success_callback
|
||||||
|
|
||||||
|
_num_callbacks = (
|
||||||
|
len(litellm.callbacks)
|
||||||
|
+ len(litellm.input_callback)
|
||||||
|
+ len(litellm.failure_callback)
|
||||||
|
+ len(litellm.success_callback)
|
||||||
|
)
|
||||||
|
|
||||||
|
return {
|
||||||
|
"alerting": _alerting,
|
||||||
|
"success_callbacks": success_callback_names,
|
||||||
|
"num_callbacks": _num_callbacks,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@router.get(
|
@router.get(
|
||||||
"/health/readiness",
|
"/health/readiness",
|
||||||
tags=["health"],
|
tags=["health"],
|
||||||
|
@ -9206,6 +9237,7 @@ async def health_readiness():
|
||||||
"""
|
"""
|
||||||
Unprotected endpoint for checking if worker can receive requests
|
Unprotected endpoint for checking if worker can receive requests
|
||||||
"""
|
"""
|
||||||
|
global general_settings
|
||||||
try:
|
try:
|
||||||
# get success callback
|
# get success callback
|
||||||
success_callback_names = []
|
success_callback_names = []
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue