This repository was archived by the owner on Apr 7, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1967243
commit fc518ee
Showing
7 changed files
with
113 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
31 changes: 31 additions & 0 deletions
31
src/main/java/io/rudin/minetest/tileserver/module/LoggingExecuteListener.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package io.rudin.minetest.tileserver.module; | ||
|
||
import org.jooq.ExecuteContext; | ||
import org.jooq.impl.DefaultExecuteListener; | ||
import org.jooq.tools.StopWatch; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class LoggingExecuteListener extends DefaultExecuteListener { | ||
|
||
private static final Logger logger = LoggerFactory.getLogger(LoggingExecuteListener.class); | ||
|
||
StopWatch watch; | ||
|
||
class SQLPerformanceWarning extends Exception {} | ||
|
||
@Override | ||
public void executeStart(ExecuteContext ctx) { | ||
super.executeStart(ctx); | ||
watch = new StopWatch(); | ||
} | ||
|
||
@Override | ||
public void executeEnd(ExecuteContext ctx) { | ||
super.executeEnd(ctx); | ||
if (watch.split() > 5_000_000_000L) | ||
logger.warn( | ||
"Slow SQL", | ||
new SQLPerformanceWarning()); | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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