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
Feature: Log long running queries #4695
Comments
I think the easiest solution will be to add a log line here. |
This could be a bit smarter, I'd say it should be a new logger namespace, and queries that will be over the threshold should be printed as warnings (so in orange or something like that) when query logging is enabled, when not (but the slow query logging is), only the slow queries should be logged. Moreover, we should have a way to configure separate logging for the slow queries, so users can dump those to a dedicated file, as they could be easily lost in the regular app logs. So the changes should go in here:
The |
Maybe @SpencerKaiser will have some opinions on this, as he did quite a lot of improvements in the logging in v6. |
Super neat idea and I'd use it! |
Wonderful Idea! Maybe you have one more, how to catch large requests (in bytes, not in row counts)?
|
@isuvorov I think this is more suited on the http side imo |
Is your feature request related to a problem? Please describe.
I'd like to be able to log slow queries to console/file and keep track of average query times. This will greatly help developers optimize their query as the Orm would inform them of any slow queries
Hibertnate supports this with the config option. Also typeorm seems to support it as well
Describe the solution you'd like
Add an option in config with
maxExecutionTime
in ms and log queries that exceed this time limit.Describe alternatives you've considered
I have been using console.time and console.timeEnd but that is just the hacky way and is not precise
Additional context
Add any other context about the feature request here.
https://thorben-janssen.com/hibernate-slow-query-log/#activating-hibernates-slow-query-log
https://orkhan.gitbook.io/typeorm/docs/logging#log-long-running-queries
The text was updated successfully, but these errors were encountered: