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

[Feature/extensions] Migrates Get Detector action to extension #810

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
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,9 @@ List<String> jacocoExclusions = [
'org.opensearch.ad.feature.CompositeRetriever.PageIterator',
'org.opensearch.ad.cluster.ADDataMigrator',
'org.opensearch.ad.AnomalyDetectorExtension',
'org.opensearch.ad.transport.ADJobRunnerTransportAction*'
'org.opensearch.ad.transport.ADJobRunnerTransportAction*',
'org.opensearch.ad.AnomalyDetectorProfileRunner',
'org.opensearch.ad.EntityProfileRunner'
]


Expand Down
22 changes: 11 additions & 11 deletions src/main/java/org/opensearch/ad/AnomalyDetectorExtension.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
import org.opensearch.action.ActionResponse;
import org.opensearch.action.support.TransportAction;
import org.opensearch.ad.model.AnomalyDetector;
import org.opensearch.ad.model.AnomalyDetectorJob;
import org.opensearch.ad.model.AnomalyResult;
import org.opensearch.ad.model.DetectorInternalState;
import org.opensearch.ad.rest.RestGetDetectorAction;
import org.opensearch.ad.rest.RestGetAnomalyDetectorAction;
import org.opensearch.ad.rest.RestIndexAnomalyDetectorAction;
import org.opensearch.ad.rest.RestValidateAnomalyDetectorAction;
import org.opensearch.ad.settings.AnomalyDetectorSettings;
Expand Down Expand Up @@ -60,7 +61,7 @@ public List<ExtensionRestHandler> getExtensionRestHandlers() {
.of(
new RestIndexAnomalyDetectorAction(extensionsRunner(), this),
new RestValidateAnomalyDetectorAction(extensionsRunner(), this),
new RestGetDetectorAction()
new RestGetAnomalyDetectorAction(extensionsRunner(), this)
);
}

Expand Down Expand Up @@ -108,10 +109,13 @@ public List<Setting<?>> getSettings() {
@Override
public List<NamedXContentRegistry.Entry> getNamedXContent() {
// Copied from AnomalyDetectorPlugin getNamedXContent
return ImmutableList.of(AnomalyDetector.XCONTENT_REGISTRY, AnomalyResult.XCONTENT_REGISTRY, DetectorInternalState.XCONTENT_REGISTRY
// Pending Job Scheduler Integration
// AnomalyDetectorJob.XCONTENT_REGISTRY
);
return ImmutableList
.of(
AnomalyDetector.XCONTENT_REGISTRY,
AnomalyResult.XCONTENT_REGISTRY,
DetectorInternalState.XCONTENT_REGISTRY,
AnomalyDetectorJob.XCONTENT_REGISTRY
);
}

// TODO: replace or override client object on BaseExtension
Expand All @@ -129,11 +133,7 @@ public OpenSearchClient getClient() {
@Deprecated
public SDKRestClient getRestClient() {
@SuppressWarnings("resource")
SDKRestClient client = new SDKClient()
.initializeRestClient(
getExtensionSettings().getOpensearchAddress(),
Integer.parseInt(getExtensionSettings().getOpensearchPort())
);
SDKRestClient client = new SDKClient().initializeRestClient(getExtensionSettings());
return client;
}

Expand Down
1,252 changes: 625 additions & 627 deletions src/main/java/org/opensearch/ad/AnomalyDetectorProfileRunner.java

Large diffs are not rendered by default.

Loading