-
Notifications
You must be signed in to change notification settings - Fork 17.8k
chore: add logs to db test connection and post failures #13223
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
a6f9c78
add logs to db test connection and post failures
hughhhh d59e224
yerp
hughhhh 07c3fb3
fix the logs
hughhhh 9a84f7e
remove
hughhhh df6d508
change the logs
hughhhh 732a638
add more information
hughhhh 0bf3b38
fix this
hughhhh dc1d2c4
add info for engine
hughhhh 94e17d3
fix merge conflicts
hughhhh 9fa0f73
remove unneeded code
hughhhh 99c5eca
Merge branch 'master' of https://github.com/apache/incubator-superset…
hughhhh 65dadfd
move stats to commands
hughhhh 12c9acc
add stats for engine
hughhhh eb697ec
clean up stat reference
hughhhh 23d9411
just to see the results of this test
hughhhh 0af5cab
working test
hughhhh 23a7a6f
another working test
hughhhh 42ae1cd
add db api exception
hughhhh d323eb1
cleanup
hughhhh 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 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
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.
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.
Can we downgrade these from exception logging? Connection failures are an expected part of setting up new database connections and shouldn't wind up in exception tracking systems.
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.
If you want to understand the reasons for failures, it would also be a good idea to log the exception. However, beware: these exceptions frequently contain database credentials, which it would be bad to track.
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.
Good point on the level. Just a note, @willbarrett:
@logger.exceptionlogs the full traceback plus the message, so it would've helped figuring out the reason.Uh oh!
There was an error while loading. Please reload this page.
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.
logger.warning("Database connection failed", exc_info=True)also achieves the same. As the one currently running the error/exception logs portion of our biweekly alerts review, I would greatly appreciate if we reduced the amount of expected exceptions being logged at error and exception level. It would make my job significantly easier, as well as help reduce the strain on our log quotaUh oh!
There was an error while loading. Please reload this page.
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.
I agree with @willbarrett concern, unfortunately some engines dbapi surface exceptions with sensitive information
logger.warning("Database connection failed", exc_info=True)will actually log this info. we can lower it todebug, since on normal situations production systems are not set to this level.Also there's an ongoing effort to remap these exceptions at the engine spec level #12869, so that we can add more granularity to connection failures for example
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.
I'm now wondering if there's a better way to get the info that @betodealmeida and @hughhhh are looking for - would you be able to describe the questions that you're trying to answer with this logging? Then we can support you better in coming to a safe solution.
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.
We want to answer the following:
What db engines are failing the most?
What are the test connection and db connection exception error for these db engines?
If we can get this information with other data let us know
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.
What DB engines are failing the most?
I think you could parse the submitted SQLAlchemy URL to pull out the
schemeportion of the URL and log that on failure. This would avoid the risk of capturing secure credentials.What are the the test connection and DB connection exceptions for these engines?
Would it be sufficient to log the exception class from the engine without the message? The class will give you the category of error without including any of the potentially sensitive details. If this would work, you could more easily perform this logging from the command rather than in the endpoint.
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.
This is a great use case for statsd!