Skip to content
Draft
Show file tree
Hide file tree
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 @@ -786,23 +786,13 @@ public void afterAutoConfigure(OpenTelemetrySdk sdk) {

private static CompletableResultCode flushAll(
OpenTelemetrySdk sdk, TelemetryClient telemetryClient) {
CompletableResultCode sdkShutdownResult = sdk.shutdown();
CompletableResultCode overallResult = new CompletableResultCode();
sdkShutdownResult.whenComplete(
() -> {
// IMPORTANT: the metric reader flush will fail if the periodic metric reader is already
// mid-exporter
CompletableResultCode telemetryClientResult = telemetryClient.forceFlush();
telemetryClientResult.whenComplete(
() -> {
if (sdkShutdownResult.isSuccess() && telemetryClientResult.isSuccess()) {
overallResult.succeed();
} else {
overallResult.fail();
}
});
});
return overallResult;
// shutdown the SDK first to flush pending telemetry (e.g. logs) into the telemetry client;
// wait up to 5 seconds for the SDK to shut down, but proceed with the telemetry client flush
// even if the SDK shutdown times out (e.g. due to a hung daemon thread on some JVMs)
sdk.shutdown().join(5, TimeUnit.SECONDS);
// IMPORTANT: the metric reader flush will fail if the periodic metric reader is already
// mid-exporter
return telemetryClient.forceFlush();
}

private static boolean isAksAttach() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ void internalRun() {
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
// complete any pending flush request to prevent callers from hanging indefinitely
CompletableResultCode flushResult = flushRequested.getAndSet(null);
if (flushResult != null) {
flushResult.fail();
}
return;
}
}
Expand Down
164 changes: 82 additions & 82 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

164 changes: 82 additions & 82 deletions perf-tests/gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.