Skip to content
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

Feat: automatically log slow sql executions #86

Closed
wants to merge 1 commit into from

Conversation

zqzten
Copy link
Contributor

@zqzten zqzten commented May 21, 2021

This PR adds feature to automatically log slow sql.

It's common that sometimes network or database problems occur in production which cause slow sql executions and lead to apiserver errors. It would be handy to automatically log some sql execution details when we meet a slow sql (only log slow sqls not to make the INFO log too verbose) for troubleshooting afterwards. It's also helpful for detecting real slow sql problems in real production use cases.

Signed-off-by: Zach Zhu <[email protected]>
@brandond
Copy link
Member

brandond commented May 21, 2021

Most SQL engines already have built-in options for doing this, for example: https://dev.mysql.com/doc/refman/5.7/en/slow-query-log.html - the only place I could see this being useful is perhaps with sqlite?

@zqzten
Copy link
Contributor Author

zqzten commented May 22, 2021

@brandond Thanks for the reply. This feature trace the whole SQL execution time which includes actual SQL execution time in database and also the connection and transportation time. We've met issues that a client took a long time executing a normal SQL (which did not cause a slow SQL in db), that's why we want to do it - this feature can also help to find out other possible problems along with the database log.

@zqzten
Copy link
Contributor Author

zqzten commented Jun 15, 2022

Replaced by a more general metrics implementation #121

@zqzten zqzten closed this Jun 15, 2022
@zqzten zqzten deleted the feat/log_slow_sql branch June 15, 2022 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants