Fix IntervalMetricReader breaking if export() throws. (#3044)
This commit is contained in:
parent
085eb9d87c
commit
3528123c35
|
|
@ -117,7 +117,6 @@ public final class IntervalMetricReader {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("BooleanParameter")
|
||||
public void run() {
|
||||
// Ignore the CompletableResultCode from doRun() in order to keep run() asynchronous
|
||||
doRun();
|
||||
|
|
@ -141,8 +140,9 @@ public final class IntervalMetricReader {
|
|||
flushResult.succeed();
|
||||
exportAvailable.set(true);
|
||||
});
|
||||
} catch (RuntimeException e) {
|
||||
logger.log(Level.WARNING, "Exporter threw an Exception", e);
|
||||
} catch (Throwable t) {
|
||||
exportAvailable.set(true);
|
||||
logger.log(Level.WARNING, "Exporter threw an Exception", t);
|
||||
flushResult.fail();
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -120,8 +120,9 @@ class IntervalMetricReaderTest {
|
|||
.buildAndStart();
|
||||
|
||||
try {
|
||||
assertThat(waitingMetricExporter.waitForNumberOfExports(1))
|
||||
.containsExactly(Collections.singletonList(METRIC_DATA));
|
||||
assertThat(waitingMetricExporter.waitForNumberOfExports(2))
|
||||
.containsExactly(
|
||||
Collections.singletonList(METRIC_DATA), Collections.singletonList(METRIC_DATA));
|
||||
} finally {
|
||||
intervalMetricReader.shutdown();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue