mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 19:24:27 +00:00
correct use of healthy / unhealthy
This commit is contained in:
parent
578f9c91af
commit
c133ba25d9
3 changed files with 9 additions and 5 deletions
|
@ -338,7 +338,7 @@ Response when logging callbacks are setup correctly:
|
||||||
Response when logging callbacks are not setup correctly:
|
Response when logging callbacks are not setup correctly:
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"key": "healthy",
|
"key": "unhealthy",
|
||||||
"logging_callbacks": {
|
"logging_callbacks": {
|
||||||
"callbacks": [
|
"callbacks": [
|
||||||
"gcs_bucket"
|
"gcs_bucket"
|
||||||
|
|
|
@ -1927,10 +1927,10 @@ class CurrentItemRateLimit(TypedDict):
|
||||||
|
|
||||||
class LoggingCallbackStatus(TypedDict, total=False):
|
class LoggingCallbackStatus(TypedDict, total=False):
|
||||||
callbacks: List[str]
|
callbacks: List[str]
|
||||||
status: str
|
status: Literal["healthy", "unhealthy"]
|
||||||
details: Optional[str]
|
details: Optional[str]
|
||||||
|
|
||||||
|
|
||||||
class KeyHealthResponse(TypedDict, total=False):
|
class KeyHealthResponse(TypedDict, total=False):
|
||||||
key: str
|
key: Literal["healthy", "unhealthy"]
|
||||||
logging_callbacks: Optional[LoggingCallbackStatus]
|
logging_callbacks: Optional[LoggingCallbackStatus]
|
||||||
|
|
|
@ -1496,7 +1496,7 @@ async def key_health(
|
||||||
Response when logging callbacks are not setup correctly:
|
Response when logging callbacks are not setup correctly:
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"key": "healthy",
|
"key": "unhealthy",
|
||||||
"logging_callbacks": {
|
"logging_callbacks": {
|
||||||
"callbacks": [
|
"callbacks": [
|
||||||
"gcs_bucket"
|
"gcs_bucket"
|
||||||
|
@ -1525,6 +1525,10 @@ async def key_health(
|
||||||
)
|
)
|
||||||
health_status["logging_callbacks"] = logging_statuses
|
health_status["logging_callbacks"] = logging_statuses
|
||||||
|
|
||||||
|
# Check if any logging callback is unhealthy
|
||||||
|
if logging_statuses.get("status") == "unhealthy":
|
||||||
|
health_status["key"] = "unhealthy"
|
||||||
|
|
||||||
return KeyHealthResponse(**health_status)
|
return KeyHealthResponse(**health_status)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -1591,7 +1595,7 @@ async def test_key_logging(
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return LoggingCallbackStatus(
|
return LoggingCallbackStatus(
|
||||||
callbacks=logging_callbacks,
|
callbacks=logging_callbacks,
|
||||||
status="error",
|
status="unhealthy",
|
||||||
details=f"Logging test failed: {str(e)}",
|
details=f"Logging test failed: {str(e)}",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue