Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify slow cluster-state log messages #38302

Merged
merged 2 commits into from
Feb 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ public void onSuccess(String source) {

protected void warnAboutSlowTaskIfNeeded(TimeValue executionTime, String source) {
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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

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.ClusterState;
import org.elasticsearch.cluster.ClusterStateApplier;
Expand All @@ -45,8 +43,6 @@
import java.util.Map;

public class ClusterService extends AbstractLifecycleComponent {
private static final Logger logger = LogManager.getLogger(ClusterService.class);

private final MasterService masterService;

private final ClusterApplierService clusterApplierService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ public TimeValue ackTimeout() {

protected void warnAboutSlowTaskIfNeeded(TimeValue executionTime, String source) {
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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,19 +195,19 @@ public void testLongClusterStateUpdateLogging() throws Exception {
"test1 shouldn't see because setting is too low",
ClusterApplierService.class.getCanonicalName(),
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(
new MockLogAppender.SeenEventExpectation(
"test2",
ClusterApplierService.class.getCanonicalName(),
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(
new MockLogAppender.SeenEventExpectation(
"test4",
ClusterApplierService.class.getCanonicalName(),
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);
Loggers.addAppender(clusterLogger, mockAppender);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -652,25 +652,25 @@ public void testLongClusterStateUpdateLogging() throws Exception {
"test1 shouldn't see because setting is too low",
MasterService.class.getCanonicalName(),
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(
new MockLogAppender.SeenEventExpectation(
"test2",
MasterService.class.getCanonicalName(),
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(
new MockLogAppender.SeenEventExpectation(
"test3",
MasterService.class.getCanonicalName(),
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(
new MockLogAppender.SeenEventExpectation(
"test4",
MasterService.class.getCanonicalName(),
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);
Loggers.addAppender(clusterLogger, mockAppender);
Expand Down