Clarify slow cluster-state log messages (#38302)

The message `... took [31s] above the warn threshold of 30s` suggests
incorrectly that the task took 61 seconds. This commit adds the clarifying
words `which is`.
This commit is contained in:
David Turner 2019-02-04 17:44:00 +00:00 committed by GitHub
parent ac07386eab
commit 2c1eab2b8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 13 deletions

View File

@ -517,7 +517,7 @@ public class ClusterApplierService extends AbstractLifecycleComponent implements
protected void warnAboutSlowTaskIfNeeded(TimeValue executionTime, String source) { protected void warnAboutSlowTaskIfNeeded(TimeValue executionTime, String source) {
if (executionTime.getMillis() > slowTaskLoggingThreshold.getMillis()) { if (executionTime.getMillis() > slowTaskLoggingThreshold.getMillis()) {
logger.warn("cluster state applier task [{}] took [{}] above the warn threshold of {}", source, executionTime, logger.warn("cluster state applier task [{}] took [{}] which is above the warn threshold of {}", source, executionTime,
slowTaskLoggingThreshold); slowTaskLoggingThreshold);
} }
} }

View File

@ -19,8 +19,6 @@
package org.elasticsearch.cluster.service; package org.elasticsearch.cluster.service;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.ClusterName;
import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.ClusterStateApplier; import org.elasticsearch.cluster.ClusterStateApplier;
@ -45,8 +43,6 @@ import java.util.Collections;
import java.util.Map; import java.util.Map;
public class ClusterService extends AbstractLifecycleComponent { public class ClusterService extends AbstractLifecycleComponent {
private static final Logger logger = LogManager.getLogger(ClusterService.class);
private final MasterService masterService; private final MasterService masterService;
private final ClusterApplierService clusterApplierService; private final ClusterApplierService clusterApplierService;

View File

@ -569,7 +569,7 @@ public class MasterService extends AbstractLifecycleComponent {
protected void warnAboutSlowTaskIfNeeded(TimeValue executionTime, String source) { protected void warnAboutSlowTaskIfNeeded(TimeValue executionTime, String source) {
if (executionTime.getMillis() > slowTaskLoggingThreshold.getMillis()) { if (executionTime.getMillis() > slowTaskLoggingThreshold.getMillis()) {
logger.warn("cluster state update task [{}] took [{}] above the warn threshold of {}", source, executionTime, logger.warn("cluster state update task [{}] took [{}] which is above the warn threshold of {}", source, executionTime,
slowTaskLoggingThreshold); slowTaskLoggingThreshold);
} }
} }

View File

@ -195,19 +195,19 @@ public class ClusterApplierServiceTests extends ESTestCase {
"test1 shouldn't see because setting is too low", "test1 shouldn't see because setting is too low",
ClusterApplierService.class.getCanonicalName(), ClusterApplierService.class.getCanonicalName(),
Level.WARN, Level.WARN,
"*cluster state applier task [test1] took [*] above the warn threshold of *")); "*cluster state applier task [test1] took [*] which is above the warn threshold of *"));
mockAppender.addExpectation( mockAppender.addExpectation(
new MockLogAppender.SeenEventExpectation( new MockLogAppender.SeenEventExpectation(
"test2", "test2",
ClusterApplierService.class.getCanonicalName(), ClusterApplierService.class.getCanonicalName(),
Level.WARN, Level.WARN,
"*cluster state applier task [test2] took [32s] above the warn threshold of *")); "*cluster state applier task [test2] took [32s] which is above the warn threshold of *"));
mockAppender.addExpectation( mockAppender.addExpectation(
new MockLogAppender.SeenEventExpectation( new MockLogAppender.SeenEventExpectation(
"test4", "test4",
ClusterApplierService.class.getCanonicalName(), ClusterApplierService.class.getCanonicalName(),
Level.WARN, Level.WARN,
"*cluster state applier task [test3] took [34s] above the warn threshold of *")); "*cluster state applier task [test3] took [34s] which is above the warn threshold of *"));
Logger clusterLogger = LogManager.getLogger(ClusterApplierService.class); Logger clusterLogger = LogManager.getLogger(ClusterApplierService.class);
Loggers.addAppender(clusterLogger, mockAppender); Loggers.addAppender(clusterLogger, mockAppender);

View File

@ -652,25 +652,25 @@ public class MasterServiceTests extends ESTestCase {
"test1 shouldn't see because setting is too low", "test1 shouldn't see because setting is too low",
MasterService.class.getCanonicalName(), MasterService.class.getCanonicalName(),
Level.WARN, Level.WARN,
"*cluster state update task [test1] took [*] above the warn threshold of *")); "*cluster state update task [test1] took [*] which is above the warn threshold of *"));
mockAppender.addExpectation( mockAppender.addExpectation(
new MockLogAppender.SeenEventExpectation( new MockLogAppender.SeenEventExpectation(
"test2", "test2",
MasterService.class.getCanonicalName(), MasterService.class.getCanonicalName(),
Level.WARN, Level.WARN,
"*cluster state update task [test2] took [32s] above the warn threshold of *")); "*cluster state update task [test2] took [32s] which is above the warn threshold of *"));
mockAppender.addExpectation( mockAppender.addExpectation(
new MockLogAppender.SeenEventExpectation( new MockLogAppender.SeenEventExpectation(
"test3", "test3",
MasterService.class.getCanonicalName(), MasterService.class.getCanonicalName(),
Level.WARN, Level.WARN,
"*cluster state update task [test3] took [33s] above the warn threshold of *")); "*cluster state update task [test3] took [33s] which is above the warn threshold of *"));
mockAppender.addExpectation( mockAppender.addExpectation(
new MockLogAppender.SeenEventExpectation( new MockLogAppender.SeenEventExpectation(
"test4", "test4",
MasterService.class.getCanonicalName(), MasterService.class.getCanonicalName(),
Level.WARN, Level.WARN,
"*cluster state update task [test4] took [34s] above the warn threshold of *")); "*cluster state update task [test4] took [34s] which is above the warn threshold of *"));
Logger clusterLogger = LogManager.getLogger(MasterService.class); Logger clusterLogger = LogManager.getLogger(MasterService.class);
Loggers.addAppender(clusterLogger, mockAppender); Loggers.addAppender(clusterLogger, mockAppender);