Merger: De-parameterize alert messages

This commit is contained in:
Gian Merlino 2012-12-14 18:13:57 -08:00
parent e37e24cc25
commit 61afd0a46a
2 changed files with 17 additions and 25 deletions

View File

@ -211,10 +211,10 @@ public class RemoteTaskRunner implements TaskRunner
} else { } else {
Duration durSinceLastTerminate = new Duration(new DateTime(), lastTerminateTime); Duration durSinceLastTerminate = new Duration(new DateTime(), lastTerminateTime);
if (durSinceLastTerminate.isLongerThan(config.getMaxScalingDuration())) { if (durSinceLastTerminate.isLongerThan(config.getMaxScalingDuration())) {
log.makeAlert( log.makeAlert("Worker node termination taking too long")
"It has been %d millis since last scheduled termination but nodes remain", .addData("millisSinceLastTerminate", durSinceLastTerminate.getMillis())
durSinceLastTerminate.getMillis() .addData("terminatingCount", currentlyTerminating.size())
).emit(); .emit();
} }
log.info( log.info(
@ -330,7 +330,9 @@ public class RemoteTaskRunner implements TaskRunner
log.info("Registering retry for failed task[%s]", task.getId()); log.info("Registering retry for failed task[%s]", task.getId());
if (retryPolicy.hasExceededRetryThreshold()) { if (retryPolicy.hasExceededRetryThreshold()) {
log.makeAlert("Task [%s] has failed[%d] times, giving up!", task.getId(), retryPolicy.getNumRetries()) log.makeAlert("Task exceeded maximum retry count")
.addData("task", task.getId())
.addData("retryCount", retryPolicy.getNumRetries())
.emit(); .emit();
return; return;
} }
@ -542,10 +544,10 @@ public class RemoteTaskRunner implements TaskRunner
} else { } else {
Duration durSinceLastProvision = new Duration(new DateTime(), lastProvisionTime); Duration durSinceLastProvision = new Duration(new DateTime(), lastProvisionTime);
if (durSinceLastProvision.isLongerThan(config.getMaxScalingDuration())) { if (durSinceLastProvision.isLongerThan(config.getMaxScalingDuration())) {
log.makeAlert( log.makeAlert("Worker node provisioning taking too long")
"It has been %d millis since last scheduled provision but nodes remain", .addData("millisSinceLastProvision", durSinceLastProvision.getMillis())
durSinceLastProvision.getMillis() .addData("provisioningCount", currentlyProvisioning.size())
).emit(); .emit();
} }
log.info( log.info(

View File

@ -20,11 +20,9 @@
package com.metamx.druid.merger.coordinator.exec; package com.metamx.druid.merger.coordinator.exec;
import com.google.common.base.Throwables; import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.metamx.common.lifecycle.LifecycleStart; import com.metamx.common.lifecycle.LifecycleStart;
import com.metamx.common.lifecycle.LifecycleStop; import com.metamx.common.lifecycle.LifecycleStop;
import com.metamx.common.logger.Logger;
import com.metamx.druid.client.DataSegment; import com.metamx.druid.client.DataSegment;
import com.metamx.druid.merger.common.TaskStatus; import com.metamx.druid.merger.common.TaskStatus;
import com.metamx.druid.merger.common.task.Task; import com.metamx.druid.merger.common.task.Task;
@ -35,12 +33,9 @@ import com.metamx.druid.merger.coordinator.TaskQueue;
import com.metamx.druid.merger.coordinator.TaskRunner; import com.metamx.druid.merger.coordinator.TaskRunner;
import com.metamx.druid.merger.coordinator.VersionedTaskWrapper; import com.metamx.druid.merger.coordinator.VersionedTaskWrapper;
import com.metamx.emitter.EmittingLogger; import com.metamx.emitter.EmittingLogger;
import com.metamx.emitter.service.AlertEvent;
import com.metamx.emitter.service.ServiceEmitter; import com.metamx.emitter.service.ServiceEmitter;
import com.metamx.emitter.service.ServiceMetricEvent; import com.metamx.emitter.service.ServiceMetricEvent;
import java.util.concurrent.ExecutorService;
public class TaskConsumer implements Runnable public class TaskConsumer implements Runnable
{ {
private final TaskQueue queue; private final TaskQueue queue;
@ -242,17 +237,12 @@ public class TaskConsumer implements Runnable
emitter.emit(builder.build("indexer/segment/bytes", bytes)); emitter.emit(builder.build("indexer/segment/bytes", bytes));
if (status.isFailure()) { if (status.isFailure()) {
emitter.emit( log.makeAlert("Failed to index")
new AlertEvent.Builder().build( .addData("task", task.getId())
String.format("Failed to index: %s", task.getDataSource()), .addData("type", task.getType().toString())
ImmutableMap.<String, Object>builder() .addData("dataSource", task.getDataSource())
.put("task", task.getId()) .addData("interval", task.getInterval())
.put("type", task.getType().toString()) .emit();
.put("dataSource", task.getDataSource())
.put("interval", task.getInterval())
.build()
)
);
} }
log.info( log.info(