Skip to content
Merged
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 @@ -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;
Expand All @@ -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);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put the static finals at the top of the file, where they usually go.


private MetricsEmittingQueryRunner(
ServiceEmitter emitter,
Expand Down Expand Up @@ -117,7 +119,13 @@ public void after(boolean isDone, Throwable thrown)
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);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be log.error(e, "Failure emitting query metrics with emitter[%s]", emitter). The exception goes first, or else it won't be interpreted as a stack trace.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right, sorry missed that.

}
}
}
);
Expand Down