mirror of https://github.com/apache/druid.git
Query should not fail because emitter fails or throws Exception (#5484)
This commit is contained in:
parent
9b2a25bd84
commit
40cc2c8740
|
@ -19,6 +19,7 @@
|
|||
|
||||
package io.druid.query;
|
||||
|
||||
import io.druid.java.util.common.logger.Logger;
|
||||
import io.druid.java.util.emitter.service.ServiceEmitter;
|
||||
import io.druid.java.util.common.guava.LazySequence;
|
||||
import io.druid.java.util.common.guava.Sequence;
|
||||
|
@ -39,6 +40,7 @@ public class MetricsEmittingQueryRunner<T> implements QueryRunner<T>
|
|||
private final long creationTimeNs;
|
||||
private final ObjLongConsumer<? super QueryMetrics<?>> reportMetric;
|
||||
private final Consumer<QueryMetrics<?>> applyCustomDimensions;
|
||||
private static final Logger log = new Logger(MetricsEmittingQueryRunner.class);
|
||||
|
||||
private MetricsEmittingQueryRunner(
|
||||
ServiceEmitter emitter,
|
||||
|
@ -117,7 +119,13 @@ public class MetricsEmittingQueryRunner<T> implements QueryRunner<T>
|
|||
if (creationTimeNs > 0) {
|
||||
queryMetrics.reportWaitTime(startTimeNs - creationTimeNs);
|
||||
}
|
||||
queryMetrics.emit(emitter);
|
||||
try {
|
||||
queryMetrics.emit(emitter);
|
||||
}
|
||||
catch (Exception e) {
|
||||
// Query should not fail, because of emitter failure. Swallowing the exception.
|
||||
log.error("Failure while trying to emit [%s] with stacktrace [%s]", emitter.toString(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue