Skip to content

Commit

Permalink
stream() refactor (Signed-off-by: Jeffrey Liu [email protected])
Browse files Browse the repository at this point in the history
Signed-off-by: CoderJeffrey <[email protected]>
  • Loading branch information
CoderJeffrey committed Jul 27, 2023
1 parent de4d289 commit 4635d6c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,16 @@ public Decision operate() {

// loop through the actions and print the action threshold name, dimension,
// increase/decrease
for (int i = 0; i < searchBackPressureActions.size(); i++) {
LOG.info(
"Action details, threshold name: {}, dimension: {}, increase/decrease: {}, stepsize: {}",
((SearchBackPressureAction) searchBackPressureActions.get(i))
.getThresholdName(),
((SearchBackPressureAction) searchBackPressureActions.get(i)).getDimension(),
((SearchBackPressureAction) searchBackPressureActions.get(i)).getDirection(),
((SearchBackPressureAction) searchBackPressureActions.get(i))
.getStepSizeInPercentage());
}
searchBackPressureActions.stream()
.forEach(
(action) -> {
LOG.info(
"searchBackPressureActions details, threshold name: {}, dimension: {}, increase/decrease: {}, stepsize: {}",
((SearchBackPressureAction) action).getThresholdName(),
((SearchBackPressureAction) action).getDimension(),
((SearchBackPressureAction) action).getDirection(),
((SearchBackPressureAction) action).getStepSizeInPercentage());
});

searchBackPressureActions.forEach(decision::addAction);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.opensearch.performanceanalyzer.rca.framework.api.aggregators.BucketizedSlidingWindowConfig;
import org.opensearch.performanceanalyzer.rca.framework.api.flow_units.ResourceFlowUnit;
import org.opensearch.performanceanalyzer.rca.framework.api.summaries.HotClusterSummary;
import org.opensearch.performanceanalyzer.rca.framework.api.summaries.HotNodeSummary;
import org.opensearch.performanceanalyzer.rca.framework.api.summaries.HotResourceSummary;
import org.opensearch.performanceanalyzer.rca.framework.core.RcaConf;
import org.opensearch.performanceanalyzer.rca.framework.util.RcaConsts;
Expand Down Expand Up @@ -152,13 +151,11 @@ private void recordIssues() {
if (!flowUnit.hasResourceSummary()) {
continue;
}
// print out the total number of flow units in length

HotClusterSummary clusterSummary = flowUnit.getSummary();
for (HotNodeSummary nodeSummary : clusterSummary.getHotNodeSummaryList()) {
for (HotResourceSummary summary : nodeSummary.getHotResourceSummaryList()) {
record(summary);
}
}
clusterSummary.getHotNodeSummaryList().stream()
.flatMap((nodeSummary) -> nodeSummary.getHotResourceSummaryList().stream())
.forEach((resourceSummary) -> record(resourceSummary));
}
}

Expand Down

0 comments on commit 4635d6c

Please sign in to comment.