Skip to content

Commit

Permalink
Only log successful ES queries if they took more than a certain amoun…
Browse files Browse the repository at this point in the history
…t of time (#1314)
  • Loading branch information
andersju authored Oct 5, 2023
1 parent a01ba8a commit 4fa8b63
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class ElasticSearch {
private ElasticClient client
private ElasticClient bulkClient
private boolean isPitApiAvailable = false
private static final int ES_LOG_MIN_DURATION = 2000 // Only log queries taking at least this amount of milliseconds

private final Queue<Runnable> indexingRetryQueue = new LinkedBlockingQueue<>()

Expand Down Expand Up @@ -566,7 +567,9 @@ class ElasticSearch {
def duration = System.currentTimeMillis() - start
Map responseMap = mapper.readValue(responseBody, Map)

log.info("ES query took ${duration} (${responseMap.took} server-side)")
if (duration >= ES_LOG_MIN_DURATION) {
log.info("ES query took ${duration} (${responseMap.took} server-side)")
}

def results = [:]

Expand Down

0 comments on commit 4fa8b63

Please sign in to comment.