AHeise commented on code in PR #19228:
URL: https://github.com/apache/flink/pull/19228#discussion_r857573166
##########
flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/ThreadInfoSampleService.java:
##########
@@ -71,34 +74,44 @@
}
private void requestThreadInfoSamples(
- final SampleableTask task,
+ final Collection<SampleableTask> tasks,
final int numSamples,
final Duration delayBetweenSamples,
final int maxStackTraceDepth,
final List<ThreadInfoSample> currentTraces,
final CompletableFuture<List<ThreadInfoSample>> resultFuture) {
- final long threadId = task.getExecutingThread().getId();
- final Optional<ThreadInfoSample> threadInfoSample =
- JvmUtils.createThreadInfoSample(threadId, maxStackTraceDepth);
+ final Collection<Long> threadIds =
+ tasks.stream()
+ .map(t -> t.getExecutingThread().getId())
+ .collect(Collectors.toList());
- if (threadInfoSample.isPresent()) {
- currentTraces.add(threadInfoSample.get());
+ final Collection<ThreadInfoSample> threadInfoSample =
+ JvmUtils.createThreadInfoSample(threadIds, maxStackTraceDepth);
+
+ if (!threadInfoSample.isEmpty()) {
+ currentTraces.addAll(threadInfoSample);
} else if (!currentTraces.isEmpty()) {
+ // Requested tasks are not running anymore, completing with
whatever was collected by
+ // now.
resultFuture.complete(currentTraces);
} else {
+ final String ids =
+ tasks.stream()
+ .map(SampleableTask::getExecutionId)
+ .map(e -> e == null ? "unknown" : e.toString())
Review Comment:
k then just leave it here. I just always try to keep my collections/arrays
clean of nulls because shit hits the fan quickly if you allow them.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]