question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SlowQueryListener always shows time as 0, QueryLoggingListener shows correct time.

See original GitHub issue

It appears that while using the SlowQueryListener as shown below, the Time property in the logging is always 0. But the time appears to work correctly when using the QueryListener (without threshold specified, logs everything). I’ve run it a few times to ensure the query are not too quick and are genuinely being shown as 0. I feel like i’m missing something basic…

I’m testing against both H2 and MySQL via Hikari, JPA+Hibernate is actually executing the queries, full range of SELECTs, INSERTs, UPDATEs etc if that makes any difference. Using the latest versions of everything on Java 8 b121.

return ProxyDataSourceBuilder
                .create(dataSource)
                .logQueryBySlf4j(SLF4JLogLevel.INFO)
                .build();


2017-03-17 11:14:29:174 INFO  QueryLoggingListener - 02cbe638-eb5e-498c-b5c1-9daf154b0601 - Name:, Time:1, Success:True, Type:Prepared, Batch:False, QuerySize:1, BatchSize:0, Query:["..."], Params:[(...)]
2017-03-17 11:14:29:191 INFO  QueryLoggingListener - 02cbe638-eb5e-498c-b5c1-9daf154b0601 - Name:, Time:2, Success:True, Type:Prepared, Batch:False, QuerySize:1, BatchSize:0, Query:["..."], Params:[(...)]
2017-03-17 11:14:29:207 INFO  QueryLoggingListener - 02cbe638-eb5e-498c-b5c1-9daf154b0601 - Name:, Time:2, Success:True, Type:Prepared, Batch:False, QuerySize:1, BatchSize:0, Query:["..."], Params:[(...)]


return ProxyDataSourceBuilder
                .create(dataSource)
                .logSlowQueryBySlf4j(0, TimeUnit.MILLISECONDS)
                .build();


2017-03-17 11:17:14:620 WARN  F4JSlowQueryListener -                                      - Name:, Time:0, Success:False, Type:Prepared, Batch:False, QuerySize:1, BatchSize:0, Query:["..."], Params:[(...)]
2017-03-17 11:17:14:639 WARN  F4JSlowQueryListener -                                      - Name:, Time:0, Success:False, Type:Prepared, Batch:False, QuerySize:1, BatchSize:0, Query:["..."], Params:[(...)]
2017-03-17 11:17:14:654 WARN  F4JSlowQueryListener -                                      - Name:, Time:0, Success:False, Type:Prepared, Batch:False, QuerySize:1, BatchSize:0, Query:[""], Params:[(...)]

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
ttddyycommented, May 12, 2017
0reactions
binakotcommented, May 12, 2017

@ttddyy Awesome! Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

SlowQueryListener always shows time as 0 ... - GitHub
It appears that while using the SlowQueryListener as shown below, the Time property in the logging is always 0. But the time appears...
Read more >
Very slow queries when connecting through the listener in ...
Very slow queries when connecting through the listener in Oracle ... The "ela" value is the elapsed time of the wait, in micro-seconds...
Read more >
Troubleshoot slow-running queries - SQL Server
Check if the time exceeds a threshold you have set (in milliseconds ) based on an established performance baseline.
Read more >
datasource-proxy User Guide
Slow Query Logging Listener. When query takes more than specified threshold, SlowQueryListener executes a callback method. The callback is invoked only once for ......
Read more >
Finding slow and low performance queries - Prisma
The output shows execution time, query size, lock time, rows examined and sent, and more. The pt-query-digest command has a lot of different...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found