private void apply()

in src/main/java/org/opensearch/performanceanalyzer/config/overrides/ConfigOverridesApplier.java [85:132]


    private void apply(final ConfigOverrides overrides) {
        if (PerformanceAnalyzerApp.getRcaController() != null
                && PerformanceAnalyzerApp.getRcaController().isRcaEnabled()) {
            LOG.info("Applying overrides: {}", overrides.getEnable().getRcas());
            RcaConf rcaConf = PerformanceAnalyzerApp.getRcaController().getRcaConf();
            if (rcaConf != null) {
                Set<String> currentMutedRcaSet = new HashSet<>(rcaConf.getMutedRcaList());
                Set<String> currentMutedDeciderSet = new HashSet<>(rcaConf.getMutedDeciderList());
                Set<String> currentMutedActionSet = new HashSet<>(rcaConf.getMutedActionList());
                // check and remove any nodes that are in the disabled list that were enabled just
                // now.
                if (overrides.getEnable() != null) {
                    if (overrides.getEnable().getRcas() != null) {
                        currentMutedRcaSet.removeAll(overrides.getEnable().getRcas());
                    }
                    if (overrides.getEnable().getDeciders() != null) {
                        currentMutedDeciderSet.removeAll(overrides.getEnable().getDeciders());
                    }
                    if (overrides.getEnable().getActions() != null) {
                        currentMutedActionSet.removeAll(overrides.getEnable().getActions());
                    }
                }

                // union the remaining already disabled nodes with the new set of disabled nodes.
                if (overrides.getDisable() != null) {
                    if (overrides.getDisable().getRcas() != null) {
                        currentMutedRcaSet.addAll(overrides.getDisable().getRcas());
                    }
                    if (overrides.getDisable().getDeciders() != null) {
                        currentMutedDeciderSet.addAll(overrides.getDisable().getDeciders());
                    }
                    if (overrides.getDisable().getActions() != null) {
                        currentMutedActionSet.addAll(overrides.getDisable().getActions());
                    }
                }

                LOG.info("New set of muted rcas: {}", currentMutedRcaSet);
                LOG.info("New set of muted deciders: {}", currentMutedDeciderSet);
                LOG.info("New set of muted actions: {}", currentMutedActionSet);
                boolean updateSuccess =
                        rcaConf.updateAllRcaConfFiles(
                                currentMutedRcaSet, currentMutedDeciderSet, currentMutedActionSet);
                if (updateSuccess) {
                    this.lastAppliedTimestamp = System.currentTimeMillis();
                }
            }
        }
    }