Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/app/endpoints/health.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
ProviderHealthStatus,
)

logger = logging.getLogger(__name__)
logger = logging.getLogger("app.endpoints.handlers")
router = APIRouter(tags=["health"])

auth_dependency = get_auth_dependency()
Expand Down Expand Up @@ -93,6 +93,8 @@ async def readiness_probe_get_method(
# Used only for authorization
_ = auth

logger.info("Response to /v1/readiness endpoint")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Health endpoints: avoid high-volume INFO logs; demote and log outcomes instead.

These endpoints are hit frequently (Kubernetes probes); INFO here will flood logs. Use DEBUG for requests and WARNING/INFO once per failure/transition with fields.

Apply:

-    logger.info("Response to /v1/readiness endpoint")
+    logger.debug("GET /v1/readiness requested")
-    logger.info("Response to /v1/liveness endpoint")
+    logger.debug("GET /v1/liveness requested")

Then, add outcome logs near the decision (outside the changed lines):

# after computing ready/reason/unhealthy_provider_names, before return
if unhealthy_providers:
    logger.warning(
        "Readiness failed",
        extra={"ready": False, "reason": reason, "unhealthy": unhealthy_provider_names},
    )
else:
    logger.debug(
        "Readiness ok",
        extra={"ready": True, "reason": reason},
    )

Also applies to: 140-140

🤖 Prompt for AI Agents
In src/app/endpoints/health.py around lines 96 and 140, the health endpoint
currently emits high-volume INFO logs; change the logger.info calls on those
lines to logger.debug to avoid log flooding from frequent probes, and then add
outcome logs immediately after the readiness decision (after computing
ready/reason/unhealthy_provider_names) as described: if there are unhealthy
providers emit a logger.warning with extra={"ready": False, "reason": reason,
"unhealthy": unhealthy_provider_names}, otherwise emit a logger.debug with
extra={"ready": True, "reason": reason}. Ensure the new outcome logging is
placed outside the changed lines and uses the computed variables.


provider_statuses = await get_providers_health_statuses()

# Check if any provider is unhealthy (not counting not_implemented as unhealthy)
Expand Down Expand Up @@ -135,4 +137,6 @@ async def liveness_probe_get_method(
# Used only for authorization
_ = auth

logger.info("Response to /v1/liveness endpoint")

return LivenessResponse(alive=True)
7 changes: 6 additions & 1 deletion src/app/endpoints/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from models.responses import InfoResponse
from version import __version__

logger = logging.getLogger(__name__)
logger = logging.getLogger("app.endpoints.handlers")
router = APIRouter(tags=["info"])

auth_dependency = get_auth_dependency()
Expand Down Expand Up @@ -58,12 +58,17 @@ async def info_endpoint_handler(
# Nothing interesting in the request
_ = request

logger.info("Response to /v1/info endpoint")

try:
# try to get Llama Stack client
client = AsyncLlamaStackClientHolder().get_client()
# retrieve version
llama_stack_version_object = await client.inspect.version()
llama_stack_version = llama_stack_version_object.version
logger.debug("Service name: %s", configuration.configuration.name)
logger.debug("Service version: %s", __version__)
logger.debug("LLama Stack version: %s", llama_stack_version)
return InfoResponse(
name=configuration.configuration.name,
service_version=__version__,
Expand Down
Loading