pnowojski commented on code in PR #24414: URL: https://github.com/apache/flink/pull/24414#discussion_r1507538335
########## flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/failover/ExecutionFailureHandler.java: ########## @@ -141,6 +155,51 @@ private CompletableFuture<Map<String, String>> labelFailure(Throwable cause, boo return FailureEnricherUtils.labelFailure(cause, ctx, mainThreadExecutor, failureEnrichers); } + private FailureHandlingResult handleFailureAndReport( + @Nullable final Execution failedExecution, + final Throwable cause, + long timestamp, + final Set<ExecutionVertexID> verticesToRestart, + final boolean globalFailure) { + + FailureHandlingResult failureHandlingResult = + handleFailure(failedExecution, cause, timestamp, verticesToRestart, globalFailure); + + if (reportEventsAsSpans) { + // TODO: replace with reporting as event once events are supported. + // Add reporting as callback for when the failure labeling is completed. + failureHandlingResult + .getFailureLabels() + .thenAcceptAsync( + labels -> reportFailureHandling(failureHandlingResult, labels), + mainThreadExecutor); + } + + return failureHandlingResult; + } + + private void reportFailureHandling( + FailureHandlingResult failureHandlingResult, Map<String, String> failureLabels) { + + // Add base attributes + SpanBuilder spanBuilder = + Span.builder(ExecutionFailureHandler.class, "JobFailure") + .setStartTsMillis(failureHandlingResult.getTimestamp()) + .setEndTsMillis(failureHandlingResult.getTimestamp()) + .setAttribute( + "canRestart", String.valueOf(failureHandlingResult.canRestart())) + .setAttribute( + "isGlobalFailure", + String.valueOf(failureHandlingResult.isGlobalFailure())); Review Comment: Can you add this span to the documentation of reported spans? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org