Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Register system index descriptors through SystemIndexPlugin.getSystemIndexDescriptors #1251

Merged
merged 4 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -13,11 +13,16 @@

import static java.util.Collections.unmodifiableList;
import static org.opensearch.ad.constant.ADCommonName.ANOMALY_RESULT_INDEX_ALIAS;
import static org.opensearch.ad.constant.ADCommonName.CHECKPOINT_INDEX_NAME;
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 java.security.AccessController;
import java.security.PrivilegedAction;
import java.time.Clock;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
Expand Down Expand Up @@ -249,6 +254,7 @@
import org.opensearch.forecast.transport.ValidateForecasterTransportAction;
import org.opensearch.forecast.transport.handler.ForecastIndexMemoryPressureAwareResultHandler;
import org.opensearch.forecast.transport.handler.ForecastSearchHandler;
import org.opensearch.indices.SystemIndexDescriptor;
import org.opensearch.jobscheduler.spi.JobSchedulerExtension;
import org.opensearch.jobscheduler.spi.ScheduledJobParser;
import org.opensearch.jobscheduler.spi.ScheduledJobRunner;
Expand All @@ -257,6 +263,7 @@
import org.opensearch.plugins.ActionPlugin;
import org.opensearch.plugins.Plugin;
import org.opensearch.plugins.ScriptPlugin;
import org.opensearch.plugins.SystemIndexPlugin;
import org.opensearch.repositories.RepositoriesService;
import org.opensearch.rest.RestController;
import org.opensearch.rest.RestHandler;
Expand Down Expand Up @@ -313,7 +320,7 @@
/**
* Entry point of time series analytics plugin.
*/
public class TimeSeriesAnalyticsPlugin extends Plugin implements ActionPlugin, ScriptPlugin, JobSchedulerExtension {
public class TimeSeriesAnalyticsPlugin extends Plugin implements ActionPlugin, ScriptPlugin, SystemIndexPlugin, JobSchedulerExtension {

private static final Logger LOG = LogManager.getLogger(TimeSeriesAnalyticsPlugin.class);

Expand Down Expand Up @@ -1672,6 +1679,17 @@ 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"));
cwperks marked this conversation as resolved.
Show resolved Hide resolved
systemIndexDescriptors
.add(new SystemIndexDescriptor(ALL_AD_DETECTOR_INDEX_PATTERN, "Time Series Analytics Detector index pattern"));
cwperks marked this conversation as resolved.
Show resolved Hide resolved
systemIndexDescriptors.add(new SystemIndexDescriptor(CHECKPOINT_INDEX_NAME, "Time Series Analytics Checkpoints index"));
cwperks marked this conversation as resolved.
Show resolved Hide resolved
systemIndexDescriptors.add(new SystemIndexDescriptor(DETECTION_STATE_INDEX, "Time Series Analytics Detection State index"));
cwperks marked this conversation as resolved.
Show resolved Hide resolved
return systemIndexDescriptors;
cwperks marked this conversation as resolved.
Show resolved Hide resolved
}

@Override
public String getJobType() {
return TIME_SERIES_JOB_TYPE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public class CommonName {
// ======================================
// Index name
// ======================================

public static final String ALL_AD_DETECTOR_INDEX_PATTERN = ".opendistro-anomaly-detectors*";
cwperks marked this conversation as resolved.
Show resolved Hide resolved

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

Expand Down
Loading