You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2017/06/09 13:55:14 UTC
svn commit: r1798221 -
/sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/HealthCheckResultCache.java
Author: bdelacretaz
Date: Fri Jun 9 13:55:13 2017
New Revision: 1798221
URL: http://svn.apache.org/viewvc?rev=1798221&view=rev
Log:
SLING-6855 - more logging + use WARN level for Stick Result header
Modified:
sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/HealthCheckResultCache.java
Modified: sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/HealthCheckResultCache.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/HealthCheckResultCache.java?rev=1798221&r1=1798220&r2=1798221&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/HealthCheckResultCache.java (original)
+++ sling/trunk/bundles/extensions/healthcheck/core/src/main/java/org/apache/sling/hc/core/impl/executor/HealthCheckResultCache.java Fri Jun 9 13:55:13 2017
@@ -71,6 +71,7 @@ public class HealthCheckResultCache {
Status status = executionResult.getHealthCheckResult().getStatus();
if (status.ordinal() >= Result.Status.WARN.ordinal()) {
+ logger.debug("Caching {} result for HC {}", status, executionResult.getServiceId());
cacheOfNotOkResults.get(status).put(executionResult.getServiceId(), result);
}
}
@@ -169,8 +170,12 @@ public class HealthCheckResultCache {
for (Status status : NOT_OK_STATUS_VALUES) {
long hcServiceId = ((ExecutionResult) origResult).getServiceId();
HealthCheckExecutionResult nonOkResultFromPast = cacheOfNotOkResults.get(status).get(hcServiceId);
- if (nonOkResultFromPast == null
- || nonOkResultFromPast == origResult /* the origResult has been added to cache already */) {
+ if (nonOkResultFromPast == null) {
+ logger.debug("no sticky result in cache for HC {}", hcServiceId);
+ continue;
+ }
+ if(nonOkResultFromPast == origResult) {
+ logger.debug("result already in cache: {} for HC {}, not adding sticky result", origResult, hcServiceId);
continue;
}
long pastHcTime = nonOkResultFromPast.getFinishedAt().getTime();
@@ -192,7 +197,7 @@ public class HealthCheckResultCache {
for (HealthCheckExecutionResult nonOkResultFromPast : nonOkResultsFromPast) {
Status status = nonOkResultFromPast.getHealthCheckResult().getStatus();
resultLog.add(
- new Entry(Result.Status.INFO, "*** Sticky Result " + status + " from " + df.format(nonOkResultFromPast.getFinishedAt()) + " ***"));
+ new Entry(Result.Status.WARN, "*** Sticky Result " + status + " from " + df.format(nonOkResultFromPast.getFinishedAt()) + " ***"));
for (ResultLog.Entry entry : nonOkResultFromPast.getHealthCheckResult()) {
resultLog.add(entry);
}