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
|
@Override
|
||||||
@SuppressWarnings("BooleanParameter")
|
|
||||||
public void run() {
|
public void run() {
|
||||||
// Ignore the CompletableResultCode from doRun() in order to keep run() asynchronous
|
// Ignore the CompletableResultCode from doRun() in order to keep run() asynchronous
|
||||||
doRun();
|
doRun();
|
||||||
|
|
@ -141,8 +140,9 @@ public final class IntervalMetricReader {
|
||||||
flushResult.succeed();
|
flushResult.succeed();
|
||||||
exportAvailable.set(true);
|
exportAvailable.set(true);
|
||||||
});
|
});
|
||||||
} catch (RuntimeException e) {
|
} catch (Throwable t) {
|
||||||
logger.log(Level.WARNING, "Exporter threw an Exception", e);
|
exportAvailable.set(true);
|
||||||
|
logger.log(Level.WARNING, "Exporter threw an Exception", t);
|
||||||
flushResult.fail();
|
flushResult.fail();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -120,8 +120,9 @@ class IntervalMetricReaderTest {
|
||||||
.buildAndStart();
|
.buildAndStart();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
assertThat(waitingMetricExporter.waitForNumberOfExports(1))
|
assertThat(waitingMetricExporter.waitForNumberOfExports(2))
|
||||||
.containsExactly(Collections.singletonList(METRIC_DATA));
|
.containsExactly(
|
||||||
|
Collections.singletonList(METRIC_DATA), Collections.singletonList(METRIC_DATA));
|
||||||
} finally {
|
} finally {
|
||||||
intervalMetricReader.shutdown();
|
intervalMetricReader.shutdown();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue