-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Description
Issue type:
[x] question
[ ] bug report
[ ] feature request
[ ] documentation issue
Database system/driver:
[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql / mariadb
[ ] oracle
[x] postgres
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo
TypeORM version:
[x] latest
[ ] @next
[ ] 0.x.x (or put your version here)
Steps to reproduce or a small repository showing the problem:
I'd like to be able to log slow queries to console/file and keep track of average query times with statsd. From http://typeorm.io/#/logging/using-custom-logger, I know that I can define a custom logger, and if I set maxQueryExecutionTime=-1 (since 0 will be falsy), then the custom logger will always be called.
At that point, I can fire statsd.timer as well as check if the query took longer than some threshold and log as well. But this feels more difficult than it should be. I also looked into subscribers but it doesn't seem to track query time.
Is there a better way to do this?