Skip to content

Commit

Permalink
Respond to code review feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Craig Perkins <cwperx@amazon.com>
  • Loading branch information
cwperks committed Jun 24, 2024
1 parent ddee24f commit 3ce4bea
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 @@ -17,7 +17,10 @@
import static org.opensearch.ad.constant.ADCommonName.DETECTION_STATE_INDEX;
import static org.opensearch.ad.indices.ADIndexManagement.ALL_AD_RESULTS_INDEX_PATTERN;
import static org.opensearch.ad.settings.AnomalyDetectorSettings.AD_COOLDOWN_MINUTES;
import static org.opensearch.timeseries.constant.CommonName.ALL_AD_DETECTOR_INDEX_PATTERN;
import static org.opensearch.forecast.constant.ForecastCommonName.FORECAST_CHECKPOINT_INDEX_NAME;
import static org.opensearch.forecast.constant.ForecastCommonName.FORECAST_STATE_INDEX;
import static org.opensearch.timeseries.constant.CommonName.CONFIG_INDEX;
import static org.opensearch.timeseries.constant.CommonName.JOB_INDEX;

import java.security.AccessController;
import java.security.PrivilegedAction;
Expand Down Expand Up @@ -814,10 +817,7 @@ public PooledObject<LinkedBuffer> wrap(LinkedBuffer obj) {
StatNames.CONFIG_INDEX_STATUS.getName(),
new TimeSeriesStat<>(true, new IndexStatusSupplier(indexUtils, CommonName.CONFIG_INDEX))
)
.put(
StatNames.JOB_INDEX_STATUS.getName(),
new TimeSeriesStat<>(true, new IndexStatusSupplier(indexUtils, CommonName.JOB_INDEX))
)
.put(StatNames.JOB_INDEX_STATUS.getName(), new TimeSeriesStat<>(true, new IndexStatusSupplier(indexUtils, JOB_INDEX)))
.put(
StatNames.MODEL_COUNT.getName(),
new TimeSeriesStat<>(false, new ADModelsOnNodeCountSupplier(adModelManager, adCacheProvider))
Expand Down Expand Up @@ -1199,10 +1199,7 @@ public PooledObject<LinkedBuffer> wrap(LinkedBuffer obj) {
StatNames.CONFIG_INDEX_STATUS.getName(),
new TimeSeriesStat<>(true, new IndexStatusSupplier(indexUtils, CommonName.CONFIG_INDEX))
)
.put(
StatNames.JOB_INDEX_STATUS.getName(),
new TimeSeriesStat<>(true, new IndexStatusSupplier(indexUtils, CommonName.JOB_INDEX))
)
.put(StatNames.JOB_INDEX_STATUS.getName(), new TimeSeriesStat<>(true, new IndexStatusSupplier(indexUtils, JOB_INDEX)))
.put(StatNames.MODEL_COUNT.getName(), new TimeSeriesStat<>(false, new ForecastModelsOnNodeCountSupplier(forecastCacheProvider)))
.build();

Expand Down Expand Up @@ -1682,11 +1679,13 @@ public List<NamedXContentRegistry.Entry> getNamedXContent() {
@Override
public Collection<SystemIndexDescriptor> getSystemIndexDescriptors(Settings settings) {
List<SystemIndexDescriptor> systemIndexDescriptors = new ArrayList<>();
systemIndexDescriptors.add(new SystemIndexDescriptor(ALL_AD_RESULTS_INDEX_PATTERN, "Time Series Analytics Results index pattern"));
systemIndexDescriptors
.add(new SystemIndexDescriptor(ALL_AD_DETECTOR_INDEX_PATTERN, "Time Series Analytics Detector index pattern"));
systemIndexDescriptors.add(new SystemIndexDescriptor(CHECKPOINT_INDEX_NAME, "Time Series Analytics Checkpoints index"));
systemIndexDescriptors.add(new SystemIndexDescriptor(DETECTION_STATE_INDEX, "Time Series Analytics Detection State index"));
systemIndexDescriptors.add(new SystemIndexDescriptor(CONFIG_INDEX, "Time Series Analytics config index"));
systemIndexDescriptors.add(new SystemIndexDescriptor(ALL_AD_RESULTS_INDEX_PATTERN, "AD result index pattern"));
systemIndexDescriptors.add(new SystemIndexDescriptor(CHECKPOINT_INDEX_NAME, "AD Checkpoints index"));
systemIndexDescriptors.add(new SystemIndexDescriptor(DETECTION_STATE_INDEX, "AD State index"));
systemIndexDescriptors.add(new SystemIndexDescriptor(FORECAST_CHECKPOINT_INDEX_NAME, "Forecast Checkpoints index"));
systemIndexDescriptors.add(new SystemIndexDescriptor(FORECAST_STATE_INDEX, "Forecast state index"));
systemIndexDescriptors.add(new SystemIndexDescriptor(JOB_INDEX, "Time Series Analytics job index"));
return systemIndexDescriptors;
}

Expand All @@ -1697,7 +1696,7 @@ public String getJobType() {

@Override
public String getJobIndex() {
return CommonName.JOB_INDEX;
return JOB_INDEX;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ public class CommonName {
// Index name
// ======================================

public static final String ALL_AD_DETECTOR_INDEX_PATTERN = ".opendistro-anomaly-detectors*";

// config index. We are reusing ad detector index.
public static final String CONFIG_INDEX = ".opendistro-anomaly-detectors";

Expand Down

0 comments on commit 3ce4bea

Please sign in to comment.