Skip to content
Merged
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 @@ -263,20 +263,26 @@ private synchronized WorkItemStatus createStatusUpdate(boolean isFinal) {
return status;
}

// todo(migryz) this method should return List<CounterUpdate> instead of updating member variable
@VisibleForTesting
synchronized void populateCounterUpdates(WorkItemStatus status) {
if (worker == null) {
return;
}

boolean isFinalUpdate = Boolean.TRUE.equals(status.getCompleted());
ImmutableList.Builder<CounterUpdate> counterUpdatesBuilder = ImmutableList.builder();
counterUpdatesBuilder.addAll(extractCounters(worker.getOutputCounters()));
counterUpdatesBuilder.addAll(extractMetrics(isFinalUpdate));
counterUpdatesBuilder.addAll(extractMsecCounters(isFinalUpdate));
counterUpdatesBuilder.addAll(worker.extractMetricUpdates());

ImmutableList<CounterUpdate> counterUpdates = counterUpdatesBuilder.build();
ImmutableList.Builder<CounterUpdate> counterUpdatesListBuilder = ImmutableList.builder();
// Output counters
counterUpdatesListBuilder.addAll(extractCounters(worker.getOutputCounters()));
// User metrics reported in Worker
counterUpdatesListBuilder.addAll(extractMetrics(isFinalUpdate));
// MSec counters reported in worker
counterUpdatesListBuilder.addAll(extractMsecCounters(isFinalUpdate));
// Metrics reported in SDK runner.
counterUpdatesListBuilder.addAll(worker.extractMetricUpdates());

ImmutableList<CounterUpdate> counterUpdates = counterUpdatesListBuilder.build();
status.setCounterUpdates(counterUpdates);
}

Expand Down
Loading