-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Query should not fail because emitter fails or throws Exception #5484
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 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); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you are right, sorry missed that. |
||
| } | ||
| } | ||
| } | ||
| ); | ||
|
|
||
There was a problem hiding this comment.
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.