-
Notifications
You must be signed in to change notification settings - Fork 930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(agents-api): Add /healthz
endpoint
#975
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
62fb581
chore(agents-api): Add `/healthz` endpoint
HamadaSalhab da9dd5b
refactor: Lint agents-api (CI)
HamadaSalhab f6a49ec
Fix code scanning alert no. 4: Information exposure through an exception
creatorrr 54b8ff6
refactor: Lint agents-api (CI)
creatorrr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# ruff: noqa: F401 | ||
from .check_health import check_health | ||
from .router import router |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from uuid import UUID | ||
|
||
from ...autogen.openapi_model import Agent, ListResponse | ||
from ...models.agent.list_agents import list_agents as list_agents_query | ||
from .router import router | ||
|
||
|
||
@router.get("/healthz", tags=["healthz"]) | ||
async def check_health() -> dict: | ||
try: | ||
# Check if the database is reachable | ||
agents = list_agents_query( | ||
developer_id=UUID("00000000-0000-0000-0000-000000000000"), | ||
) | ||
except Exception as e: | ||
return {"status": "error", "message": str(e)} | ||
|
||
return {"status": "ok"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from fastapi import APIRouter | ||
|
||
router: APIRouter = APIRouter() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / CodeQL
Information exposure through an exception Medium
Copilot Autofix AI 2 months ago
To fix the problem, we need to ensure that detailed error information is not exposed to the user. Instead, we should log the detailed error message on the server side and return a generic error message to the user. This can be achieved by modifying the exception handling block to log the exception and return a generic error message.
logging
module to enable logging of exceptions.logging
module.