Better observability for errors in token refresh#782
Open
makhalin wants to merge 3 commits intoydb-platform:mainfrom
Open
Better observability for errors in token refresh#782makhalin wants to merge 3 commits intoydb-platform:mainfrom
makhalin wants to merge 3 commits intoydb-platform:mainfrom
Conversation
Collaborator
|
Hi @makhalin ! thanks for this PR. can you create an Issue for this PR and link it in PR description? |
There was a problem hiding this comment.
Pull request overview
Improves error observability during credential token refresh by ensuring exception tracebacks are included in logs, making refresh failures diagnosable in production.
Changes:
- Include exception traceback when sync token refresh fails (
exc_info=True). - Include exception traceback when async token refresh fails (
exc_info=True).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| ydb/credentials.py | Adds traceback logging on token refresh failure in sync credentials flow. |
| ydb/aio/credentials.py | Adds traceback logging on token refresh failure in async credentials flow. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| except Exception as e: | ||
| self.last_error = str(e) | ||
| self.logger.error("Failed to refresh token: %s", e) | ||
| self.logger.error("Failed to refresh token: %s", e, exc_info=True) |
| except Exception as e: | ||
| self.last_error = str(e) | ||
| self.logger.error("Failed to refresh token async: %s", e) | ||
| self.logger.error("Failed to refresh token async: %s", e, exc_info=True) |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The current logging behavior for problems in token refresh doesn't have enough information. This resulted in us getting a line in the logs like
Failed to refresh token async:, which is impossible to understand. This MR suggests improving this section and displaying the log with a full traceback.You can read about
exc_infoin the official doc https://docs.python.org/3/library/logging.html#logging.Logger.debug.Pull request type
Please check the type of change your PR introduces:
What is the current behavior?
Issue Number: N/A
No traceback is printed in logs.
What is the new behavior?
The full traceback of an error is printed in logs.
Other information