Skip to content

Commit

Permalink
fixed WARNING logging in RequestTimeoutHandlingDirective to log warni…
Browse files Browse the repository at this point in the history
…ngs for search requests only > 5s

Signed-off-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
  • Loading branch information
thjaeckle committed Mar 1, 2022
1 parent b68a88a commit 21d6a2d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Expand Up @@ -188,11 +188,11 @@ private static String determineHttpPath(final HttpPublishTarget httpPublishTarge
final ConnectHttp connectHttpsWithCustomSSLContext =
ConnectHttp.toHostHttps(baseUri).withCustomHttpsContext(httpsConnectionContext);
// explicitly added <T> as in (some?) IntelliJ idea the line would show an error:
flow = http.cachedHostConnectionPoolHttps(connectHttpsWithCustomSSLContext, poolSettings, log);
flow = http.<HttpPushContext>cachedHostConnectionPoolHttps(connectHttpsWithCustomSSLContext, poolSettings, log);
} else {
// explicitly added <T> as in (some?) IntelliJ idea the line would show an error:
// no SSL, hence no need for SSLContextCreator
flow = http.cachedHostConnectionPool(ConnectHttp.toHost(baseUri), poolSettings, log);
flow = http.<HttpPushContext>cachedHostConnectionPool(ConnectHttp.toHost(baseUri), poolSettings, log);
}

// make requests in parallel
Expand Down
Expand Up @@ -100,10 +100,11 @@ private static void checkDurationWarning(final StoppedTimer mutableTimer, final
final Duration duration = mutableTimer.getDuration();
final String requestPath = mutableTimer.getTag(TracingTags.REQUEST_PATH);

if (requestPath != null && requestPath.contains("/search/things") &&
SEARCH_WARN_TIMEOUT_MS.minus(duration).isNegative()) {
logger.warn("Encountered slow search which took over <{}> ms: <{}> ms!", SEARCH_WARN_TIMEOUT_MS.toMillis(),
duration.toMillis());
if (requestPath != null && requestPath.contains("/search/things")) {
if (SEARCH_WARN_TIMEOUT_MS.minus(duration).isNegative()) {
logger.warn("Encountered slow search which took over <{}> ms: <{}> ms!", SEARCH_WARN_TIMEOUT_MS.toMillis(),
duration.toMillis());
}
} else if (HTTP_WARN_TIMEOUT_MS.minus(duration).isNegative()) {
logger.warn("Encountered slow HTTP request which took over <{}> ms: <{}> ms!",
HTTP_WARN_TIMEOUT_MS.toMillis(), duration.toMillis());
Expand Down

0 comments on commit 21d6a2d

Please sign in to comment.