forked from phoenix/litellm-mirror
proxy - return num callbacks on /health/readiness
This commit is contained in:
parent
a1814a3e4c
commit
23d334fe60
1 changed files with 14 additions and 1 deletions
|
@ -9208,7 +9208,19 @@ async def health_readiness():
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
# get success callback
|
# get success callback
|
||||||
|
_num_callbacks = 0
|
||||||
|
try:
|
||||||
|
_num_callbacks = (
|
||||||
|
len(litellm.callbacks)
|
||||||
|
+ len(litellm.input_callback)
|
||||||
|
+ len(litellm.failure_callback)
|
||||||
|
+ len(litellm.success_callback)
|
||||||
|
)
|
||||||
|
except:
|
||||||
|
_num_callbacks = 0
|
||||||
|
|
||||||
success_callback_names = []
|
success_callback_names = []
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# this was returning a JSON of the values in some of the callbacks
|
# 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)
|
# all we need is the callback name, hence we do str(callback)
|
||||||
|
@ -9236,13 +9248,13 @@ async def health_readiness():
|
||||||
# check DB
|
# check DB
|
||||||
if prisma_client is not None: # if db passed in, check if it's connected
|
if prisma_client is not None: # if db passed in, check if it's connected
|
||||||
db_health_status = _db_health_readiness_check()
|
db_health_status = _db_health_readiness_check()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"status": "healthy",
|
"status": "healthy",
|
||||||
"db": "connected",
|
"db": "connected",
|
||||||
"cache": cache_type,
|
"cache": cache_type,
|
||||||
"litellm_version": version,
|
"litellm_version": version,
|
||||||
"success_callbacks": success_callback_names,
|
"success_callbacks": success_callback_names,
|
||||||
|
"num_callbacks": _num_callbacks,
|
||||||
**db_health_status,
|
**db_health_status,
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
|
@ -9252,6 +9264,7 @@ async def health_readiness():
|
||||||
"cache": cache_type,
|
"cache": cache_type,
|
||||||
"litellm_version": version,
|
"litellm_version": version,
|
||||||
"success_callbacks": success_callback_names,
|
"success_callbacks": success_callback_names,
|
||||||
|
"num_callbacks": _num_callbacks,
|
||||||
}
|
}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise HTTPException(status_code=503, detail=f"Service Unhealthy ({str(e)})")
|
raise HTTPException(status_code=503, detail=f"Service Unhealthy ({str(e)})")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue