-
Notifications
You must be signed in to change notification settings - Fork 314
chore(kagent-adk/session_service): add logging for Kagent API errors #1029
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -47,7 +47,11 @@ async def create_session( | |||||||||
| json=request_data, | ||||||||||
| headers={"X-User-ID": user_id}, | ||||||||||
| ) | ||||||||||
| response.raise_for_status() | ||||||||||
| try: | ||||||||||
| response.raise_for_status() | ||||||||||
| except httpx.HTTPStatusError: | ||||||||||
| logger.error(f"Failed to create session: {response.text}") | ||||||||||
mozillazg marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
| logger.error(f"Failed to create session: {response.text}") | |
| logger.error( | |
| f"Failed to create session: status_code={response.status_code}, reason={response.reason_phrase}" | |
| ) |
Copilot
AI
Oct 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logging the full response text could potentially expose sensitive information. Consider logging only the status code and reason phrase, or sanitize the response content before logging.
Copilot
AI
Oct 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error handling pattern is duplicated across multiple methods. Consider extracting this into a helper method or decorator to reduce code duplication and improve maintainability.
Copilot
AI
Oct 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logging the full response text could potentially expose sensitive information. Consider logging only the status code and reason phrase, or sanitize the response content before logging.
| logger.error(f"Failed to list sessions: {response.text}") | |
| logger.error(f"Failed to list sessions: status_code={response.status_code}, reason={getattr(response, 'reason_phrase', '')}") |
Copilot
AI
Oct 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error handling pattern is duplicated across multiple methods. Consider extracting this into a helper method or decorator to reduce code duplication and improve maintainability.
Copilot
AI
Oct 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logging the full response text could potentially expose sensitive information. Consider logging only the status code and reason phrase, or sanitize the response content before logging.
Copilot
AI
Oct 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error handling pattern is duplicated across multiple methods. Consider extracting this into a helper method or decorator to reduce code duplication and improve maintainability.
Copilot
AI
Oct 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logging the full response text could potentially expose sensitive information. Consider logging only the status code and reason phrase, or sanitize the response content before logging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error handling pattern is duplicated across multiple methods. Consider extracting this into a helper method or decorator to reduce code duplication and improve maintainability.