├── .eclipseformat.xml ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── config.yml │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE.md ├── dependabot.yml ├── draft-release-notes-config.yml ├── labeler.yml └── workflows │ ├── add-untriaged.yml │ ├── auto-release.yml │ ├── backport.yml │ ├── benchmark.yml │ ├── changelog_verifier.yml │ ├── delete_backport_branch.yml │ ├── draft-release-notes-workflow.yml │ ├── labeler.yml │ ├── link-check-workflow.yml │ ├── long_running.yml │ ├── maven-publish.yml │ ├── test_build_multi_platform.yml │ ├── test_bwc.yml │ └── test_security.yml ├── .gitignore ├── .whitesource ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── DEVELOPER_GUIDE.md ├── LICENSE.txt ├── MAINTAINERS.md ├── NOTICE.txt ├── README.md ├── RELEASING.md ├── SECURITY.md ├── THIRD-PARTY ├── build-tools └── coverage.gradle ├── build.gradle ├── codecov.yml ├── dataGeneration ├── README.md ├── generate-cosine-data-multi-entity.py └── requirements.txt ├── docs ├── entity-priority.pdf ├── high-cardinality-rfc.md ├── images │ ├── ml-ppl-use-case.png │ └── viz-integration-workflow.png ├── ml-rfc.md └── visualization-integration-rfc.md ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── release-notes ├── opendistro-for-elasticsearch-anomaly-detection.release-notes-1.10.0.0.md ├── opendistro-for-elasticsearch-anomaly-detection.release-notes-1.10.1.0.md ├── opendistro-for-elasticsearch-anomaly-detection.release-notes-1.11.0.0.md ├── opendistro-for-elasticsearch-anomaly-detection.release-notes-1.12.0.0.md ├── opendistro-for-elasticsearch-anomaly-detection.release-notes-1.13.0.0.md ├── opendistro-for-elasticsearch-anomaly-detection.release-notes-1.7.0.0.md ├── opendistro-for-elasticsearch-anomaly-detection.release-notes-1.8.0.0.md ├── opendistro-for-elasticsearch-anomaly-detection.release-notes-1.9.0.0.md ├── opensearch-anomaly-detection.release-notes-1.0.0.0-beta1.md ├── opensearch-anomaly-detection.release-notes-1.0.0.0-rc1.md ├── opensearch-anomaly-detection.release-notes-1.0.0.0.md ├── opensearch-anomaly-detection.release-notes-1.1.0.0.md ├── opensearch-anomaly-detection.release-notes-1.2.0.0.md ├── opensearch-anomaly-detection.release-notes-1.2.0.1.md ├── opensearch-anomaly-detection.release-notes-1.3.0.0.md ├── opensearch-anomaly-detection.release-notes-2.0.0.0-rc1.md ├── opensearch-anomaly-detection.release-notes-2.0.0.0.md ├── opensearch-anomaly-detection.release-notes-2.0.1.0.md ├── opensearch-anomaly-detection.release-notes-2.1.0.0.md ├── opensearch-anomaly-detection.release-notes-2.10.0.0.md ├── opensearch-anomaly-detection.release-notes-2.12.0.0.md ├── opensearch-anomaly-detection.release-notes-2.13.0.0.md ├── opensearch-anomaly-detection.release-notes-2.14.0.0.md ├── opensearch-anomaly-detection.release-notes-2.15.0.0.md ├── opensearch-anomaly-detection.release-notes-2.16.0.0.md ├── opensearch-anomaly-detection.release-notes-2.17.0.0.md ├── opensearch-anomaly-detection.release-notes-2.17.1.0.md ├── opensearch-anomaly-detection.release-notes-2.18.0.0.md ├── opensearch-anomaly-detection.release-notes-2.19.0.0.md ├── opensearch-anomaly-detection.release-notes-2.2.0.0.md ├── opensearch-anomaly-detection.release-notes-2.3.0.0.md ├── opensearch-anomaly-detection.release-notes-2.4.0.0.md ├── opensearch-anomaly-detection.release-notes-2.5.0.0.md ├── opensearch-anomaly-detection.release-notes-2.6.0.0.md ├── opensearch-anomaly-detection.release-notes-2.7.0.0.md ├── opensearch-anomaly-detection.release-notes-2.8.0.0.md ├── opensearch-anomaly-detection.release-notes-2.9.0.0.md ├── opensearch-anomaly-detection.release-notes-3.0.0.0-alpha1.md ├── opensearch-anomaly-detection.release-notes-3.0.0.0-beta1.md └── opensearch-anomaly-detection.release-notes-3.0.0.0.md ├── scripts ├── build.sh ├── bwctest.sh ├── integtest.sh └── waf-sam │ ├── os-fire-sam.zip │ └── os-fire-sam │ ├── README │ ├── cfnresponse │ └── __init__.py │ ├── custom │ ├── allvsblockedrequests.json │ ├── awswaf.json │ ├── dashboard.json │ ├── executedrules.json │ ├── filters.json │ ├── httpmethods.json │ ├── httpversions.json │ ├── numberofallrequests.json │ ├── numberofblockedrequests.json │ ├── requestcount.json │ ├── template.json │ ├── top10countries.json │ ├── top10hosts.json │ ├── top10ip.json │ ├── top10rules.json │ ├── top10uris.json │ ├── top10useragents.json │ ├── top10webacl.json │ └── uniqueipcount.json │ ├── es_cognito_auth_setter.py │ ├── kibana_customizer.py │ ├── processor_function.py │ ├── template.yaml │ ├── urllib3 │ ├── __init__.py │ ├── _base_connection.py │ ├── _collections.py │ ├── _request_methods.py │ ├── _version.py │ ├── connection.py │ ├── connectionpool.py │ ├── contrib │ │ ├── __init__.py │ │ ├── emscripten │ │ │ ├── __init__.py │ │ │ ├── connection.py │ │ │ ├── emscripten_fetch_worker.js │ │ │ ├── fetch.py │ │ │ ├── request.py │ │ │ └── response.py │ │ ├── pyopenssl.py │ │ └── socks.py │ ├── exceptions.py │ ├── fields.py │ ├── filepost.py │ ├── http2 │ │ ├── __init__.py │ │ ├── connection.py │ │ └── probe.py │ ├── poolmanager.py │ ├── py.typed │ ├── response.py │ └── util │ │ ├── __init__.py │ │ ├── connection.py │ │ ├── proxy.py │ │ ├── request.py │ │ ├── response.py │ │ ├── retry.py │ │ ├── ssl_.py │ │ ├── ssl_match_hostname.py │ │ ├── ssltransport.py │ │ ├── timeout.py │ │ ├── url.py │ │ ├── util.py │ │ └── wait.py │ └── user_pool_domain_setter.py ├── settings.gradle └── src ├── forbidden ├── ad-signatures.txt └── ad-test-signatures.txt ├── main ├── groovy │ └── io │ │ └── pry │ │ └── gradle │ │ └── offline_dependencies │ │ ├── OfflineDependenciesExtension.groovy │ │ ├── OfflineDependenciesPlugin.groovy │ │ ├── UpdateOfflineRepositoryTask.groovy │ │ ├── Utils.groovy │ │ └── maven │ │ └── PomDependencyModelResolver.groovy ├── java │ └── org │ │ └── opensearch │ │ ├── ad │ │ ├── ADEntityProfileRunner.java │ │ ├── ADJobProcessor.java │ │ ├── ADTaskProfileRunner.java │ │ ├── AnomalyDetectorProfileRunner.java │ │ ├── AnomalyDetectorRunner.java │ │ ├── ExecuteADResultResponseRecorder.java │ │ ├── caching │ │ │ ├── ADCacheBuffer.java │ │ │ ├── ADCacheProvider.java │ │ │ └── ADPriorityCache.java │ │ ├── client │ │ │ ├── AnomalyDetectionClient.java │ │ │ └── AnomalyDetectionNodeClient.java │ │ ├── cluster │ │ │ └── diskcleanup │ │ │ │ └── ADCheckpointIndexRetention.java │ │ ├── constant │ │ │ ├── ADCommonMessages.java │ │ │ ├── ADCommonName.java │ │ │ └── ADCommonValue.java │ │ ├── indices │ │ │ ├── ADIndex.java │ │ │ └── ADIndexManagement.java │ │ ├── ml │ │ │ ├── ADCheckpointDao.java │ │ │ ├── ADColdStart.java │ │ │ ├── ADModelManager.java │ │ │ ├── ADRealTimeInferencer.java │ │ │ ├── HybridThresholdingModel.java │ │ │ ├── IgnoreSimilarExtractor.java │ │ │ ├── KllFloatsSketchSerDe.java │ │ │ ├── ThresholdingModel.java │ │ │ └── ThresholdingResult.java │ │ ├── model │ │ │ ├── ADTask.java │ │ │ ├── ADTaskAction.java │ │ │ ├── ADTaskProfile.java │ │ │ ├── ADTaskType.java │ │ │ ├── Action.java │ │ │ ├── AnomalyDetector.java │ │ │ ├── AnomalyDetectorExecutionInput.java │ │ │ ├── AnomalyDetectorType.java │ │ │ ├── AnomalyResult.java │ │ │ ├── AnomalyResultBucket.java │ │ │ ├── Condition.java │ │ │ ├── DetectorInternalState.java │ │ │ ├── DetectorProfile.java │ │ │ ├── EntityAnomalyResult.java │ │ │ ├── ExpectedValueList.java │ │ │ ├── FeatureImputed.java │ │ │ ├── ImputedFeatureResult.java │ │ │ ├── Operator.java │ │ │ ├── Rule.java │ │ │ └── ThresholdType.java │ │ ├── ratelimit │ │ │ ├── ADCheckpointMaintainWorker.java │ │ │ ├── ADCheckpointReadWorker.java │ │ │ ├── ADCheckpointWriteWorker.java │ │ │ ├── ADColdEntityWorker.java │ │ │ ├── ADColdStartWorker.java │ │ │ ├── ADResultWriteRequest.java │ │ │ ├── ADResultWriteWorker.java │ │ │ └── ADSaveResultStrategy.java │ │ ├── rest │ │ │ ├── AbstractADSearchAction.java │ │ │ ├── AbstractAnomalyDetectorAction.java │ │ │ ├── RestAnomalyDetectorJobAction.java │ │ │ ├── RestDeleteAnomalyDetectorAction.java │ │ │ ├── RestDeleteAnomalyResultsAction.java │ │ │ ├── RestExecuteAnomalyDetectorAction.java │ │ │ ├── RestGetAnomalyDetectorAction.java │ │ │ ├── RestIndexAnomalyDetectorAction.java │ │ │ ├── RestPreviewAnomalyDetectorAction.java │ │ │ ├── RestSearchADTasksAction.java │ │ │ ├── RestSearchAnomalyDetectorAction.java │ │ │ ├── RestSearchAnomalyDetectorInfoAction.java │ │ │ ├── RestSearchAnomalyResultAction.java │ │ │ ├── RestSearchTopAnomalyResultAction.java │ │ │ ├── RestStatsAnomalyDetectorAction.java │ │ │ ├── RestValidateAnomalyDetectorAction.java │ │ │ └── handler │ │ │ │ ├── ADIndexJobActionHandler.java │ │ │ │ ├── ADModelValidationActionHandler.java │ │ │ │ ├── AbstractAnomalyDetectorActionHandler.java │ │ │ │ ├── IndexAnomalyDetectorActionHandler.java │ │ │ │ └── ValidateAnomalyDetectorActionHandler.java │ │ ├── settings │ │ │ ├── ADEnabledSetting.java │ │ │ ├── ADNumericSetting.java │ │ │ ├── AnomalyDetectorSettings.java │ │ │ └── LegacyOpenDistroAnomalyDetectorSettings.java │ │ ├── stats │ │ │ ├── ADStats.java │ │ │ └── suppliers │ │ │ │ ├── ADModelsOnNodeCountSupplier.java │ │ │ │ └── ADModelsOnNodeSupplier.java │ │ ├── task │ │ │ ├── ADBatchTaskCache.java │ │ │ ├── ADBatchTaskRunner.java │ │ │ ├── ADHCBatchTaskCache.java │ │ │ ├── ADHCBatchTaskRunState.java │ │ │ ├── ADTaskCacheManager.java │ │ │ ├── ADTaskCancellationState.java │ │ │ ├── ADTaskManager.java │ │ │ └── ADTaskSlotLimit.java │ │ └── transport │ │ │ ├── ADBatchAnomalyResultAction.java │ │ │ ├── ADBatchAnomalyResultRequest.java │ │ │ ├── ADBatchAnomalyResultResponse.java │ │ │ ├── ADBatchAnomalyResultTransportAction.java │ │ │ ├── ADBatchTaskRemoteExecutionAction.java │ │ │ ├── ADBatchTaskRemoteExecutionTransportAction.java │ │ │ ├── ADCancelTaskAction.java │ │ │ ├── ADCancelTaskNodeRequest.java │ │ │ ├── ADCancelTaskNodeResponse.java │ │ │ ├── ADCancelTaskRequest.java │ │ │ ├── ADCancelTaskResponse.java │ │ │ ├── ADCancelTaskTransportAction.java │ │ │ ├── ADEntityProfileAction.java │ │ │ ├── ADEntityProfileTransportAction.java │ │ │ ├── ADHCImputeAction.java │ │ │ ├── ADHCImputeNodeRequest.java │ │ │ ├── ADHCImputeNodeResponse.java │ │ │ ├── ADHCImputeNodesResponse.java │ │ │ ├── ADHCImputeRequest.java │ │ │ ├── ADHCImputeTransportAction.java │ │ │ ├── ADProfileAction.java │ │ │ ├── ADProfileTransportAction.java │ │ │ ├── ADResultBulkAction.java │ │ │ ├── ADResultBulkRequest.java │ │ │ ├── ADResultBulkTransportAction.java │ │ │ ├── ADResultProcessor.java │ │ │ ├── ADSingleStreamResultAction.java │ │ │ ├── ADSingleStreamResultTransportAction.java │ │ │ ├── ADStatsNodesAction.java │ │ │ ├── ADStatsNodesTransportAction.java │ │ │ ├── ADTaskProfileAction.java │ │ │ ├── ADTaskProfileNodeRequest.java │ │ │ ├── ADTaskProfileNodeResponse.java │ │ │ ├── ADTaskProfileRequest.java │ │ │ ├── ADTaskProfileResponse.java │ │ │ ├── ADTaskProfileTransportAction.java │ │ │ ├── AnomalyDetectorJobAction.java │ │ │ ├── AnomalyDetectorJobTransportAction.java │ │ │ ├── AnomalyResultAction.java │ │ │ ├── AnomalyResultRequest.java │ │ │ ├── AnomalyResultResponse.java │ │ │ ├── AnomalyResultTransportAction.java │ │ │ ├── DeleteADModelAction.java │ │ │ ├── DeleteADModelTransportAction.java │ │ │ ├── DeleteAnomalyDetectorAction.java │ │ │ ├── DeleteAnomalyDetectorTransportAction.java │ │ │ ├── DeleteAnomalyResultsAction.java │ │ │ ├── DeleteAnomalyResultsTransportAction.java │ │ │ ├── EntityADResultAction.java │ │ │ ├── EntityADResultTransportAction.java │ │ │ ├── ForwardADTaskAction.java │ │ │ ├── ForwardADTaskRequest.java │ │ │ ├── ForwardADTaskTransportAction.java │ │ │ ├── GetAnomalyDetectorAction.java │ │ │ ├── GetAnomalyDetectorResponse.java │ │ │ ├── GetAnomalyDetectorTransportAction.java │ │ │ ├── IndexAnomalyDetectorAction.java │ │ │ ├── IndexAnomalyDetectorRequest.java │ │ │ ├── IndexAnomalyDetectorResponse.java │ │ │ ├── IndexAnomalyDetectorTransportAction.java │ │ │ ├── PreviewAnomalyDetectorAction.java │ │ │ ├── PreviewAnomalyDetectorRequest.java │ │ │ ├── PreviewAnomalyDetectorResponse.java │ │ │ ├── PreviewAnomalyDetectorTransportAction.java │ │ │ ├── RCFPollingAction.java │ │ │ ├── RCFPollingRequest.java │ │ │ ├── RCFPollingResponse.java │ │ │ ├── RCFPollingTransportAction.java │ │ │ ├── RCFResultAction.java │ │ │ ├── RCFResultRequest.java │ │ │ ├── RCFResultResponse.java │ │ │ ├── RCFResultTransportAction.java │ │ │ ├── SearchADTasksAction.java │ │ │ ├── SearchADTasksTransportAction.java │ │ │ ├── SearchAnomalyDetectorAction.java │ │ │ ├── SearchAnomalyDetectorInfoAction.java │ │ │ ├── SearchAnomalyDetectorInfoTransportAction.java │ │ │ ├── SearchAnomalyDetectorTransportAction.java │ │ │ ├── SearchAnomalyResultAction.java │ │ │ ├── SearchAnomalyResultTransportAction.java │ │ │ ├── SearchTopAnomalyResultAction.java │ │ │ ├── SearchTopAnomalyResultRequest.java │ │ │ ├── SearchTopAnomalyResultResponse.java │ │ │ ├── SearchTopAnomalyResultTransportAction.java │ │ │ ├── StatsAnomalyDetectorAction.java │ │ │ ├── StatsAnomalyDetectorTransportAction.java │ │ │ ├── StopDetectorAction.java │ │ │ ├── StopDetectorTransportAction.java │ │ │ ├── ThresholdResultAction.java │ │ │ ├── ThresholdResultRequest.java │ │ │ ├── ThresholdResultResponse.java │ │ │ ├── ThresholdResultTransportAction.java │ │ │ ├── ValidateAnomalyDetectorAction.java │ │ │ ├── ValidateAnomalyDetectorTransportAction.java │ │ │ └── handler │ │ │ ├── ADIndexMemoryPressureAwareResultHandler.java │ │ │ └── ADSearchHandler.java │ │ ├── forecast │ │ ├── ExecuteForecastResultResponseRecorder.java │ │ ├── ForecastEntityProfileRunner.java │ │ ├── ForecastJobProcessor.java │ │ ├── ForecastProfileRunner.java │ │ ├── ForecastTaskProfileRunner.java │ │ ├── caching │ │ │ ├── ForecastCacheBuffer.java │ │ │ ├── ForecastCacheProvider.java │ │ │ └── ForecastPriorityCache.java │ │ ├── cluster │ │ │ └── diskcleanup │ │ │ │ └── ForecastCheckpointIndexRetention.java │ │ ├── constant │ │ │ ├── ForecastCommonMessages.java │ │ │ ├── ForecastCommonName.java │ │ │ └── ForecastCommonValue.java │ │ ├── indices │ │ │ ├── ForecastIndex.java │ │ │ └── ForecastIndexManagement.java │ │ ├── ml │ │ │ ├── ForecastCheckpointDao.java │ │ │ ├── ForecastColdStart.java │ │ │ ├── ForecastModelManager.java │ │ │ ├── ForecastRealTimeInferencer.java │ │ │ └── RCFCasterResult.java │ │ ├── model │ │ │ ├── FilterBy.java │ │ │ ├── ForecastResult.java │ │ │ ├── ForecastResultBucket.java │ │ │ ├── ForecastTask.java │ │ │ ├── ForecastTaskProfile.java │ │ │ ├── ForecastTaskType.java │ │ │ ├── Forecaster.java │ │ │ ├── ForecasterProfile.java │ │ │ ├── Order.java │ │ │ └── Subaggregation.java │ │ ├── ratelimit │ │ │ ├── ForecastCheckpointMaintainWorker.java │ │ │ ├── ForecastCheckpointReadWorker.java │ │ │ ├── ForecastCheckpointWriteWorker.java │ │ │ ├── ForecastColdEntityWorker.java │ │ │ ├── ForecastColdStartWorker.java │ │ │ ├── ForecastResultWriteRequest.java │ │ │ ├── ForecastResultWriteWorker.java │ │ │ └── ForecastSaveResultStrategy.java │ │ ├── rest │ │ │ ├── AbstractForecastSearchAction.java │ │ │ ├── AbstractForecasterAction.java │ │ │ ├── ForecasterExecutionInput.java │ │ │ ├── RestDeleteForecasterAction.java │ │ │ ├── RestForecasterJobAction.java │ │ │ ├── RestForecasterSuggestAction.java │ │ │ ├── RestGetForecasterAction.java │ │ │ ├── RestIndexForecasterAction.java │ │ │ ├── RestRunOnceForecasterAction.java │ │ │ ├── RestSearchForecastTasksAction.java │ │ │ ├── RestSearchForecasterAction.java │ │ │ ├── RestSearchForecasterInfoAction.java │ │ │ ├── RestSearchTopForecastResultAction.java │ │ │ ├── RestStatsForecasterAction.java │ │ │ ├── RestValidateForecasterAction.java │ │ │ └── handler │ │ │ │ ├── AbstractForecasterActionHandler.java │ │ │ │ ├── ForecastIndexJobActionHandler.java │ │ │ │ ├── ForecastModelValidationActionHandler.java │ │ │ │ ├── IndexForecasterActionHandler.java │ │ │ │ └── ValidateForecasterActionHandler.java │ │ ├── settings │ │ │ ├── ForecastEnabledSetting.java │ │ │ ├── ForecastNumericSetting.java │ │ │ └── ForecastSettings.java │ │ ├── stats │ │ │ ├── ForecastModelsOnNodeSupplier.java │ │ │ ├── ForecastStats.java │ │ │ └── suppliers │ │ │ │ └── ForecastModelsOnNodeCountSupplier.java │ │ ├── task │ │ │ └── ForecastTaskManager.java │ │ └── transport │ │ │ ├── BuildInQuery.java │ │ │ ├── DeleteForecastModelAction.java │ │ │ ├── DeleteForecastModelTransportAction.java │ │ │ ├── DeleteForecasterAction.java │ │ │ ├── DeleteForecasterTransportAction.java │ │ │ ├── EntityForecastResultAction.java │ │ │ ├── EntityForecastResultTransportAction.java │ │ │ ├── ForecastEntityProfileAction.java │ │ │ ├── ForecastEntityProfileTransportAction.java │ │ │ ├── ForecastImputeMissingValueAction.java │ │ │ ├── ForecastProfileAction.java │ │ │ ├── ForecastProfileTransportAction.java │ │ │ ├── ForecastResultAction.java │ │ │ ├── ForecastResultBulkAction.java │ │ │ ├── ForecastResultBulkRequest.java │ │ │ ├── ForecastResultBulkTransportAction.java │ │ │ ├── ForecastResultProcessor.java │ │ │ ├── ForecastResultRequest.java │ │ │ ├── ForecastResultResponse.java │ │ │ ├── ForecastResultTransportAction.java │ │ │ ├── ForecastRunOnceAction.java │ │ │ ├── ForecastRunOnceProfileAction.java │ │ │ ├── ForecastRunOnceProfileNodeRequest.java │ │ │ ├── ForecastRunOnceProfileNodeResponse.java │ │ │ ├── ForecastRunOnceProfileRequest.java │ │ │ ├── ForecastRunOnceProfileResponse.java │ │ │ ├── ForecastRunOnceProfileTransportAction.java │ │ │ ├── ForecastRunOnceTransportAction.java │ │ │ ├── ForecastSingleStreamResultAction.java │ │ │ ├── ForecastSingleStreamResultTransportAction.java │ │ │ ├── ForecastStatsNodesAction.java │ │ │ ├── ForecastStatsNodesTransportAction.java │ │ │ ├── ForecasterJobAction.java │ │ │ ├── ForecasterJobTransportAction.java │ │ │ ├── GetForecasterAction.java │ │ │ ├── GetForecasterResponse.java │ │ │ ├── GetForecasterTransportAction.java │ │ │ ├── IndexForecasterAction.java │ │ │ ├── IndexForecasterRequest.java │ │ │ ├── IndexForecasterResponse.java │ │ │ ├── IndexForecasterTransportAction.java │ │ │ ├── RelationalOperation.java │ │ │ ├── SearchForecastTasksAction.java │ │ │ ├── SearchForecastTasksTransportAction.java │ │ │ ├── SearchForecasterAction.java │ │ │ ├── SearchForecasterInfoAction.java │ │ │ ├── SearchForecasterInfoTransportAction.java │ │ │ ├── SearchForecasterTransportAction.java │ │ │ ├── SearchTopForecastResultAction.java │ │ │ ├── SearchTopForecastResultRequest.java │ │ │ ├── SearchTopForecastResultResponse.java │ │ │ ├── SearchTopForecastResultTransportAction.java │ │ │ ├── StatsForecasterAction.java │ │ │ ├── StatsForecasterTransportAction.java │ │ │ ├── StopForecasterAction.java │ │ │ ├── StopForecasterTransportAction.java │ │ │ ├── SuggestForecasterParamAction.java │ │ │ ├── SuggestForecasterParamTransportAction.java │ │ │ ├── SuggestName.java │ │ │ ├── ValidateForecasterAction.java │ │ │ ├── ValidateForecasterTransportAction.java │ │ │ └── handler │ │ │ ├── ForecastIndexMemoryPressureAwareResultHandler.java │ │ │ └── ForecastSearchHandler.java │ │ └── timeseries │ │ ├── AbstractProfileRunner.java │ │ ├── AnalysisModelSize.java │ │ ├── AnalysisType.java │ │ ├── CleanState.java │ │ ├── EntityProfileRunner.java │ │ ├── ExceptionRecorder.java │ │ ├── ExecuteResultResponseRecorder.java │ │ ├── ExpiringState.java │ │ ├── JobProcessor.java │ │ ├── JobRunner.java │ │ ├── MaintenanceState.java │ │ ├── MemoryTracker.java │ │ ├── Name.java │ │ ├── NodeState.java │ │ ├── NodeStateManager.java │ │ ├── ProfileRunner.java │ │ ├── ProfileTask.java │ │ ├── ProfileUtil.java │ │ ├── TaskProfile.java │ │ ├── TaskProfileRunner.java │ │ ├── TimeSeriesAnalyticsPlugin.java │ │ ├── TimeSeriesResourceSharingExtension.java │ │ ├── annotation │ │ └── Generated.java │ │ ├── breaker │ │ ├── BreakerName.java │ │ ├── CircuitBreaker.java │ │ ├── CircuitBreakerService.java │ │ ├── MemoryCircuitBreaker.java │ │ └── ThresholdCircuitBreaker.java │ │ ├── caching │ │ ├── CacheBuffer.java │ │ ├── CacheProvider.java │ │ ├── DoorKeeper.java │ │ ├── PriorityCache.java │ │ ├── PriorityTracker.java │ │ └── TimeSeriesCache.java │ │ ├── cluster │ │ ├── ADDataMigrator.java │ │ ├── ClusterEventListener.java │ │ ├── ClusterManagerEventListener.java │ │ ├── DailyCron.java │ │ ├── HashRing.java │ │ ├── HourlyCron.java │ │ ├── TimeSeriesNodeInfo.java │ │ ├── VersionUtil.java │ │ └── diskcleanup │ │ │ ├── BaseModelCheckpointIndexRetention.java │ │ │ └── IndexCleanup.java │ │ ├── common │ │ └── exception │ │ │ ├── ClientException.java │ │ │ ├── DuplicateTaskException.java │ │ │ ├── EndRunException.java │ │ │ ├── InternalFailure.java │ │ │ ├── LimitExceededException.java │ │ │ ├── NotSerializedExceptionName.java │ │ │ ├── ResourceNotFoundException.java │ │ │ ├── TaskCancelledException.java │ │ │ ├── TimeSeriesException.java │ │ │ ├── ValidationException.java │ │ │ └── VersionException.java │ │ ├── constant │ │ ├── CommonMessages.java │ │ ├── CommonName.java │ │ └── CommonValue.java │ │ ├── dataprocessor │ │ ├── ImputationMethod.java │ │ ├── ImputationOption.java │ │ ├── Imputer.java │ │ └── LinearUniformImputer.java │ │ ├── feature │ │ ├── AbstractRetriever.java │ │ ├── CompositeRetriever.java │ │ ├── FeatureManager.java │ │ ├── Features.java │ │ └── SearchFeatureDao.java │ │ ├── function │ │ ├── BiCheckedFunction.java │ │ ├── ExecutorFunction.java │ │ ├── ResponseTransformer.java │ │ ├── ThrowingConsumer.java │ │ ├── ThrowingSupplier.java │ │ └── ThrowingSupplierWrapper.java │ │ ├── indices │ │ ├── IndexManagement.java │ │ └── TimeSeriesIndex.java │ │ ├── ml │ │ ├── CheckpointDao.java │ │ ├── IntermediateResult.java │ │ ├── MemoryAwareConcurrentHashmap.java │ │ ├── ModelColdStart.java │ │ ├── ModelManager.java │ │ ├── ModelState.java │ │ ├── RealTimeInferencer.java │ │ ├── Sample.java │ │ └── SingleStreamModelIdMapper.java │ │ ├── model │ │ ├── Config.java │ │ ├── ConfigProfile.java │ │ ├── ConfigState.java │ │ ├── ConfigValidationIssue.java │ │ ├── DataByFeatureId.java │ │ ├── DateRange.java │ │ ├── Entity.java │ │ ├── EntityProfile.java │ │ ├── EntityProfileName.java │ │ ├── EntityState.java │ │ ├── EntityTaskProfile.java │ │ ├── Feature.java │ │ ├── FeatureData.java │ │ ├── IndexableResult.java │ │ ├── InitProgressProfile.java │ │ ├── IntervalTimeConfiguration.java │ │ ├── Job.java │ │ ├── Mergeable.java │ │ ├── MergeableList.java │ │ ├── ModelProfile.java │ │ ├── ModelProfileOnNode.java │ │ ├── ProfileName.java │ │ ├── ShingleGetter.java │ │ ├── TaskState.java │ │ ├── TaskType.java │ │ ├── TimeConfiguration.java │ │ ├── TimeSeriesTask.java │ │ ├── ValidationAspect.java │ │ └── ValidationIssueType.java │ │ ├── ratelimit │ │ ├── BatchWorker.java │ │ ├── CheckPointMaintainRequestAdapter.java │ │ ├── CheckpointMaintainRequest.java │ │ ├── CheckpointMaintainWorker.java │ │ ├── CheckpointReadWorker.java │ │ ├── CheckpointWriteRequest.java │ │ ├── CheckpointWriteWorker.java │ │ ├── ColdEntityWorker.java │ │ ├── ColdStartWorker.java │ │ ├── ConcurrentWorker.java │ │ ├── FeatureRequest.java │ │ ├── QueuedRequest.java │ │ ├── RateLimitedRequestWorker.java │ │ ├── RequestPriority.java │ │ ├── ResultWriteRequest.java │ │ ├── ResultWriteWorker.java │ │ ├── SaveResultStrategy.java │ │ ├── ScheduledWorker.java │ │ └── SingleRequestWorker.java │ │ ├── resources │ │ └── ResourceSharingClientAccessor.java │ │ ├── rest │ │ ├── AbstractSearchAction.java │ │ ├── RestJobAction.java │ │ ├── RestStatsAction.java │ │ ├── RestValidateAction.java │ │ └── handler │ │ │ ├── AbstractTimeSeriesActionHandler.java │ │ │ ├── AggregationPrep.java │ │ │ ├── ConfigUpdateConfirmer.java │ │ │ ├── HistorySuggest.java │ │ │ ├── IndexJobActionHandler.java │ │ │ ├── IntervalCalculation.java │ │ │ ├── LatestTimeRetriever.java │ │ │ ├── ModelValidationActionHandler.java │ │ │ └── Processor.java │ │ ├── settings │ │ ├── DynamicNumericSetting.java │ │ ├── TimeSeriesEnabledSetting.java │ │ └── TimeSeriesSettings.java │ │ ├── stats │ │ ├── InternalStatNames.java │ │ ├── StatNames.java │ │ ├── StatType.java │ │ ├── Stats.java │ │ ├── TimeSeriesStat.java │ │ └── suppliers │ │ │ ├── CounterSupplier.java │ │ │ ├── IndexStatusSupplier.java │ │ │ └── SettableSupplier.java │ │ ├── task │ │ ├── RealtimeTaskCache.java │ │ ├── TaskCacheManager.java │ │ └── TaskManager.java │ │ ├── transport │ │ ├── AbstractSingleStreamResultTransportAction.java │ │ ├── BackPressureRouting.java │ │ ├── BaseDeleteConfigTransportAction.java │ │ ├── BaseDeleteModelTransportAction.java │ │ ├── BaseEntityProfileTransportAction.java │ │ ├── BaseGetConfigTransportAction.java │ │ ├── BaseJobTransportAction.java │ │ ├── BaseProfileTransportAction.java │ │ ├── BaseSearchConfigInfoTransportAction.java │ │ ├── BaseStatsNodesTransportAction.java │ │ ├── BaseStatsTransportAction.java │ │ ├── BaseSuggestConfigParamTransportAction.java │ │ ├── BaseValidateConfigTransportAction.java │ │ ├── CronAction.java │ │ ├── CronNodeRequest.java │ │ ├── CronNodeResponse.java │ │ ├── CronRequest.java │ │ ├── CronResponse.java │ │ ├── CronTransportAction.java │ │ ├── DeleteConfigRequest.java │ │ ├── DeleteModelNodeRequest.java │ │ ├── DeleteModelNodeResponse.java │ │ ├── DeleteModelRequest.java │ │ ├── DeleteModelResponse.java │ │ ├── EntityProfileRequest.java │ │ ├── EntityProfileResponse.java │ │ ├── EntityResultProcessor.java │ │ ├── EntityResultRequest.java │ │ ├── GetConfigRequest.java │ │ ├── JobRequest.java │ │ ├── JobResponse.java │ │ ├── ProfileNodeRequest.java │ │ ├── ProfileNodeResponse.java │ │ ├── ProfileRequest.java │ │ ├── ProfileResponse.java │ │ ├── ResultBulkRequest.java │ │ ├── ResultBulkResponse.java │ │ ├── ResultBulkTransportAction.java │ │ ├── ResultProcessor.java │ │ ├── ResultRequest.java │ │ ├── ResultResponse.java │ │ ├── SearchConfigInfoRequest.java │ │ ├── SearchConfigInfoResponse.java │ │ ├── SingleStreamResultRequest.java │ │ ├── StatsNodeRequest.java │ │ ├── StatsNodeResponse.java │ │ ├── StatsNodesResponse.java │ │ ├── StatsRequest.java │ │ ├── StatsResponse.java │ │ ├── StatsTimeSeriesResponse.java │ │ ├── StopConfigRequest.java │ │ ├── StopConfigResponse.java │ │ ├── SuggestConfigParamRequest.java │ │ ├── SuggestConfigParamResponse.java │ │ ├── ValidateConfigRequest.java │ │ ├── ValidateConfigResponse.java │ │ └── handler │ │ │ ├── IndexMemoryPressureAwareResultHandler.java │ │ │ ├── ResultBulkIndexingHandler.java │ │ │ ├── ResultIndexingHandler.java │ │ │ └── SearchHandler.java │ │ └── util │ │ ├── ActionListenerExecutor.java │ │ ├── BulkUtil.java │ │ ├── ClientUtil.java │ │ ├── CrossClusterConfigUtils.java │ │ ├── DataUtil.java │ │ ├── DateUtils.java │ │ ├── DiscoveryNodeFilterer.java │ │ ├── ExceptionUtil.java │ │ ├── ExpiringValue.java │ │ ├── IndexUtils.java │ │ ├── ModelUtil.java │ │ ├── MultiResponsesDelegateActionListener.java │ │ ├── ParseUtils.java │ │ ├── QueryUtil.java │ │ ├── RestHandlerUtils.java │ │ ├── SafeSecurityInjector.java │ │ ├── SecurityClientUtil.java │ │ ├── SecurityUtil.java │ │ ├── TimeSeriesSafeSecurityInjector.java │ │ └── TimeUtil.java ├── plugin-metadata │ └── plugin-security.policy └── resources │ ├── META-INF │ ├── gradle-plugins │ │ └── io.pry.gradle.offline_dependencies.properties │ └── services │ │ ├── org.opensearch.jobscheduler.spi.JobSchedulerExtension │ │ └── org.opensearch.security.spi.resources.ResourceSharingExtension │ ├── es-plugin.properties │ ├── mappings │ ├── anomaly-checkpoint.json │ ├── anomaly-detection-state.json │ ├── anomaly-results.json │ ├── config.json │ ├── forecast-checkpoint.json │ ├── forecast-results.json │ ├── forecast-state.json │ └── job.json │ ├── plugin-descriptor.properties │ └── scripts │ └── flatten-custom-result-index-painless.txt └── test ├── java ├── org │ └── opensearch │ │ ├── StreamInputOutputTests.java │ │ ├── action │ │ └── admin │ │ │ └── indices │ │ │ └── mapping │ │ │ └── get │ │ │ ├── AbstractForecasterActionHandlerTestCase.java │ │ │ ├── IndexAnomalyDetectorActionHandlerTests.java │ │ │ ├── IndexForecasterActionHandlerTests.java │ │ │ ├── ValidateAnomalyDetectorActionHandlerTests.java │ │ │ └── ValidateForecasterActionHandlerTests.java │ │ ├── ad │ │ ├── ADIntegTestCase.java │ │ ├── ADUnitTestCase.java │ │ ├── AbstractADSyntheticDataTest.java │ │ ├── AbstractProfileRunnerTests.java │ │ ├── AnomalyDetectorJobRunnerTests.java │ │ ├── AnomalyDetectorProfileRunnerTests.java │ │ ├── AnomalyDetectorRestTestCase.java │ │ ├── EntityProfileRunnerTests.java │ │ ├── HistoricalAnalysisIntegTestCase.java │ │ ├── HistoricalAnalysisRestTestCase.java │ │ ├── MultiEntityProfileRunnerTests.java │ │ ├── OldAnomalyDetectorProfileRunner.java │ │ ├── TRCFMemoryTests.java │ │ ├── breaker │ │ │ ├── ADCircuitBreakerServiceTests.java │ │ │ └── MemoryCircuitBreakerTests.java │ │ ├── bwc │ │ │ └── ADBackwardsCompatibilityIT.java │ │ ├── caching │ │ │ ├── AbstractCacheTest.java │ │ │ ├── CacheBufferTests.java │ │ │ ├── PriorityCacheTests.java │ │ │ └── PriorityTrackerTests.java │ │ ├── client │ │ │ ├── AnomalyDetectionClientTests.java │ │ │ └── AnomalyDetectionNodeClientTests.java │ │ ├── cluster │ │ │ ├── ADClusterEventListenerTests.java │ │ │ ├── ADDataMigratorTests.java │ │ │ ├── ADVersionUtilTests.java │ │ │ ├── ClusterManagerEventListenerTests.java │ │ │ ├── DailyCronTests.java │ │ │ ├── HashRingTests.java │ │ │ ├── HourlyCronTests.java │ │ │ └── diskcleanup │ │ │ │ ├── IndexCleanupTests.java │ │ │ │ └── ModelCheckpointIndexRetentionTests.java │ │ ├── common │ │ │ └── exception │ │ │ │ ├── ADTaskCancelledExceptionTests.java │ │ │ │ ├── JsonPathNotFoundException.java │ │ │ │ ├── LimitExceededExceptionTests.java │ │ │ │ └── NotSerializedADExceptionNameTests.java │ │ ├── e2e │ │ │ ├── AbstractMissingSingleFeatureTestCase.java │ │ │ ├── AbstractRuleModelPerfTestCase.java │ │ │ ├── AbstractRuleTestCase.java │ │ │ ├── DetectionResultEvalutationIT.java │ │ │ ├── HistoricalMissingSingleFeatureIT.java │ │ │ ├── HistoricalRuleModelPerfIT.java │ │ │ ├── MissingIT.java │ │ │ ├── MissingMultiFeatureIT.java │ │ │ ├── MissingSingleFeatureIT.java │ │ │ ├── MixedRealtimeHistoricalIT.java │ │ │ ├── PreviewMissingSingleFeatureIT.java │ │ │ ├── PreviewRuleIT.java │ │ │ ├── RealTimeMissingSingleFeatureModelPerfIT.java │ │ │ ├── RealTimeRuleIT.java │ │ │ ├── RealTimeRuleModelPerfIT.java │ │ │ ├── SingleStreamModelPerfIT.java │ │ │ └── SingleStreamSmokeIT.java │ │ ├── feature │ │ │ ├── FeatureManagerTests.java │ │ │ └── FeaturesTests.java │ │ ├── indices │ │ │ ├── AnomalyDetectionIndicesTests.java │ │ │ ├── CustomIndexTests.java │ │ │ ├── InitAnomalyDetectionIndicesTests.java │ │ │ ├── RolloverTests.java │ │ │ └── UpdateMappingTests.java │ │ ├── ml │ │ │ ├── ADColdStartTests.java │ │ │ ├── AbstractCosineDataTest.java │ │ │ ├── CheckpointDaoTests.java │ │ │ ├── CheckpointDeleteTests.java │ │ │ ├── EntityColdStarterTests.java │ │ │ ├── EntityModelTests.java │ │ │ ├── HCADModelPerfTests.java │ │ │ ├── HybridThresholdingModelTests.java │ │ │ ├── KllFloatsSketchSerDeTests.java │ │ │ ├── ModelManagerTests.java │ │ │ ├── SingleStreamModelIdMapperTests.java │ │ │ └── ThresholdingResultTests.java │ │ ├── mock │ │ │ ├── model │ │ │ │ └── MockSimpleLog.java │ │ │ ├── plugin │ │ │ │ └── MockReindexPlugin.java │ │ │ └── transport │ │ │ │ ├── MockADCancelTaskNodeRequest_1_0.java │ │ │ │ ├── MockADTaskAction_1_0.java │ │ │ │ ├── MockAnomalyDetectorJobAction.java │ │ │ │ ├── MockAnomalyDetectorJobTransportActionWithUser.java │ │ │ │ └── MockForwardADTaskRequest_1_0.java │ │ ├── model │ │ │ ├── ADEntityTaskProfileTests.java │ │ │ ├── ADTaskTests.java │ │ │ ├── AnomalyDetectorExecutionInputTests.java │ │ │ ├── AnomalyDetectorJobTests.java │ │ │ ├── AnomalyDetectorSerializationTests.java │ │ │ ├── AnomalyDetectorTests.java │ │ │ ├── AnomalyResultBucketTests.java │ │ │ ├── AnomalyResultTests.java │ │ │ ├── DetectionDateRangeTests.java │ │ │ ├── DetectorInternalStateTests.java │ │ │ ├── DetectorProfileTests.java │ │ │ ├── EntityAnomalyResultTests.java │ │ │ ├── EntityProfileTests.java │ │ │ ├── EntityTests.java │ │ │ ├── FeatureDataTests.java │ │ │ ├── FeatureImputedTests.java │ │ │ ├── FeatureTests.java │ │ │ ├── GetAnomalyDetectorTransportActionTests.java │ │ │ ├── IntervalTimeConfigurationTests.java │ │ │ ├── MergeableListTests.java │ │ │ └── ModelProfileTests.java │ │ ├── plugin │ │ │ └── MockReindexPlugin.java │ │ ├── ratelimit │ │ │ ├── AbstractRateLimitingTest.java │ │ │ ├── CheckPointMaintainRequestAdapterTests.java │ │ │ ├── CheckpointMaintainWorkerTests.java │ │ │ ├── CheckpointReadWorkerTests.java │ │ │ ├── CheckpointWriteWorkerTests.java │ │ │ ├── ColdEntityWorkerTests.java │ │ │ ├── EntityColdStartWorkerTests.java │ │ │ └── ResultWriteWorkerTests.java │ │ ├── rest │ │ │ ├── ADRestTestUtils.java │ │ │ ├── AnomalyDetectorRestApiIT.java │ │ │ ├── DataDependentADRestApiIT.java │ │ │ ├── HistoricalAnalysisRestApiIT.java │ │ │ ├── SecureADRestIT.java │ │ │ └── handler │ │ │ │ ├── IndexAnomalyDetectorJobActionHandlerTests.java │ │ │ │ ├── StartDetectorTests.java │ │ │ │ └── StartHistoricalTests.java │ │ ├── settings │ │ │ ├── ADEnabledSettingTests.java │ │ │ ├── ADNumericSettingTests.java │ │ │ └── AnomalyDetectorSettingsTests.java │ │ ├── stats │ │ │ ├── ADStatTests.java │ │ │ ├── ADStatsResponseTests.java │ │ │ ├── ADStatsTests.java │ │ │ └── suppliers │ │ │ │ ├── CounterSupplierTests.java │ │ │ │ ├── IndexSupplierTests.java │ │ │ │ ├── ModelsOnNodeSupplierTests.java │ │ │ │ └── SettableSupplierTests.java │ │ ├── task │ │ │ ├── ADHCBatchTaskRunStateTests.java │ │ │ ├── ADTaskCacheManagerTests.java │ │ │ └── ADTaskManagerTests.java │ │ ├── transport │ │ │ ├── ADBatchAnomalyResultRequestTests.java │ │ │ ├── ADBatchAnomalyResultTransportActionTests.java │ │ │ ├── ADCancelTaskNodeRequestTests.java │ │ │ ├── ADCancelTaskTests.java │ │ │ ├── ADHCImputeNodeRequestTests.java │ │ │ ├── ADHCImputeNodesResponseTests.java │ │ │ ├── ADResultBulkResponseTests.java │ │ │ ├── ADStatsITTests.java │ │ │ ├── ADStatsTests.java │ │ │ ├── ADTaskProfileResponseTests.java │ │ │ ├── ADTaskProfileTests.java │ │ │ ├── ADTaskProfileTransportActionTests.java │ │ │ ├── AnomalyResultTests.java │ │ │ ├── AnomalyResultTransportActionTests.java │ │ │ ├── DelegateADProfileTransportAction.java │ │ │ ├── DelegateDeleteADModelTransportAction.java │ │ │ ├── DeleteAnomalyDetectorTransportActionTests.java │ │ │ ├── DeleteAnomalyResultsTransportActionTests.java │ │ │ ├── DeleteITTests.java │ │ │ ├── DeleteModelTransportActionTests.java │ │ │ ├── DeleteTests.java │ │ │ ├── EntityResultTransportActionTests.java │ │ │ ├── ForwardADTaskRequestTests.java │ │ │ ├── ForwardADTaskTests.java │ │ │ ├── ForwardADTaskTransportActionTests.java │ │ │ ├── GetAnomalyDetectorActionTests.java │ │ │ ├── GetAnomalyDetectorResponseTests.java │ │ │ ├── GetAnomalyDetectorTests.java │ │ │ ├── GetAnomalyDetectorTransportActionTests.java │ │ │ ├── IndexAnomalyDetectorActionTests.java │ │ │ ├── IndexAnomalyDetectorTransportActionTests.java │ │ │ ├── MultiEntityResultTests.java │ │ │ ├── PreviewAnomalyDetectorActionTests.java │ │ │ ├── PreviewAnomalyDetectorTransportActionTests.java │ │ │ ├── ProfileITTests.java │ │ │ ├── ProfileTests.java │ │ │ ├── RCFPollingTests.java │ │ │ ├── RCFResultITTests.java │ │ │ ├── RCFResultTests.java │ │ │ ├── RCFResultUnitTests.java │ │ │ ├── SearchADTasksActionTests.java │ │ │ ├── SearchADTasksTransportActionTests.java │ │ │ ├── SearchAnomalyDetectorActionTests.java │ │ │ ├── SearchAnomalyResultActionTests.java │ │ │ ├── SearchTopAnomalyResultActionTests.java │ │ │ ├── SearchTopAnomalyResultRequestTests.java │ │ │ ├── SearchTopAnomalyResultResponseTests.java │ │ │ ├── SearchTopAnomalyResultTransportActionTests.java │ │ │ ├── StatsAnomalyDetectorActionTests.java │ │ │ ├── StatsAnomalyDetectorTransportActionTests.java │ │ │ ├── StopDetectorActionTests.java │ │ │ ├── ThresholdResultITTests.java │ │ │ ├── ThresholdResultTests.java │ │ │ ├── ValidateAnomalyDetectorActionTests.java │ │ │ ├── ValidateAnomalyDetectorRequestTests.java │ │ │ ├── ValidateAnomalyDetectorResponseTests.java │ │ │ ├── ValidateAnomalyDetectorTransportActionTests.java │ │ │ └── handler │ │ │ │ ├── ADSearchHandlerTests.java │ │ │ │ ├── AbstractIndexHandlerTest.java │ │ │ │ ├── AnomalyResultBulkIndexHandlerTests.java │ │ │ │ ├── AnomalyResultHandlerTests.java │ │ │ │ └── MultiEntityResultHandlerTests.java │ │ └── util │ │ │ ├── ArrayEqMatcher.java │ │ │ ├── BulkUtilTests.java │ │ │ ├── DateUtilsTests.java │ │ │ ├── ExceptionUtilsTests.java │ │ │ ├── IndexUtilsTests.java │ │ │ ├── ParseUtilsTests.java │ │ │ ├── RestHandlerUtilsTests.java │ │ │ └── ThrowingSupplierWrapperTests.java │ │ ├── forecast │ │ ├── AbstractForecastSyntheticDataTest.java │ │ ├── CasterMemoryTests.java │ │ ├── ForecasterTests.java │ │ ├── SingleStreamProfileRunnerTests.java │ │ ├── indices │ │ │ ├── ForecastIndexManagementTests.java │ │ │ ├── ForecastIndexMappingTests.java │ │ │ └── ForecastResultIndexTests.java │ │ ├── ml │ │ │ └── ForecastRealTimeInferencerTests.java │ │ ├── model │ │ │ ├── ForecastResultTests.java │ │ │ ├── ForecastSerializationTests.java │ │ │ ├── ForecastTaskSerializationTests.java │ │ │ ├── ForecastTaskTests.java │ │ │ ├── ForecastTaskTypeTests.java │ │ │ └── ForecasterTests.java │ │ ├── rest │ │ │ ├── ForecastRestApiIT.java │ │ │ └── SecureForecastRestIT.java │ │ ├── settings │ │ │ ├── ForecastEnabledSettingTests.java │ │ │ └── ForecastNumericSettingTests.java │ │ └── transport │ │ │ ├── ForecastBooleanResponseTests.java │ │ │ └── GetForecasterTransportActionTests.java │ │ ├── search │ │ └── aggregations │ │ │ └── metrics │ │ │ └── CardinalityProfileTests.java │ │ └── timeseries │ │ ├── AbstractMemoryTrackerTest.java │ │ ├── AbstractSyntheticDataTest.java │ │ ├── AbstractTimeSeriesTest.java │ │ ├── DataByFeatureIdTests.java │ │ ├── NodeStateManagerTests.java │ │ ├── NodeStateTests.java │ │ ├── ODFERestTestCase.java │ │ ├── TestHelpers.java │ │ ├── TimeSeriesPluginTests.java │ │ ├── TimeSeriesResourceSharingExtensionTests.java │ │ ├── common │ │ └── exception │ │ │ └── ValidationExceptionTests.java │ │ ├── dataprocessor │ │ ├── ImputationOptionTests.java │ │ ├── IntegerSensitiveLinearUniformImputerTests.java │ │ ├── MultiFeatureLinearUniformImputerTests.java │ │ └── SingleFeatureLinearUniformImputerTests.java │ │ ├── exception │ │ ├── TimeSeriesExceptionCloneTests.java │ │ └── TimeSeriesExceptionSubclassTest.java │ │ ├── feature │ │ ├── NoPowermockSearchFeatureDaoTests.java │ │ ├── SearchFeatureDaoParamTests.java │ │ └── SearchFeatureDaoTests.java │ │ ├── indices │ │ ├── IndexManagementIntegTestCase.java │ │ └── rest │ │ │ └── handler │ │ │ ├── HistogramAggregationHelperTests.java │ │ │ └── IntervalCalculationTests.java │ │ ├── ml │ │ └── SampleTests.java │ │ ├── model │ │ └── TaskStateTests.java │ │ ├── ratelimit │ │ └── FeatureRequestTests.java │ │ ├── resources │ │ └── ResourceSharingClientAccessorTests.java │ │ ├── rest │ │ └── handler │ │ │ └── HistorySuggestTests.java │ │ ├── settings │ │ └── TimeSeriesEnabledSettingTests.java │ │ ├── transport │ │ ├── ADResultBulkTransportActionTests.java │ │ ├── ADStatsNodesTransportActionTests.java │ │ ├── AnomalyDetectorJobActionTests.java │ │ ├── AnomalyDetectorJobTransportActionTests.java │ │ ├── BooleanResponseTests.java │ │ ├── CronTransportActionTests.java │ │ ├── DeleteAnomalyDetectorActionTests.java │ │ ├── DeleteAnomalyDetectorTests.java │ │ ├── EntityProfileTests.java │ │ ├── ForecastResultBulkTransportActionTests.java │ │ ├── JobRequestTests.java │ │ ├── ProfileTransportActionTests.java │ │ ├── SearchAnomalyDetectorInfoActionTests.java │ │ ├── SuggestConfigParamRequestTests.java │ │ └── SuggestConfigParamResponseTests.java │ │ └── util │ │ ├── ClientUtilTests.java │ │ ├── CrossClusterConfigUtilsTests.java │ │ ├── LTrimTests.java │ │ ├── MultiResponsesDelegateActionListenerTests.java │ │ └── ParseUtilsTests.java └── test │ └── org │ └── opensearch │ └── ad │ └── util │ ├── ClusterCreation.java │ ├── FakeNode.java │ ├── JsonDeserializer.java │ ├── LabelledAnomalyGenerator.java │ ├── MLUtil.java │ ├── MultiDimDataWithTime.java │ └── RandomModelStateConfig.java └── resources ├── org └── opensearch │ └── ad │ ├── e2e │ └── data │ │ ├── rule.data │ │ ├── rule.label │ │ ├── synthetic.data │ │ └── synthetic.label │ └── ml │ ├── 1_3_0_rcf_model_pre_init.json │ ├── checkpoint_1.json │ ├── checkpoint_2.json │ ├── checkpoint_3.json │ ├── checkpoint_4.json │ ├── rc1_model_single_running.json │ ├── rc1_trcf_model_direct.json │ ├── rcf_1_0_checkpoint.json │ ├── rcf_3_0_rc3_hc.json │ ├── rcf_3_0_rc3_single_stream.json │ └── threshold_1_0_checkpoint.json └── security ├── sample.pem └── test-kirk.jks /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @jmazanec15 @jngz-es @kaituo @saratvemulapalli @ohltyler @vamshin @VijayanB @ylwu-amzn @amitgalitz @sudiptoguha @jackiehanyang @sean-zheng-amazon @dbwiddis @owaiskazi19 @joshpalis 2 | 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 🐛 Bug report 3 | about: Create a report to help us improve 4 | title: '[BUG]' 5 | labels: 'bug, untriaged' 6 | assignees: '' 7 | --- 8 | 9 | **What is the bug?** 10 | A clear and concise description of the bug. 11 | 12 | **How can one reproduce the bug?** 13 | Steps to reproduce the behavior: 14 | 1. Go to '...' 15 | 2. Click on '....' 16 | 3. Scroll down to '....' 17 | 4. See error 18 | 19 | **What is the expected behavior?** 20 | A clear and concise description of what you expected to happen. 21 | 22 | **What is your host/environment?** 23 | - OS: [e.g. iOS] 24 | - Version [e.g. 22] 25 | - Plugins 26 | 27 | **Do you have any screenshots?** 28 | If applicable, add screenshots to help explain your problem. 29 | 30 | **Do you have any additional context?** 31 | Add any other context about the problem. 32 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | contact_links: 2 | - name: OpenSearch Community Support 3 | url: https://discuss.opendistrocommunity.dev/ 4 | about: Please ask and answer questions here. 5 | - name: AWS/Amazon Security 6 | url: https://aws.amazon.com/security/vulnerability-reporting/ 7 | about: Please report security vulnerabilities here. -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 🎆 Feature request 3 | about: Request a feature in this project 4 | title: '[FEATURE]' 5 | labels: 'enhancement, untriaged' 6 | assignees: '' 7 | --- 8 | **Is your feature request related to a problem?** 9 | A clear and concise description of what the problem is, e.g. _I'm always frustrated when [...]_ 10 | 11 | **What solution would you like?** 12 | A clear and concise description of what you want to happen. 13 | 14 | **What alternatives have you considered?** 15 | A clear and concise description of any alternative solutions or features you've considered. 16 | 17 | **Do you have any additional context?** 18 | Add any other context or screenshots about the feature request here. -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Description 2 | [Describe what this change achieves] 3 | 4 | ### Related Issues 5 | Resolves #[Issue number to be closed when this PR is merged] 6 | 7 | 8 | ### Check List 9 | - [ ] New functionality includes testing. 10 | - [ ] New functionality has been documented. 11 | - [ ] API changes companion pull request [created](https://github.com/opensearch-project/opensearch-api-specification/blob/main/DEVELOPER_GUIDE.md). 12 | - [ ] Commits are signed per the DCO using `--signoff`. 13 | - [ ] Public documentation issue/PR [created](https://github.com/opensearch-project/documentation-website/issues/new/choose). 14 | 15 | By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. 16 | For more information on following Developer Certificate of Origin and signing off your commits, please check [here](https://github.com/opensearch-project/anomaly-detection/blob/main/CONTRIBUTING.md#developer-certificate-of-origin). 17 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "gradle" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | commit-message: 8 | prefix: "dependabot:" 9 | ignore: 10 | # For all packages, ignore all major versions to minimize breaking issues 11 | - dependency-name: "*" 12 | update-types: ["version-update:semver-major"] 13 | - package-ecosystem: "github-actions" 14 | directory: "/" 15 | schedule: 16 | interval: "weekly" 17 | commit-message: 18 | prefix: "dependabot:" -------------------------------------------------------------------------------- /.github/draft-release-notes-config.yml: -------------------------------------------------------------------------------- 1 | # The overall template of the release notes 2 | template: | 3 | Compatible with OpenSearch (**set version here**). 4 | $CHANGES 5 | 6 | # Setting the formatting and sorting for the release notes body 7 | name-template: Version (set version here) 8 | change-template: "* $TITLE ([#$NUMBER]($URL))" 9 | sort-by: merged_at 10 | sort-direction: ascending 11 | replacers: 12 | - search: "##" 13 | replace: "###" 14 | 15 | # Organizing the tagged PRs into unified ODFE categories 16 | categories: 17 | - title: "Breaking changes" 18 | labels: 19 | - "breaking change" 20 | - title: "Features" 21 | labels: 22 | - "feature" 23 | - title: "Enhancements" 24 | labels: 25 | - "enhancement" 26 | - title: "Bug Fixes" 27 | labels: 28 | - "bug" 29 | - "bug fix" 30 | - title: "Infrastructure" 31 | labels: 32 | - "infra" 33 | - "test" 34 | - "dependencies" 35 | - "github actions" 36 | - title: "Documentation" 37 | labels: 38 | - "documentation" 39 | - title: "Maintenance" 40 | labels: 41 | - "version upgrade" 42 | - "odfe release" 43 | - title: "Refactoring" 44 | labels: 45 | - "refactor" 46 | - "code quality" 47 | -------------------------------------------------------------------------------- /.github/labeler.yml: -------------------------------------------------------------------------------- 1 | backport 2.x: 2 | - "*" 3 | - "*/*" 4 | - "*/**/*" 5 | - "*/**/**/*" 6 | - "*/**/**/**/*" 7 | - "*/**/**/**/**/*" 8 | - "*/**/**/**/**/**/*" 9 | - "*/**/**/**/**/**/**/*" 10 | - "*/**/**/**/**/**/**/**/*" 11 | - "*/**/**/**/**/**/**/**/**/*" 12 | - ".github/**/*" 13 | 14 | infra: 15 | - ".github/**/*" 16 | - "build.gradle" 17 | 18 | documentation: 19 | - "*.md" 20 | - "release-notes/*" 21 | - "docs/*" 22 | -------------------------------------------------------------------------------- /.github/workflows/add-untriaged.yml: -------------------------------------------------------------------------------- 1 | name: Apply 'untriaged' label during issue lifecycle 2 | 3 | on: 4 | issues: 5 | types: [opened, reopened, transferred] 6 | 7 | env: 8 | ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true 9 | 10 | jobs: 11 | apply-label: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/github-script@v6 15 | with: 16 | script: | 17 | github.rest.issues.addLabels({ 18 | issue_number: context.issue.number, 19 | owner: context.repo.owner, 20 | repo: context.repo.repo, 21 | labels: ['untriaged'] 22 | }) 23 | -------------------------------------------------------------------------------- /.github/workflows/auto-release.yml: -------------------------------------------------------------------------------- 1 | name: Releases 2 | 3 | on: 4 | push: 5 | tags: 6 | - '*' 7 | 8 | env: 9 | ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | permissions: 15 | contents: write 16 | steps: 17 | - name: GitHub App token 18 | id: github_app_token 19 | uses: tibdex/github-app-token@v2.1.0 20 | with: 21 | app_id: ${{ secrets.APP_ID }} 22 | private_key: ${{ secrets.APP_PRIVATE_KEY }} 23 | installation_id: 22958780 24 | - name: Get tag 25 | id: tag 26 | uses: dawidd6/action-get-tag@v1 27 | - uses: actions/checkout@v4 28 | - uses: ncipollo/release-action@v1 29 | with: 30 | github_token: ${{ steps.github_app_token.outputs.token }} 31 | bodyFile: release-notes/opensearch-anomaly-detection.release-notes-${{steps.tag.outputs.tag}}.md -------------------------------------------------------------------------------- /.github/workflows/backport.yml: -------------------------------------------------------------------------------- 1 | name: Backport 2 | on: 3 | pull_request_target: 4 | types: 5 | - closed 6 | - labeled 7 | 8 | env: 9 | ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true 10 | 11 | jobs: 12 | backport: 13 | if: github.event.pull_request.merged == true 14 | runs-on: ubuntu-latest 15 | permissions: 16 | contents: write 17 | pull-requests: write 18 | name: Backport 19 | steps: 20 | - name: GitHub App token 21 | id: github_app_token 22 | uses: tibdex/github-app-token@v2.1.0 23 | with: 24 | app_id: ${{ secrets.APP_ID }} 25 | private_key: ${{ secrets.APP_PRIVATE_KEY }} 26 | installation_id: 22958780 27 | 28 | - name: Backport 29 | uses: VachaShah/backport@v2.2.0 30 | with: 31 | github_token: ${{ steps.github_app_token.outputs.token }} 32 | head_template: backport/backport-<%= number %>-to-<%= base %> 33 | failure_labels: backport-failed 34 | -------------------------------------------------------------------------------- /.github/workflows/changelog_verifier.yml: -------------------------------------------------------------------------------- 1 | name: "Changelog Verifier" 2 | on: 3 | push: 4 | branches-ignore: 5 | - 'whitesource-remediate/**' 6 | - 'backport/**' 7 | - 'dependabot/**' 8 | pull_request: 9 | types: [opened, edited, review_requested, synchronize, reopened, ready_for_review, labeled, unlabeled] 10 | 11 | jobs: 12 | # Enforces the update of a changelog file on every pull request 13 | verify-changelog: 14 | if: github.repository == 'opensearch-project/anomaly-detection' 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: actions/checkout@v4 18 | with: 19 | token: ${{ secrets.GITHUB_TOKEN }} 20 | ref: ${{ github.event.pull_request.head.sha }} 21 | 22 | - uses: dangoslen/changelog-enforcer@v3 23 | with: 24 | skipLabels: "autocut, skip-changelog" -------------------------------------------------------------------------------- /.github/workflows/delete_backport_branch.yml: -------------------------------------------------------------------------------- 1 | name: Delete merged branch of the backport PRs 2 | on: 3 | pull_request: 4 | types: 5 | - closed 6 | 7 | env: 8 | ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true 9 | 10 | jobs: 11 | delete-branch: 12 | runs-on: ubuntu-latest 13 | if: startsWith(github.event.pull_request.head.ref,'backport/') 14 | steps: 15 | - name: Delete merged branch 16 | uses: SvanBoxel/delete-merged-branch@main 17 | env: 18 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -------------------------------------------------------------------------------- /.github/workflows/draft-release-notes-workflow.yml: -------------------------------------------------------------------------------- 1 | name: Release Drafter 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | env: 9 | ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true 10 | 11 | jobs: 12 | update_release_draft: 13 | name: Update draft release notes 14 | runs-on: ubuntu-latest 15 | steps: 16 | - name: Update draft release notes 17 | uses: release-drafter/release-drafter@v6 18 | with: 19 | config-name: draft-release-notes-config.yml 20 | name: Version (set here) 21 | tag: (None) 22 | env: 23 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 24 | -------------------------------------------------------------------------------- /.github/workflows/labeler.yml: -------------------------------------------------------------------------------- 1 | name: "Pull Request Labeler" 2 | on: 3 | pull_request_target: 4 | branches: 5 | - main 6 | types: 7 | - opened 8 | 9 | jobs: 10 | label: 11 | runs-on: ubuntu-latest 12 | permissions: 13 | contents: write 14 | pull-requests: write 15 | steps: 16 | - name: GitHub App token 17 | id: github_app_token 18 | uses: tibdex/github-app-token@v2.1.0 19 | with: 20 | app_id: ${{ secrets.APP_ID }} 21 | private_key: ${{ secrets.APP_PRIVATE_KEY }} 22 | installation_id: 22958780 23 | - name: Label 24 | uses: actions/labeler@v4 25 | with: 26 | repo-token: ${{ steps.github_app_token.outputs.token }} 27 | -------------------------------------------------------------------------------- /.github/workflows/link-check-workflow.yml: -------------------------------------------------------------------------------- 1 | name: Link Checker 2 | on: 3 | push: 4 | branches: [main] 5 | pull_request: 6 | branches: [main] 7 | 8 | jobs: 9 | linkchecker: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - uses: actions/checkout@v4 14 | - name: lychee Link Checker 15 | id: lychee 16 | uses: lycheeverse/lychee-action@master 17 | with: 18 | args: --accept=200,403,429 --exclude=localhost **/*.html **/*.md **/*.txt **/*.json 19 | env: 20 | GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} 21 | - name: Fail if there were link errors 22 | run: exit ${{ steps.lychee.outputs.exit_code }} 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | buildSrc/build 2 | buildSrc/libs 3 | .gradle/ 4 | build/ 5 | .idea/ 6 | !.idea/codeStyles/codeStyleConfig.xml 7 | .DS_Store 8 | offline-repo.zip 9 | *.log 10 | out/ 11 | *.iml 12 | .project 13 | .settings 14 | .classpath 15 | .vscode 16 | bin/ 17 | ._.DS_Store 18 | src/test/resources/job-scheduler/ -------------------------------------------------------------------------------- /.whitesource: -------------------------------------------------------------------------------- 1 | { 2 | "scanSettings": { 3 | "configMode": "AUTO", 4 | "configExternalURL": "", 5 | "projectToken": "", 6 | "baseBranches": [] 7 | }, 8 | "checkRunSettings": { 9 | "vulnerableCheckRunConclusionLevel": "failure", 10 | "displayMode": "diff" 11 | }, 12 | "issueSettings": { 13 | "minSeverityLevel": "LOW" 14 | } 15 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # CHANGELOG 2 | All notable changes to this project are documented in this file. 3 | 4 | Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) 5 | 6 | ## [Unreleased 3.x](https://github.com/opensearch-project/anomaly-detection/compare/3.0...HEAD) 7 | ### Features 8 | ### Enhancements 9 | - Use Centralized Resource Access Control framework provided by security plugin ([#1400](https://github.com/opensearch-project/anomaly-detection/pull/1400)) 10 | - Introduce state machine, separate config index, improve suggest/validate APIs, and persist cold-start results for run-once visualization ([#1479](https://github.com/opensearch-project/anomaly-detection/pull/1479)) 11 | 12 | ### Bug Fixes 13 | ### Infrastructure 14 | ### Documentation 15 | ### Maintenance 16 | ### Refactoring 17 | 18 | ## [Unreleased 2.x](https://github.com/opensearch-project/anomaly-detection/compare/2.19...2.x) 19 | ### Features 20 | ### Enhancements 21 | ### Bug Fixes 22 | ### Infrastructure 23 | ### Documentation 24 | ### Maintenance 25 | ### Refactoring 26 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Contributing to this Project 2 | 3 | OpenSearch is a community project that is built and maintained by people just like **you**. 4 | [This document](https://github.com/opensearch-project/.github/blob/main/CONTRIBUTING.md) explains how you can contribute to this and related projects. 5 | -------------------------------------------------------------------------------- /NOTICE.txt: -------------------------------------------------------------------------------- 1 | OpenSearch (https://opensearch.org/) 2 | Copyright OpenSearch Contributors -------------------------------------------------------------------------------- /RELEASING.md: -------------------------------------------------------------------------------- 1 | This project follows the [OpenSearch release process](https://github.com/opensearch-project/.github/blob/main/RELEASING.md). 2 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | ## Reporting a Vulnerability 2 | 3 | If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/) or directly via email to aws-security@amazon.com. Please do **not** create a public GitHub issue. 4 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | status: 3 | project: 4 | default: 5 | threshold: 5 6 | target: auto 7 | plugin: 8 | target: 70% 9 | paths: 10 | - "!cli/" 11 | flags: 12 | - plugin 13 | patch: off 14 | comment: 15 | layout: "reach, diff, flags, files" 16 | behavior: default 17 | require_changes: false 18 | require_base: no 19 | require_head: no 20 | branches: null 21 | flags: 22 | plugin: 23 | carryforward: true -------------------------------------------------------------------------------- /dataGeneration/requirements.txt: -------------------------------------------------------------------------------- 1 | # indirect dependency of opensearch_py. Lower than 2.30 can cause CVE-2024-35195. 2 | requests>=2.32.0 3 | numpy==1.23.0 4 | opensearch_py==2.0.0 5 | retry==0.9.2 6 | scipy==1.10.0 7 | urllib3==1.26.19 -------------------------------------------------------------------------------- /docs/entity-priority.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/anomaly-detection/70eb22d02d5d0a68313e68137ffdbf7c030b2a53/docs/entity-priority.pdf -------------------------------------------------------------------------------- /docs/images/ml-ppl-use-case.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/anomaly-detection/70eb22d02d5d0a68313e68137ffdbf7c030b2a53/docs/images/ml-ppl-use-case.png -------------------------------------------------------------------------------- /docs/images/viz-integration-workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/anomaly-detection/70eb22d02d5d0a68313e68137ffdbf7c030b2a53/docs/images/viz-integration-workflow.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/anomaly-detection/70eb22d02d5d0a68313e68137ffdbf7c030b2a53/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionSha256Sum=2ab88d6de2c23e6adae7363ae6e29cbdd2a709e992929b48b6530fd0c7133bd6 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip 5 | networkTimeout=10000 6 | validateDistributionUrl=true 7 | zipStoreBase=GRADLE_USER_HOME 8 | zipStorePath=wrapper/dists 9 | -------------------------------------------------------------------------------- /release-notes/opendistro-for-elasticsearch-anomaly-detection.release-notes-1.10.1.0.md: -------------------------------------------------------------------------------- 1 | ## Version 1.10.1.0 Release Notes 2 | 3 | Compatible with Elasticsearch 7.9.1 4 | 5 | ### Documentation 6 | 7 | * Include release notes for 1.10.0.0 ([#219](https://github.com/opendistro-for-elasticsearch/anomaly-detection/pull/219)) 8 | * Update README.md ([#222](https://github.com/opendistro-for-elasticsearch/anomaly-detection/pull/222)) 9 | 10 | ### Maintenance 11 | 12 | * Upgrade from 1.10.0 to 1.10.1 ([#224](https://github.com/opendistro-for-elasticsearch/anomaly-detection/pull/224)) -------------------------------------------------------------------------------- /release-notes/opensearch-anomaly-detection.release-notes-1.0.0.0-beta1.md: -------------------------------------------------------------------------------- 1 | ## Version 1.0.0.0-beta1 Release Notes 2 | 3 | Compatible with OpenSearch 1.0.0 4 | 5 | ### Documentation 6 | 7 | * Removing few lingering Elasticsearch strings in the repo ([#6](https://github.com/opensearch-project/anomaly-detection/pull/6)) 8 | * Updating the license and docs ([#7](https://github.com/opensearch-project/anomaly-detection/pull/7)) 9 | * Add SPDX license header to all files ([#10](https://github.com/opensearch-project/anomaly-detection/pull/10)) 10 | * Updating the Notice.txt to relfect the right software being used ([#11](https://github.com/opensearch-project/anomaly-detection/pull/11)) 11 | * Updated copyright and external links. ([#12](https://github.com/opensearch-project/anomaly-detection/pull/12)) 12 | 13 | ### Maintenance 14 | 15 | * Migrating plugin to work with OpenSearch ([#1](https://github.com/opensearch-project/anomaly-detection/pull/1)) 16 | * Rename plugin to opensearch-anomaly-detection; bump plugin to 1.0.0-alpha2 ([#28](https://github.com/opensearch-project/anomaly-detection/pull/28)) 17 | * Bump plugin + dependencies to version 1.0.0.0-beta1 ([#32](https://github.com/opensearch-project/anomaly-detection/pull/32)) -------------------------------------------------------------------------------- /release-notes/opensearch-anomaly-detection.release-notes-1.0.0.0-rc1.md: -------------------------------------------------------------------------------- 1 | ## Version 1.0.0.0-rc1 Release Notes 2 | 3 | Compatible with OpenSearch 1.0.0-rc1 4 | 5 | ### Infrastructure 6 | 7 | * Update dependencies for opensearch ([#56](https://github.com/opensearch-project/anomaly-detection/pull/56)) 8 | * Update the AD version from beta1 to rc1. ([#62](https://github.com/opensearch-project/anomaly-detection/pull/62)) 9 | 10 | ### Maintenance 11 | 12 | * Renaming RestAPIs while supporting backwards compatibility. ([#35](https://github.com/opensearch-project/anomaly-detection/pull/35)) 13 | * Rename namespaces from opendistro to opensearch. ([#43](https://github.com/opensearch-project/anomaly-detection/pull/43)) 14 | * update the AD settings for opensearch. ([#47](https://github.com/opensearch-project/anomaly-detection/pull/47)) 15 | * Update several minor things from opendistro to opensearch ([#57](https://github.com/opensearch-project/anomaly-detection/pull/57)) 16 | -------------------------------------------------------------------------------- /release-notes/opensearch-anomaly-detection.release-notes-1.2.0.1.md: -------------------------------------------------------------------------------- 1 | ## Version 1.2.0.1 Release Notes 2 | 3 | Compatible with OpenSearch 1.2.0 4 | 5 | ### Bug Fixes 6 | 7 | * Don't throw exception if no result indices found when searching both default and custom result indices ([#322](https://github.com/opensearch-project/anomaly-detection/pull/322)) 8 | -------------------------------------------------------------------------------- /release-notes/opensearch-anomaly-detection.release-notes-2.0.1.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.0.1.0 Release Notes 2 | 3 | Compatible with OpenSearch 2.0.1 4 | 5 | 6 | ### Bug Fixes 7 | 8 | * Use current time as training data end time ([#547](https://github.com/opensearch-project/anomaly-detection/pull/547)) 9 | * bump rcf to 3.0-rc3 ([#568](https://github.com/opensearch-project/anomaly-detection/pull/568)) 10 | -------------------------------------------------------------------------------- /release-notes/opensearch-anomaly-detection.release-notes-2.1.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.1.0.0 Release Notes 2 | 3 | Compatible with OpenSearch 2.1.0 4 | 5 | 6 | ### Enhancements 7 | 8 | * bump rcf to 3.0-rc3 ([#568](https://github.com/opensearch-project/anomaly-detection/pull/568)) 9 | * Disable interpolation in HCAD cold start ([#575](https://github.com/opensearch-project/anomaly-detection/pull/575)) 10 | * Expose model accuracy metrics in tests ([#600](https://github.com/opensearch-project/anomaly-detection/pull/600)) 11 | 12 | ### Bug Fixes 13 | 14 | * Use current time as training data end time (#547) ([#557](https://github.com/opensearch-project/anomaly-detection/pull/557)) 15 | 16 | ### Infrastructure 17 | 18 | * 2.1 version bump and Gradle bump ([#582](https://github.com/opensearch-project/anomaly-detection/pull/582)) 19 | * Cluster manager revert fix ([#584](https://github.com/opensearch-project/anomaly-detection/pull/584)) 20 | * Adding HCAD data ingestion script to AD ([#585](https://github.com/opensearch-project/anomaly-detection/pull/585)) 21 | * Update ingestion ([#592](https://github.com/opensearch-project/anomaly-detection/pull/592)) 22 | * Adding custom plugin to publish zip to maven ([#594](https://github.com/opensearch-project/anomaly-detection/pull/594)) 23 | -------------------------------------------------------------------------------- /release-notes/opensearch-anomaly-detection.release-notes-2.10.0.0.md: -------------------------------------------------------------------------------- 1 | Compatible with OpenSearch 2.10.0. 2 | 3 | ### Refactor 4 | 5 | * Refactor due to core updates: Replace and modify classes and methods. ([#974](https://github.com/opensearch-project/anomaly-detection/pull/974)) 6 | 7 | 8 | ### Enhancements 9 | * Defaults anomaly grade to 0 if negative. ([#977](https://github.com/opensearch-project/anomaly-detection/pull/977)) 10 | * Update RCF to v3.8 and Enable Auto AD with 'Alert Once' Option ([#979](https://github.com/opensearch-project/anomaly-detection/pull/979)) 11 | * Revert "Enforce DOCUMENT Replication for AD Indices" ([#1006](https://github.com/opensearch-project/anomaly-detection/pull/1006)) 12 | 13 | ### Infrastructure 14 | 15 | * Adds auto release workflow ([#1003](https://github.com/opensearch-project/anomaly-detection/pull/1003)) 16 | * upgrading commons-lang3 version to fix conflict issue ([#1014](https://github.com/opensearch-project/anomaly-detection/pull/1014)) 17 | * Updates demo certs for integ tests ([#1021](https://github.com/opensearch-project/anomaly-detection/pull/1021)) 18 | * Upgrade AD's bwc baseline version to 1.3.2 to resolve cluster join issue ([#1029](https://github.com/opensearch-project/anomaly-detection/pull/1029)) 19 | 20 | -------------------------------------------------------------------------------- /release-notes/opensearch-anomaly-detection.release-notes-2.12.0.0.md: -------------------------------------------------------------------------------- 1 | Compatible with OpenSearch 2.12.0. 2 | 3 | 4 | ### Enhancements 5 | * Add an AD transport client ([#1111](https://github.com/opensearch-project/anomaly-detection/pull/1111)) 6 | * Add profile transport action to AD client ([#1123](https://github.com/opensearch-project/anomaly-detection/pull/1123)) 7 | * Refactor client's getDetectorProfile to use GetAnomalyDetectorTransportAction ([#1124](https://github.com/opensearch-project/anomaly-detection/pull/1124)) 8 | * Add ser/deser to get AD transport action request ([#1150](https://github.com/opensearch-project/anomaly-detection/pull/1150)) 9 | 10 | ### Infrastructure 11 | * Update to Gradle 8.5 ([#1131](https://github.com/opensearch-project/anomaly-detection/pull/1131)) 12 | * Remove default admin credentials ([#1134](https://github.com/opensearch-project/anomaly-detection/pull/1134)) 13 | * Require JDK version for java spotless check ([#1129](https://github.com/opensearch-project/anomaly-detection/pull/1129)) 14 | * Updated lucene snapshot url ([#1146](https://github.com/opensearch-project/anomaly-detection/pull/1146)) 15 | * Fix build, update CVE-affected versions ([#1102](https://github.com/opensearch-project/anomaly-detection/pull/1102)) 16 | 17 | -------------------------------------------------------------------------------- /release-notes/opensearch-anomaly-detection.release-notes-2.13.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.13.0.0 Release Notes 2 | 3 | Compatible with OpenSearch 2.13.0 4 | 5 | ### Infrastructure 6 | * Fixed lucene url ([#1158](https://github.com/opensearch-project/anomaly-detection/pull/1158)) 7 | 8 | ### Maintenance 9 | * Increment version to 2.13.0-SNAPSHOT ([#1156](https://github.com/opensearch-project/anomaly-detection/pull/1156)) -------------------------------------------------------------------------------- /release-notes/opensearch-anomaly-detection.release-notes-2.14.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.14.0.0 Release Notes 2 | 3 | Compatible with OpenSearch 2.14.0 4 | 5 | ### Infrastructure 6 | * Update sample cert and admin keystore ([#1163](https://github.com/opensearch-project/anomaly-detection/pull/1163)) 7 | -------------------------------------------------------------------------------- /release-notes/opensearch-anomaly-detection.release-notes-2.15.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.15.0.0 Release Notes 2 | 3 | Compatible with OpenSearch 2.15.0 4 | 5 | ### Enhancements 6 | 7 | * Refinement of Forecasting and AD Precision/Recall Improvements ([#1210](https://github.com/opensearch-project/anomaly-detection/pull/1210)) 8 | * make jvm heap usage a dynamic setting ([#1212](https://github.com/opensearch-project/anomaly-detection/pull/1212)) 9 | * Add custom result index lifecycle management condition fields to config ([#1215](https://github.com/opensearch-project/anomaly-detection/pull/1215)) 10 | * Make Custom Result Index Name an Alias ([#1225](https://github.com/opensearch-project/anomaly-detection/pull/1225)) 11 | * add custom result index lifecycle management ([#1232](https://github.com/opensearch-project/anomaly-detection/pull/1232)) 12 | * Merge Single-Stream and HC Detector Profiling Workflows ([#1237](https://github.com/opensearch-project/anomaly-detection/pull/1237)) 13 | 14 | 15 | ### Infrastructure 16 | 17 | * dependabot: bump com.diffplug.spotless from 6.24.0 to 6.25.0 ([#1184](https://github.com/opensearch-project/anomaly-detection/pull/1184)) 18 | -------------------------------------------------------------------------------- /release-notes/opensearch-anomaly-detection.release-notes-2.16.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.16.0.0 Release Notes 2 | 3 | Compatible with OpenSearch 2.16.0 4 | 5 | ### Feature 6 | * Adding support for date_nanos to Anomaly Detection ([#1238](https://github.com/opensearch-project/anomaly-detection/pull/1238)) 7 | 8 | ### Enhancements 9 | 10 | * update BWC test version and enhance code coverage([#1253](https://github.com/opensearch-project/anomaly-detection/pull/1253)) 11 | * Register system index descriptors through SystemIndexPlugin.getSystemIndexDescriptors([#1251](https://github.com/opensearch-project/anomaly-detection/pull/1251)) 12 | * Add feature filtering in model validation ([#1258](https://github.com/opensearch-project/anomaly-detection/pull/1258)) 13 | 14 | ### Infrastructure 15 | * set baseline JDK version to JDK-21 ([#1228](https://github.com/opensearch-project/anomaly-detection/pull/1228)) 16 | 17 | ### Maintenance 18 | * Update PULL_REQUEST_TEMPLATE to include an API spec change in the checklist ([#1262](https://github.com/opensearch-project/anomaly-detection/pull/1262)) 19 | -------------------------------------------------------------------------------- /release-notes/opensearch-anomaly-detection.release-notes-2.17.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.17.0.0 Release Notes 2 | 3 | Compatible with OpenSearch 2.17.0 4 | 5 | ### Feature 6 | * Add Support for Handling Missing Data in Anomaly Detection ([#1274](https://github.com/opensearch-project/anomaly-detection/pull/1274)) 7 | * Adding remote index and multi-index checks in validation ([#1290](https://github.com/opensearch-project/anomaly-detection/pull/1290)) 8 | 9 | ### Enhancements 10 | * Fix inference logic and standardize config index mapping ([#1284](https://github.com/opensearch-project/anomaly-detection/pull/1284)) 11 | 12 | ### Bug Fixes 13 | * Prevent resetting the latest flag of real-time when starting historical analysis ([#1287](https://github.com/opensearch-project/anomaly-detection/pull/1287)) 14 | * Correct handling of null max aggregation values in SearchResponse ([#1292](https://github.com/opensearch-project/anomaly-detection/pull/1292)) 15 | -------------------------------------------------------------------------------- /release-notes/opensearch-anomaly-detection.release-notes-2.17.1.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.17.1.0 Release Notes 2 | 3 | Compatible with OpenSearch 2.17.1 4 | 5 | ### Bug Fixes 6 | * Bump BWC Version to 2.18 and Fix Bugs ([#1311](https://github.com/opensearch-project/anomaly-detection/pull/1311)) -------------------------------------------------------------------------------- /release-notes/opensearch-anomaly-detection.release-notes-2.18.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.18.0.0 Release Notes 2 | 3 | Compatible with OpenSearch 2.18.0 4 | 5 | ### Enhancements 6 | * Add rule validation in AnomalyDetector constructor ([#1341](https://github.com/opensearch-project/anomaly-detection/pull/1341)) 7 | 8 | ### Bug Fixes 9 | * Bump RCF Version and Fix Default Rules Bug in AnomalyDetector ([#1334](https://github.com/opensearch-project/anomaly-detection/pull/1334)) 10 | * Fix race condition in PageListener ([#1351](https://github.com/opensearch-project/anomaly-detection/pull/1351)) 11 | 12 | ### Infrastructure 13 | * forward port flaky test fix and add forecasting security tests ([#1329](https://github.com/opensearch-project/anomaly-detection/pull/1329)) 14 | * Updating several dependencies ([#1337](https://github.com/opensearch-project/anomaly-detection/pull/1337)) -------------------------------------------------------------------------------- /release-notes/opensearch-anomaly-detection.release-notes-2.2.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.2.0.0 Release Notes 2 | 3 | Compatible with OpenSearch 2.2.0 4 | 5 | 6 | ### Enhancements 7 | 8 | * make 1M1min possible ([#620](https://github.com/opensearch-project/anomaly-detection/pull/620)) 9 | 10 | ### Infrastructure 11 | 12 | * fix zip fetching issue on version increment ([#611](https://github.com/opensearch-project/anomaly-detection/pull/611)) 13 | * Staging for version increment automation ([#608](https://github.com/opensearch-project/anomaly-detection/pull/608)) 14 | * Update BWC zip links ([#625](https://github.com/opensearch-project/anomaly-detection/pull/625)) 15 | 16 | ### Maintenance 17 | 18 | * Bump version to 2.2 ([#627](https://github.com/opensearch-project/anomaly-detection/pull/627)) -------------------------------------------------------------------------------- /release-notes/opensearch-anomaly-detection.release-notes-2.3.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.3.0.0 Release Notes 2 | 3 | Compatible with OpenSearch 2.3.0 4 | 5 | 6 | ### Documentation 7 | 8 | * Adding external property customDistributionUrl to let developer override default distribution Download url ([#380](https://github.com/opensearch-project/anomaly-detection/pull/380)) 9 | * Replace Forum link in Anomaly Detection plugin README.md ([#659](https://github.com/opensearch-project/anomaly-detection/pull/659)) 10 | 11 | ### Maintenance 12 | 13 | * Removed additional non-inclusive terms ([#644](https://github.com/opensearch-project/anomaly-detection/pull/644)) 14 | * Bump version to 2.3 ([#658](https://github.com/opensearch-project/anomaly-detection/pull/658)) 15 | -------------------------------------------------------------------------------- /release-notes/opensearch-anomaly-detection.release-notes-2.4.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.4.0.0 Release Notes 2 | 3 | Compatible with OpenSearch 2.4.0 4 | 5 | 6 | ### Infrastructure 7 | 8 | * Removed Github DCO action since DCO runs via Github App now ([#664](https://github.com/opensearch-project/anomaly-detection/pull/664)) 9 | * Add support for reproducible builds ([#579](https://github.com/opensearch-project/anomaly-detection/pull/579)) 10 | * Fix window delay test ([#674](https://github.com/opensearch-project/anomaly-detection/pull/674)) 11 | * update jackson dependency version ([#678](https://github.com/opensearch-project/anomaly-detection/pull/678)) 12 | * add groupId = org.opensearch.plugin ([#690](https://github.com/opensearch-project/anomaly-detection/pull/690)) 13 | * Bump jackson-databind to 2.13.4.2 ([#697](https://github.com/opensearch-project/anomaly-detection/pull/697)) 14 | 15 | ### Maintenance 16 | 17 | * Bump version to 2.4 ([#666](https://github.com/opensearch-project/anomaly-detection/pull/666)) 18 | -------------------------------------------------------------------------------- /release-notes/opensearch-anomaly-detection.release-notes-2.5.0.0.md: -------------------------------------------------------------------------------- 1 | ## Version 2.5.0.0 Release Notes 2 | 3 | Compatible with OpenSearch 2.5.0 4 | 5 | 6 | ### Enhancements 7 | 8 | * Speed up cold start ([#753](https://github.com/opensearch-project/anomaly-detection/pull/753)) 9 | 10 | ### Bug Fixes 11 | 12 | * Fix _source bug ([#749](https://github.com/opensearch-project/anomaly-detection/pull/749)) 13 | * Fix the discrepancy between Profile API and real time tasks API ([#770](https://github.com/opensearch-project/anomaly-detection/pull/770)) 14 | 15 | ### Infrastructure 16 | 17 | * Model Profile Test ([#748](https://github.com/opensearch-project/anomaly-detection/pull/748)) 18 | * Add option to run BWC tests in distribution level ([#766](https://github.com/opensearch-project/anomaly-detection/pull/766)) 19 | 20 | ### Documentation 21 | 22 | * Fix: typo in ohltyler. ([#760](https://github.com/opensearch-project/anomaly-detection/pull/760)) 23 | * Updated MAINTAINERS.md format. ([#771](https://github.com/opensearch-project/anomaly-detection/pull/771)) 24 | 25 | ### Maintenance 26 | 27 | * Increment version to 2.5.0-SNAPSHOT ([#711](https://github.com/opensearch-project/anomaly-detection/pull/711)) 28 | -------------------------------------------------------------------------------- /release-notes/opensearch-anomaly-detection.release-notes-2.6.0.0.md: -------------------------------------------------------------------------------- 1 | 2 | ## Version 2.6.0.0 Release Notes 3 | 4 | Compatible with OpenSearch 2.6.0 5 | 6 | 7 | ### Bug Fixes 8 | 9 | * Fixing dls/fls logic around numeric aggregations ([#800](https://github.com/opensearch-project/anomaly-detection/pull/800)) 10 | * Revert changes to exception message ([#803](https://github.com/opensearch-project/anomaly-detection/pull/803)) 11 | 12 | ### Infrastructure 13 | 14 | * Dynamically set bwc current version from properties version ([#778](https://github.com/opensearch-project/anomaly-detection/pull/778)) 15 | -------------------------------------------------------------------------------- /release-notes/opensearch-anomaly-detection.release-notes-2.7.0.0.md: -------------------------------------------------------------------------------- 1 | 2 | ## Version 2.7.0.0 Release Notes 3 | 4 | Compatible with OpenSearch 2.7.0 5 | 6 | 7 | ### Enhancements 8 | * Giving admin priority over backendrole filtering. ([#850](https://github.com/opensearch-project/anomaly-detection/pull/850)) 9 | 10 | 11 | ### Infrastructure 12 | * Created untriaged issue workflow. ([#809](https://github.com/opensearch-project/anomaly-detection/pull/809)) 13 | * Update XContent imports. ([#854](https://github.com/opensearch-project/anomaly-detection/pull/854)) 14 | * Update NodeInfo constructor. ([#869](https://github.com/opensearch-project/anomaly-detection/pull/869)) -------------------------------------------------------------------------------- /release-notes/opensearch-anomaly-detection.release-notes-2.8.0.0.md: -------------------------------------------------------------------------------- 1 | 2 | ## Version 2.8.0.0 Release Notes 3 | 4 | Compatible with OpenSearch 2.8.0 5 | 6 | 7 | ### Infrastructure 8 | * Partial Cherry-pick of #886 from anomaly-detection and Additional Adjustments. ([#914](https://github.com/opensearch-project/anomaly-detection/pull/914)) -------------------------------------------------------------------------------- /release-notes/opensearch-anomaly-detection.release-notes-2.9.0.0.md: -------------------------------------------------------------------------------- 1 | Compatible with OpenSearch 2.9.0. 2 | 3 | ### Enhancements 4 | 5 | * Enforce DOCUMENT Replication for AD Indices and Adjust Primary Shards ([#948](https://github.com/opensearch-project/anomaly-detection/pull/948)) 6 | 7 | ### Infrastructure 8 | 9 | * Updated Maintainers and CODE_OWNERS list ([#926](https://github.com/opensearch-project/anomaly-detection/pull/926)) 10 | * Bump guava version to 32.0.1 ([#933](https://github.com/opensearch-project/anomaly-detection/pull/933)) 11 | * Bump scipy from 1.8.0 to 1.10.0 in /dataGeneration ([#943](https://github.com/opensearch-project/anomaly-detection/pull/943)) 12 | * Fix main build - update import of Releasable and remove reference to BaseExceptionsHelper ([#930](https://github.com/opensearch-project/anomaly-detection/pull/930)) 13 | 14 | ### Documentation 15 | 16 | * Updated Maintainers and CODE_OWNERS list ([#926](https://github.com/opensearch-project/anomaly-detection/pull/926)) 17 | -------------------------------------------------------------------------------- /release-notes/opensearch-anomaly-detection.release-notes-3.0.0.0-alpha1.md: -------------------------------------------------------------------------------- 1 | ## Version 3.0.0.0-alpha1 Release Notes 2 | 3 | Compatible with OpenSearch 3.0.0.0-alpha1 4 | 5 | ### Maintenance 6 | - Fix breaking changes for 3.0.0 release ([#1424](https://github.com/opensearch-project/anomaly-detection/pull/1424)) 7 | -------------------------------------------------------------------------------- /release-notes/opensearch-anomaly-detection.release-notes-3.0.0.0-beta1.md: -------------------------------------------------------------------------------- 1 | ## Version 3.0.0.0-beta1 Release Notes 2 | 3 | Compatible with OpenSearch 3.0.0.0-beta1 4 | 5 | ### Enhancements 6 | - Use testclusters when testing with security ([#1414](https://github.com/opensearch-project/anomaly-detection/pull/1414)) 7 | 8 | ### Bug Fixes 9 | - Distinguish local cluster when local name is same as remote ([#1446](https://github.com/opensearch-project/anomaly-detection/pull/1446)) 10 | 11 | ### Infrastructure 12 | - Adding dual cluster arg to gradle run ([#1441](https://github.com/opensearch-project/anomaly-detection/pull/1441)) 13 | 14 | ### Maintenance 15 | - Increment version to 3.0.0.0-beta1 ([#1444](https://github.com/opensearch-project/anomaly-detection/pull/1444)) 16 | -------------------------------------------------------------------------------- /scripts/bwctest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | function usage() { 6 | echo "" 7 | echo "This script is used to run Backwards Compatibility tests" 8 | echo "--------------------------------------------------------------------------" 9 | echo "Usage: $0 [args]" 10 | echo "" 11 | echo "Required arguments:" 12 | echo "None" 13 | echo "" 14 | echo -e "-h\tPrint this message." 15 | echo "--------------------------------------------------------------------------" 16 | } 17 | 18 | while getopts ":h" arg; do 19 | case $arg in 20 | h) 21 | usage 22 | exit 1 23 | ;; 24 | ?) 25 | echo "Invalid option: -${OPTARG}" 26 | exit 1 27 | ;; 28 | esac 29 | done 30 | 31 | ./gradlew bwcTestSuite -Dtests.security.manager=false 32 | -------------------------------------------------------------------------------- /scripts/waf-sam/os-fire-sam.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/anomaly-detection/70eb22d02d5d0a68313e68137ffdbf7c030b2a53/scripts/waf-sam/os-fire-sam.zip -------------------------------------------------------------------------------- /scripts/waf-sam/os-fire-sam/custom/allvsblockedrequests.json: -------------------------------------------------------------------------------- 1 | { 2 | "attributes": { 3 | "title": "Allowed vs Blocked Requests", 4 | "visState": "{\"title\":\"Allowed vs Blocked Requests\",\"type\":\"timelion\",\"params\":{\"expression\":\".es(timefield=timestamp, q='action:ALLOW').label(\\\"Allowed Requests\\\").color(#009933), .es(timefield=timestamp, q='action:BLOCK').label(\\\"Blocked Requests\\\").color(#cc0000)\",\"interval\":\"1m\"},\"aggs\":[]}", 5 | "uiStateJSON": "{}", 6 | "description": "", 7 | "version": 1, 8 | "kibanaSavedObjectMeta": { 9 | "searchSourceJSON": "{\"query\":{\"language\":\"lucene\",\"query\":\"\"},\"filter\":[]}" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /scripts/waf-sam/os-fire-sam/custom/executedrules.json: -------------------------------------------------------------------------------- 1 | { 2 | "attributes": { 3 | "title": "Executed WAF Rules", 4 | "visState": "{\"title\":\"Executed WAF Rules\",\"type\":\"pie\",\"params\":{\"type\":\"pie\",\"addTooltip\":true,\"addLegend\":true,\"legendPosition\":\"right\",\"isDonut\":true,\"labels\":{\"show\":false,\"values\":true,\"last_level\":true,\"truncate\":100}},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"segment\",\"params\":{\"field\":\"rulename\",\"size\":5,\"order\":\"desc\",\"orderBy\":\"1\",\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\"}}]}", 5 | "uiStateJSON": "{}", 6 | "description": "", 7 | "version": 1, 8 | "kibanaSavedObjectMeta": { 9 | "searchSourceJSON": "{\"index\":\"awswaf\",\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /scripts/waf-sam/os-fire-sam/custom/httpmethods.json: -------------------------------------------------------------------------------- 1 | { 2 | "attributes": { 3 | "title": "HTTP Methods", 4 | "visState": "{\"title\":\"HTTP Methods\",\"type\":\"pie\",\"params\":{\"type\":\"pie\",\"addTooltip\":true,\"addLegend\":true,\"legendPosition\":\"right\",\"isDonut\":true,\"labels\":{\"show\":false,\"values\":true,\"last_level\":true,\"truncate\":100}},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"segment\",\"params\":{\"field\":\"httpRequest.httpMethod.keyword\",\"size\":10,\"order\":\"desc\",\"orderBy\":\"1\",\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\",\"customLabel\":\"\"}}]}", 5 | "uiStateJSON": "{}", 6 | "description": "", 7 | "version": 1, 8 | "kibanaSavedObjectMeta": { 9 | "searchSourceJSON": "{\"index\":\"awswaf\",\"query\":{\"language\":\"lucene\",\"query\":\"\"},\"filter\":[]}" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /scripts/waf-sam/os-fire-sam/custom/httpversions.json: -------------------------------------------------------------------------------- 1 | { 2 | "attributes": { 3 | "title": "HTTP Versions", 4 | "visState": "{\"title\":\"HTTP Versions\",\"type\":\"pie\",\"params\":{\"type\":\"pie\",\"addTooltip\":true,\"addLegend\":true,\"legendPosition\":\"right\",\"isDonut\":true,\"labels\":{\"show\":false,\"values\":true,\"last_level\":true,\"truncate\":100}},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"segment\",\"params\":{\"field\":\"httpRequest.httpVersion.keyword\",\"size\":10,\"order\":\"desc\",\"orderBy\":\"1\",\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\"}}]}", 5 | "uiStateJSON": "{}", 6 | "description": "", 7 | "version": 1, 8 | "kibanaSavedObjectMeta": { 9 | "searchSourceJSON": "{\"index\":\"awswaf\",\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /scripts/waf-sam/os-fire-sam/custom/numberofallrequests.json: -------------------------------------------------------------------------------- 1 | { 2 | "attributes": { 3 | "title": "Number of All Requests", 4 | "visState": "{\"title\":\"Number of All Requests\",\"type\":\"metric\",\"params\":{\"addLegend\":false,\"addTooltip\":true,\"metric\":{\"colorSchema\":\"Green to Red\",\"colorsRange\":[{\"from\":0,\"to\":10000}],\"invertColors\":false,\"labels\":{\"show\":false},\"metricColorMode\":\"None\",\"percentageMode\":false,\"style\":{\"bgColor\":false,\"bgFill\":\"#000\",\"fontSize\":30,\"labelColor\":false,\"subText\":\"\"},\"useRanges\":false},\"type\":\"metric\"},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{\"customLabel\":\"\"}}]}", 5 | "uiStateJSON": "{}", 6 | "description": "", 7 | "version": 1, 8 | "kibanaSavedObjectMeta": { 9 | "searchSourceJSON": "{\"index\":\"awswaf\",\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /scripts/waf-sam/os-fire-sam/custom/numberofblockedrequests.json: -------------------------------------------------------------------------------- 1 | { 2 | "attributes": { 3 | "title": "Number of Blocked Requests", 4 | "visState": "{\"title\":\"Number of Blocked Requests\",\"type\":\"metric\",\"params\":{\"addTooltip\":true,\"addLegend\":false,\"type\":\"metric\",\"metric\":{\"percentageMode\":false,\"useRanges\":false,\"colorSchema\":\"Green to Red\",\"metricColorMode\":\"None\",\"colorsRange\":[{\"from\":0,\"to\":10000}],\"labels\":{\"show\":false},\"invertColors\":false,\"style\":{\"bgFill\":\"#000\",\"bgColor\":false,\"labelColor\":false,\"subText\":\"\",\"fontSize\":30}}},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}}]}", 5 | "uiStateJSON": "{}", 6 | "description": "", 7 | "version": 1, 8 | "kibanaSavedObjectMeta": { 9 | "searchSourceJSON": "{\"index\":\"awswaf\",\"query\":{\"query\":\"action:BLOCK\",\"language\":\"lucene\"},\"filter\":[]}" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /scripts/waf-sam/os-fire-sam/custom/requestcount.json: -------------------------------------------------------------------------------- 1 | { 2 | "attributes": { 3 | "title": "Requests Count", 4 | "visState": "{\"title\":\"Requests Count\",\"type\":\"timelion\",\"params\":{\"expression\":\".es(timefield=timestamp).label(\\\"Requests Count\\\").color(#AA9933)\",\"interval\":\"auto\"},\"aggs\":[]}", 5 | "uiStateJSON": "{}", 6 | "description": "", 7 | "version": 1, 8 | "kibanaSavedObjectMeta": { 9 | "searchSourceJSON": "{\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /scripts/waf-sam/os-fire-sam/custom/template.json: -------------------------------------------------------------------------------- 1 | { 2 | "index_patterns": ["awswaf-*"], 3 | "settings": { 4 | "number_of_shards": 1 5 | }, 6 | "mappings": { 7 | "waflog": { 8 | "properties": { 9 | "httpRequest": { 10 | "properties": { 11 | "clientIp": { 12 | "type": "keyword", 13 | "fields": { 14 | "keyword": { 15 | "type": "ip" 16 | } 17 | } 18 | } 19 | } 20 | }, 21 | "timestamp": { 22 | "type": "date", 23 | "format": "epoch_millis" 24 | } 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /scripts/waf-sam/os-fire-sam/custom/top10countries.json: -------------------------------------------------------------------------------- 1 | { 2 | "attributes": { 3 | "title": "Top 10 Countries", 4 | "visState": "{\"title\":\"Top 10 Countries\",\"type\":\"table\",\"params\":{\"perPage\":10,\"showPartialRows\":false,\"showMetricsAtAllLevels\":false,\"sort\":{\"columnIndex\":null,\"direction\":null},\"showTotal\":false,\"totalFunc\":\"sum\"},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"bucket\",\"params\":{\"field\":\"httpRequest.country.keyword\",\"size\":10,\"order\":\"desc\",\"orderBy\":\"1\",\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\",\"customLabel\":\"Country\"}}]}", 5 | "uiStateJSON": "{\"vis\":{\"params\":{\"sort\":{\"columnIndex\":null,\"direction\":null}}}}", 6 | "description": "", 7 | "version": 1, 8 | "kibanaSavedObjectMeta": { 9 | "searchSourceJSON": "{\"index\":\"awswaf\",\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /scripts/waf-sam/os-fire-sam/custom/top10hosts.json: -------------------------------------------------------------------------------- 1 | { 2 | "attributes": { 3 | "title": "Top 10 Hosts", 4 | "visState": "{\"title\":\"Top 10 Hosts\",\"type\":\"table\",\"params\":{\"perPage\":10,\"showPartialRows\":false,\"showMetricsAtAllLevels\":false,\"sort\":{\"columnIndex\":null,\"direction\":null},\"showTotal\":false,\"totalFunc\":\"sum\"},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"bucket\",\"params\":{\"field\":\"Host\",\"size\":10,\"order\":\"desc\",\"orderBy\":\"1\",\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\",\"customLabel\":\"Host\"}}]}", 5 | "uiStateJSON": "{\"vis\":{\"params\":{\"sort\":{\"columnIndex\":null,\"direction\":null}}}}", 6 | "description": "", 7 | "version": 1, 8 | "kibanaSavedObjectMeta": { 9 | "searchSourceJSON": "{\"index\":\"awswaf\",\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /scripts/waf-sam/os-fire-sam/custom/top10ip.json: -------------------------------------------------------------------------------- 1 | { 2 | "attributes": { 3 | "title": "Top 10 IP Addresses", 4 | "visState": "{\"title\":\"Top 10 IP Addresses\",\"type\":\"table\",\"params\":{\"perPage\":10,\"showPartialRows\":false,\"showMetricsAtAllLevels\":false,\"sort\":{\"columnIndex\":null,\"direction\":null},\"showTotal\":false,\"totalFunc\":\"sum\"},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"bucket\",\"params\":{\"field\":\"httpRequest.clientIp\",\"size\":10,\"order\":\"desc\",\"orderBy\":\"1\",\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\",\"customLabel\":\"Client IP Address\"}}]}", 5 | "uiStateJSON": "{\"vis\":{\"params\":{\"sort\":{\"columnIndex\":null,\"direction\":null}}}}", 6 | "description": "", 7 | "version": 1, 8 | "kibanaSavedObjectMeta": { 9 | "searchSourceJSON": "{\"index\":\"awswaf\",\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /scripts/waf-sam/os-fire-sam/custom/top10rules.json: -------------------------------------------------------------------------------- 1 | { 2 | "attributes": { 3 | "title": "Top 10 Rules", 4 | "visState": "{\"title\":\"Top 10 Rules\",\"type\":\"table\",\"params\":{\"perPage\":10,\"showPartialRows\":false,\"showMetricsAtAllLevels\":false,\"sort\":{\"columnIndex\":null,\"direction\":null},\"showTotal\":false,\"totalFunc\":\"sum\"},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"bucket\",\"params\":{\"field\":\"rulename\",\"size\":10,\"order\":\"desc\",\"orderBy\":\"1\",\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\",\"customLabel\":\"Rule Name\"}}]}", 5 | "uiStateJSON": "{\"vis\":{\"params\":{\"sort\":{\"columnIndex\":null,\"direction\":null}}}}", 6 | "description": "", 7 | "version": 1, 8 | "kibanaSavedObjectMeta": { 9 | "searchSourceJSON": "{\"index\":\"awswaf\",\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /scripts/waf-sam/os-fire-sam/custom/top10uris.json: -------------------------------------------------------------------------------- 1 | { 2 | "attributes": { 3 | "title": "Top 10 URI", 4 | "visState": "{\"title\":\"Top 10 URI\",\"type\":\"table\",\"params\":{\"perPage\":10,\"showPartialRows\":false,\"showMetricsAtAllLevels\":false,\"sort\":{\"columnIndex\":0,\"direction\":null},\"showTotal\":false,\"totalFunc\":\"sum\"},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"bucket\",\"params\":{\"field\":\"httpRequest.uri.keyword\",\"size\":10,\"order\":\"desc\",\"orderBy\":\"1\",\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\",\"customLabel\":\"URI\"}}]}", 5 | "uiStateJSON": "{\"vis\":{\"params\":{\"sort\":{\"columnIndex\":0,\"direction\":null}}}}", 6 | "description": "", 7 | "version": 1, 8 | "kibanaSavedObjectMeta": { 9 | "searchSourceJSON": "{\"index\":\"awswaf\",\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /scripts/waf-sam/os-fire-sam/custom/top10useragents.json: -------------------------------------------------------------------------------- 1 | { 2 | "attributes": { 3 | "title": "Top 10 User-Agents", 4 | "visState": "{\"title\":\"Top 10 User-Agents\",\"type\":\"table\",\"params\":{\"perPage\":10,\"showPartialRows\":false,\"showMetricsAtAllLevels\":false,\"sort\":{\"columnIndex\":null,\"direction\":null},\"showTotal\":false,\"totalFunc\":\"sum\"},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"bucket\",\"params\":{\"field\":\"UserAgent\",\"size\":10,\"order\":\"desc\",\"orderBy\":\"1\",\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\",\"customLabel\":\"User-Agent\"}}]}", 5 | "uiStateJSON": "{\"vis\":{\"params\":{\"sort\":{\"columnIndex\":null,\"direction\":null}}}}", 6 | "description": "", 7 | "version": 1, 8 | "kibanaSavedObjectMeta": { 9 | "searchSourceJSON": "{\"index\":\"awswaf\",\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /scripts/waf-sam/os-fire-sam/custom/top10webacl.json: -------------------------------------------------------------------------------- 1 | { 2 | "attributes": { 3 | "title": "Top 10 WebACL", 4 | "visState": "{\"title\":\"Top 10 WebACL\",\"type\":\"table\",\"params\":{\"perPage\":10,\"showPartialRows\":false,\"showMetricsAtAllLevels\":false,\"sort\":{\"columnIndex\":null,\"direction\":null},\"showTotal\":false,\"totalFunc\":\"sum\"},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"bucket\",\"params\":{\"field\":\"webaclname\",\"size\":10,\"order\":\"desc\",\"orderBy\":\"1\",\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\",\"customLabel\":\"WebACL Name\"}}]}", 5 | "uiStateJSON": "{\"vis\":{\"params\":{\"sort\":{\"columnIndex\":null,\"direction\":null}}}}", 6 | "description": "", 7 | "version": 1, 8 | "kibanaSavedObjectMeta": { 9 | "searchSourceJSON": "{\"index\":\"awswaf\",\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /scripts/waf-sam/os-fire-sam/custom/uniqueipcount.json: -------------------------------------------------------------------------------- 1 | { 2 | "attributes": { 3 | "title": "Unique IP Count", 4 | "visState": "{\"title\":\"Unique IP Count\",\"type\":\"metric\",\"params\":{\"addTooltip\":true,\"addLegend\":false,\"type\":\"metric\",\"metric\":{\"percentageMode\":false,\"useRanges\":false,\"colorSchema\":\"Green to Red\",\"metricColorMode\":\"None\",\"colorsRange\":[{\"from\":0,\"to\":10000}],\"labels\":{\"show\":false},\"invertColors\":false,\"style\":{\"bgFill\":\"#000\",\"bgColor\":false,\"labelColor\":false,\"subText\":\"\",\"fontSize\":30}}},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"cardinality\",\"schema\":\"metric\",\"params\":{\"field\":\"httpRequest.clientIp\"}}]}", 5 | "uiStateJSON": "{}", 6 | "description": "", 7 | "version": 1, 8 | "kibanaSavedObjectMeta": { 9 | "searchSourceJSON": "{\"index\":\"awswaf\",\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /scripts/waf-sam/os-fire-sam/urllib3/_version.py: -------------------------------------------------------------------------------- 1 | # file generated by setuptools_scm 2 | # don't change, don't track in version control 3 | TYPE_CHECKING = False 4 | if TYPE_CHECKING: 5 | from typing import Tuple, Union 6 | VERSION_TUPLE = Tuple[Union[int, str], ...] 7 | else: 8 | VERSION_TUPLE = object 9 | 10 | version: str 11 | __version__: str 12 | __version_tuple__: VERSION_TUPLE 13 | version_tuple: VERSION_TUPLE 14 | 15 | __version__ = version = '2.3.0' 16 | __version_tuple__ = version_tuple = (2, 3, 0) 17 | -------------------------------------------------------------------------------- /scripts/waf-sam/os-fire-sam/urllib3/contrib/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/anomaly-detection/70eb22d02d5d0a68313e68137ffdbf7c030b2a53/scripts/waf-sam/os-fire-sam/urllib3/contrib/__init__.py -------------------------------------------------------------------------------- /scripts/waf-sam/os-fire-sam/urllib3/contrib/emscripten/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | import urllib3.connection 4 | 5 | from ...connectionpool import HTTPConnectionPool, HTTPSConnectionPool 6 | from .connection import EmscriptenHTTPConnection, EmscriptenHTTPSConnection 7 | 8 | 9 | def inject_into_urllib3() -> None: 10 | # override connection classes to use emscripten specific classes 11 | # n.b. mypy complains about the overriding of classes below 12 | # if it isn't ignored 13 | HTTPConnectionPool.ConnectionCls = EmscriptenHTTPConnection 14 | HTTPSConnectionPool.ConnectionCls = EmscriptenHTTPSConnection 15 | urllib3.connection.HTTPConnection = EmscriptenHTTPConnection # type: ignore[misc,assignment] 16 | urllib3.connection.HTTPSConnection = EmscriptenHTTPSConnection # type: ignore[misc,assignment] 17 | -------------------------------------------------------------------------------- /scripts/waf-sam/os-fire-sam/urllib3/contrib/emscripten/request.py: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from dataclasses import dataclass, field 4 | 5 | from ..._base_connection import _TYPE_BODY 6 | 7 | 8 | @dataclass 9 | class EmscriptenRequest: 10 | method: str 11 | url: str 12 | params: dict[str, str] | None = None 13 | body: _TYPE_BODY | None = None 14 | headers: dict[str, str] = field(default_factory=dict) 15 | timeout: float = 0 16 | decode_content: bool = True 17 | 18 | def set_header(self, name: str, value: str) -> None: 19 | self.headers[name.capitalize()] = value 20 | 21 | def set_body(self, body: _TYPE_BODY | None) -> None: 22 | self.body = body 23 | -------------------------------------------------------------------------------- /scripts/waf-sam/os-fire-sam/urllib3/py.typed: -------------------------------------------------------------------------------- 1 | # Instruct type checkers to look for inline type annotations in this package. 2 | # See PEP 561. 3 | -------------------------------------------------------------------------------- /scripts/waf-sam/os-fire-sam/urllib3/util/__init__.py: -------------------------------------------------------------------------------- 1 | # For backwards compatibility, provide imports that used to be here. 2 | from __future__ import annotations 3 | 4 | from .connection import is_connection_dropped 5 | from .request import SKIP_HEADER, SKIPPABLE_HEADERS, make_headers 6 | from .response import is_fp_closed 7 | from .retry import Retry 8 | from .ssl_ import ( 9 | ALPN_PROTOCOLS, 10 | IS_PYOPENSSL, 11 | SSLContext, 12 | assert_fingerprint, 13 | create_urllib3_context, 14 | resolve_cert_reqs, 15 | resolve_ssl_version, 16 | ssl_wrap_socket, 17 | ) 18 | from .timeout import Timeout 19 | from .url import Url, parse_url 20 | from .wait import wait_for_read, wait_for_write 21 | 22 | __all__ = ( 23 | "IS_PYOPENSSL", 24 | "SSLContext", 25 | "ALPN_PROTOCOLS", 26 | "Retry", 27 | "Timeout", 28 | "Url", 29 | "assert_fingerprint", 30 | "create_urllib3_context", 31 | "is_connection_dropped", 32 | "is_fp_closed", 33 | "parse_url", 34 | "make_headers", 35 | "resolve_cert_reqs", 36 | "resolve_ssl_version", 37 | "ssl_wrap_socket", 38 | "wait_for_read", 39 | "wait_for_write", 40 | "SKIP_HEADER", 41 | "SKIPPABLE_HEADERS", 42 | ) 43 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | rootProject.name = 'opensearch-anomaly-detection' 13 | -------------------------------------------------------------------------------- /src/forbidden/ad-signatures.txt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). 5 | * You may not use this file except in compliance with the License. 6 | * A copy of the License is located at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * or in the "license" file accompanying this file. This file is distributed 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 | * express or implied. See the License for the specific language governing 13 | * permissions and limitations under the License. 14 | */ 15 | 16 | @defaultMessage use format with Locale 17 | java.lang.String#format(java.lang.String,java.lang.Object[]) -------------------------------------------------------------------------------- /src/forbidden/ad-test-signatures.txt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | @defaultMessage use format with Locale 7 | java.lang.String#format(java.lang.String,java.lang.Object[]) 8 | java.util.concurrent.ThreadLocalRandom 9 | 10 | java.security.MessageDigest#clone() @ use org.opensearch.common.hash.MessageDigests 11 | 12 | @defaultMessage Don't use MethodHandles in slow or lenient ways, use invokeExact instead. 13 | java.lang.invoke.MethodHandle#invoke(java.lang.Object[]) 14 | java.lang.invoke.MethodHandle#invokeWithArguments(java.lang.Object[]) 15 | java.lang.invoke.MethodHandle#invokeWithArguments(java.util.List) 16 | java.lang.Math#random() @ Use one of the various randomization methods from LuceneTestCase or OpenSearchTestCase for reproducibility 17 | -------------------------------------------------------------------------------- /src/main/groovy/io/pry/gradle/offline_dependencies/Utils.groovy: -------------------------------------------------------------------------------- 1 | package io.pry.gradle.offline_dependencies 2 | 3 | public final class Utils { 4 | public static void addToMultimap(Map> map, K key, V value) { 5 | if (!map.containsKey(key)) { 6 | map.put(key, [] as Set) 7 | } 8 | map.get(key).add(value) 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/caching/ADCacheProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.ad.caching; 7 | 8 | import org.opensearch.timeseries.caching.CacheProvider; 9 | 10 | import com.amazon.randomcutforest.parkservices.ThresholdedRandomCutForest; 11 | 12 | /** 13 | * Allows Guice dependency based on types. Otherwise, Guice cannot 14 | * decide which instance to inject based on generic types of CacheProvider 15 | * 16 | */ 17 | public class ADCacheProvider extends CacheProvider { 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/cluster/diskcleanup/ADCheckpointIndexRetention.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.ad.cluster.diskcleanup; 7 | 8 | import java.time.Clock; 9 | import java.time.Duration; 10 | 11 | import org.opensearch.ad.constant.ADCommonName; 12 | import org.opensearch.timeseries.cluster.diskcleanup.BaseModelCheckpointIndexRetention; 13 | import org.opensearch.timeseries.cluster.diskcleanup.IndexCleanup; 14 | 15 | public class ADCheckpointIndexRetention extends BaseModelCheckpointIndexRetention { 16 | 17 | public ADCheckpointIndexRetention(Duration defaultCheckpointTtl, Clock clock, IndexCleanup indexCleanup) { 18 | super(defaultCheckpointTtl, clock, indexCleanup, ADCommonName.CHECKPOINT_INDEX_NAME); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/constant/ADCommonValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.constant; 13 | 14 | public class ADCommonValue { 15 | public static String INTERNAL_ACTION_PREFIX = "cluster:admin/opendistro/adinternal/"; 16 | public static String EXTERNAL_ACTION_PREFIX = "cluster:admin/opendistro/ad/"; 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/model/Action.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.ad.model; 7 | 8 | public enum Action { 9 | // ignore anomaly if found 10 | IGNORE_ANOMALY; 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/model/AnomalyDetectorType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.model; 13 | 14 | public enum AnomalyDetectorType { 15 | @Deprecated 16 | REALTIME_SINGLE_ENTITY, 17 | @Deprecated 18 | REALTIME_MULTI_ENTITY, 19 | @Deprecated 20 | HISTORICAL_SINGLE_ENTITY, 21 | @Deprecated 22 | HISTORICAL_MULTI_ENTITY, 23 | 24 | SINGLE_ENTITY, 25 | MULTI_ENTITY, 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/model/ImputedFeatureResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.ad.model; 7 | 8 | public class ImputedFeatureResult { 9 | boolean[] isFeatureImputed; 10 | double[] actual; 11 | 12 | public ImputedFeatureResult(boolean[] isFeatureImputed, double[] actual) { 13 | this.isFeatureImputed = isFeatureImputed; 14 | this.actual = actual; 15 | } 16 | 17 | public boolean[] getIsFeatureImputed() { 18 | return isFeatureImputed; 19 | } 20 | 21 | public double[] getActual() { 22 | return actual; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/model/Operator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.ad.model; 7 | 8 | // incomplete list. Will add more when needed. 9 | public enum Operator { 10 | LTE 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/rest/AbstractADSearchAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.ad.rest; 7 | 8 | import java.util.List; 9 | 10 | import org.apache.commons.lang3.tuple.Pair; 11 | import org.opensearch.action.ActionType; 12 | import org.opensearch.action.search.SearchResponse; 13 | import org.opensearch.ad.constant.ADCommonMessages; 14 | import org.opensearch.ad.settings.ADEnabledSetting; 15 | import org.opensearch.core.xcontent.ToXContentObject; 16 | import org.opensearch.timeseries.rest.AbstractSearchAction; 17 | 18 | public abstract class AbstractADSearchAction extends AbstractSearchAction { 19 | 20 | public AbstractADSearchAction( 21 | List urlPaths, 22 | List> deprecatedPaths, 23 | String index, 24 | Class clazz, 25 | ActionType actionType 26 | ) { 27 | super(urlPaths, deprecatedPaths, index, clazz, actionType, ADEnabledSetting::isADEnabled, ADCommonMessages.DISABLED_ERR_MSG); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/stats/ADStats.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.ad.stats; 7 | 8 | import java.util.Map; 9 | 10 | import org.opensearch.timeseries.stats.Stats; 11 | import org.opensearch.timeseries.stats.TimeSeriesStat; 12 | 13 | public class ADStats extends Stats { 14 | 15 | public ADStats(Map> stats) { 16 | super(stats); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/stats/suppliers/ADModelsOnNodeCountSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.ad.stats.suppliers; 7 | 8 | import java.util.function.Supplier; 9 | import java.util.stream.Stream; 10 | 11 | import org.opensearch.ad.caching.ADCacheProvider; 12 | import org.opensearch.ad.ml.ADModelManager; 13 | 14 | /** 15 | * ModelsOnNodeCountSupplier provides the number of models a node contains 16 | */ 17 | public class ADModelsOnNodeCountSupplier implements Supplier { 18 | private ADModelManager modelManager; 19 | private ADCacheProvider adCache; 20 | 21 | /** 22 | * Constructor 23 | * 24 | * @param modelManager object that manages the model partitions hosted on the node 25 | * @param adCache object that manages multi-entity detectors' models 26 | */ 27 | public ADModelsOnNodeCountSupplier(ADModelManager modelManager, ADCacheProvider adCache) { 28 | this.modelManager = modelManager; 29 | this.adCache = adCache; 30 | } 31 | 32 | @Override 33 | public Long get() { 34 | return Stream.concat(modelManager.getAllModels().stream(), adCache.get().getAllModels().stream()).count(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/task/ADTaskCancellationState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.task; 13 | 14 | public enum ADTaskCancellationState { 15 | NOT_FOUND, 16 | CANCELLED, 17 | ALREADY_CANCELLED 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/task/ADTaskSlotLimit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.task; 13 | 14 | public class ADTaskSlotLimit { 15 | // Task slots assigned to detector 16 | private Integer detectorTaskSlots; 17 | // How many task lanes this detector can start at most 18 | private Integer detectorTaskLaneLimit; 19 | 20 | public ADTaskSlotLimit(Integer detectorTaskSlots, Integer detectorTaskLaneLimit) { 21 | this.detectorTaskSlots = detectorTaskSlots; 22 | this.detectorTaskLaneLimit = detectorTaskLaneLimit; 23 | } 24 | 25 | public Integer getDetectorTaskSlots() { 26 | return detectorTaskSlots; 27 | } 28 | 29 | public void setDetectorTaskSlots(Integer detectorTaskSlots) { 30 | this.detectorTaskSlots = detectorTaskSlots; 31 | } 32 | 33 | public void setDetectorTaskLaneLimit(Integer detectorTaskLaneLimit) { 34 | this.detectorTaskLaneLimit = detectorTaskLaneLimit; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/ADBatchAnomalyResultAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.transport; 13 | 14 | import static org.opensearch.ad.constant.ADCommonName.AD_TASK; 15 | 16 | import org.opensearch.action.ActionType; 17 | import org.opensearch.ad.constant.ADCommonValue; 18 | 19 | public class ADBatchAnomalyResultAction extends ActionType { 20 | public static final String NAME = ADCommonValue.INTERNAL_ACTION_PREFIX + "detector/" + AD_TASK; 21 | public static final ADBatchAnomalyResultAction INSTANCE = new ADBatchAnomalyResultAction(); 22 | 23 | private ADBatchAnomalyResultAction() { 24 | super(NAME, ADBatchAnomalyResultResponse::new); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/ADBatchTaskRemoteExecutionAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.transport; 13 | 14 | import static org.opensearch.ad.constant.ADCommonName.AD_TASK_REMOTE; 15 | 16 | import org.opensearch.action.ActionType; 17 | import org.opensearch.ad.constant.ADCommonValue; 18 | 19 | public class ADBatchTaskRemoteExecutionAction extends ActionType { 20 | public static final String NAME = ADCommonValue.INTERNAL_ACTION_PREFIX + "detector/" + AD_TASK_REMOTE; 21 | public static final ADBatchTaskRemoteExecutionAction INSTANCE = new ADBatchTaskRemoteExecutionAction(); 22 | 23 | private ADBatchTaskRemoteExecutionAction() { 24 | super(NAME, ADBatchAnomalyResultResponse::new); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/ADCancelTaskAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.transport; 13 | 14 | import static org.opensearch.ad.constant.ADCommonName.CANCEL_TASK; 15 | 16 | import org.opensearch.action.ActionType; 17 | import org.opensearch.ad.constant.ADCommonValue; 18 | 19 | public class ADCancelTaskAction extends ActionType { 20 | 21 | public static final String NAME = ADCommonValue.INTERNAL_ACTION_PREFIX + "detectors/" + CANCEL_TASK; 22 | public static final ADCancelTaskAction INSTANCE = new ADCancelTaskAction(); 23 | 24 | private ADCancelTaskAction() { 25 | super(NAME, ADCancelTaskResponse::new); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/ADEntityProfileAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.ad.constant.ADCommonValue; 16 | import org.opensearch.timeseries.transport.EntityProfileResponse; 17 | 18 | public class ADEntityProfileAction extends ActionType { 19 | // Internal Action which is not used for public facing RestAPIs. 20 | public static final String NAME = ADCommonValue.INTERNAL_ACTION_PREFIX + "detectors/profile/entity"; 21 | public static final ADEntityProfileAction INSTANCE = new ADEntityProfileAction(); 22 | 23 | private ADEntityProfileAction() { 24 | super(NAME, EntityProfileResponse::new); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/ADHCImputeAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.ad.transport; 7 | 8 | import org.opensearch.action.ActionType; 9 | import org.opensearch.ad.constant.ADCommonValue; 10 | 11 | public class ADHCImputeAction extends ActionType { 12 | // Internal Action which is not used for public facing RestAPIs. 13 | public static final String NAME = ADCommonValue.INTERNAL_ACTION_PREFIX + "impute/hc"; 14 | public static final ADHCImputeAction INSTANCE = new ADHCImputeAction(); 15 | 16 | private ADHCImputeAction() { 17 | super(NAME, ADHCImputeNodesResponse::new); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/ADHCImputeNodeRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.ad.transport; 7 | 8 | import java.io.IOException; 9 | 10 | import org.opensearch.core.common.io.stream.StreamInput; 11 | import org.opensearch.core.common.io.stream.StreamOutput; 12 | import org.opensearch.transport.TransportRequest; 13 | 14 | public class ADHCImputeNodeRequest extends TransportRequest { 15 | private final ADHCImputeRequest request; 16 | 17 | public ADHCImputeNodeRequest(StreamInput in) throws IOException { 18 | super(in); 19 | this.request = new ADHCImputeRequest(in); 20 | } 21 | 22 | public ADHCImputeNodeRequest(ADHCImputeRequest request) { 23 | this.request = request; 24 | } 25 | 26 | @Override 27 | public void writeTo(StreamOutput out) throws IOException { 28 | super.writeTo(out); 29 | request.writeTo(out); 30 | } 31 | 32 | public ADHCImputeRequest getRequest() { 33 | return request; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/ADProfileAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.ad.constant.ADCommonValue; 16 | import org.opensearch.timeseries.transport.ProfileResponse; 17 | 18 | /** 19 | * Profile transport action 20 | */ 21 | public class ADProfileAction extends ActionType { 22 | // Internal Action which is not used for public facing RestAPIs. 23 | public static final String NAME = ADCommonValue.EXTERNAL_ACTION_PREFIX + "detectors/profile"; 24 | public static final ADProfileAction INSTANCE = new ADProfileAction(); 25 | 26 | /** 27 | * Constructor 28 | */ 29 | private ADProfileAction() { 30 | super(NAME, ProfileResponse::new); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/ADResultBulkRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.transport; 13 | 14 | import java.io.IOException; 15 | 16 | import org.opensearch.ad.model.AnomalyResult; 17 | import org.opensearch.ad.ratelimit.ADResultWriteRequest; 18 | import org.opensearch.core.common.io.stream.StreamInput; 19 | import org.opensearch.timeseries.transport.ResultBulkRequest; 20 | 21 | public class ADResultBulkRequest extends ResultBulkRequest { 22 | 23 | public ADResultBulkRequest() { 24 | super(); 25 | } 26 | 27 | public ADResultBulkRequest(StreamInput in) throws IOException { 28 | super(in, ADResultWriteRequest::new); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/ADSingleStreamResultAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.ad.transport; 7 | 8 | import org.opensearch.action.ActionType; 9 | import org.opensearch.action.support.clustermanager.AcknowledgedResponse; 10 | import org.opensearch.ad.constant.ADCommonValue; 11 | 12 | public class ADSingleStreamResultAction extends ActionType { 13 | // Internal Action which is not used for public facing RestAPIs. 14 | public static final String NAME = ADCommonValue.INTERNAL_ACTION_PREFIX + "singlestream/result"; 15 | public static final ADSingleStreamResultAction INSTANCE = new ADSingleStreamResultAction(); 16 | 17 | private ADSingleStreamResultAction() { 18 | super(NAME, AcknowledgedResponse::new); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/ADStatsNodesAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.ad.constant.ADCommonValue; 16 | import org.opensearch.timeseries.transport.StatsNodesResponse; 17 | 18 | /** 19 | * ADStatsNodesAction class 20 | */ 21 | public class ADStatsNodesAction extends ActionType { 22 | 23 | // Internal Action which is not used for public facing RestAPIs. 24 | public static final String NAME = ADCommonValue.INTERNAL_ACTION_PREFIX + "stats/nodes"; 25 | public static final ADStatsNodesAction INSTANCE = new ADStatsNodesAction(); 26 | 27 | /** 28 | * Constructor 29 | */ 30 | private ADStatsNodesAction() { 31 | super(NAME, StatsNodesResponse::new); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/ADTaskProfileAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.transport; 13 | 14 | import static org.opensearch.ad.constant.ADCommonName.AD_TASK; 15 | 16 | import org.opensearch.action.ActionType; 17 | import org.opensearch.ad.constant.ADCommonValue; 18 | 19 | public class ADTaskProfileAction extends ActionType { 20 | 21 | public static final String NAME = ADCommonValue.INTERNAL_ACTION_PREFIX + "detectors/profile/" + AD_TASK; 22 | public static final ADTaskProfileAction INSTANCE = new ADTaskProfileAction(); 23 | 24 | private ADTaskProfileAction() { 25 | super(NAME, ADTaskProfileResponse::new); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/AnomalyDetectorJobAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.ad.constant.ADCommonValue; 16 | import org.opensearch.timeseries.transport.JobResponse; 17 | 18 | public class AnomalyDetectorJobAction extends ActionType { 19 | // External Action which used for public facing RestAPIs. 20 | public static final String NAME = ADCommonValue.EXTERNAL_ACTION_PREFIX + "detector/jobmanagement"; 21 | public static final AnomalyDetectorJobAction INSTANCE = new AnomalyDetectorJobAction(); 22 | 23 | private AnomalyDetectorJobAction() { 24 | super(NAME, JobResponse::new); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/AnomalyResultAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.ad.constant.ADCommonValue; 16 | 17 | public class AnomalyResultAction extends ActionType { 18 | // External Action which used for public facing RestAPIs or actions we need to assume cx's role. 19 | public static final String NAME = ADCommonValue.EXTERNAL_ACTION_PREFIX + "detector/run"; 20 | public static final AnomalyResultAction INSTANCE = new AnomalyResultAction(); 21 | 22 | private AnomalyResultAction() { 23 | super(NAME, AnomalyResultResponse::new); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/DeleteADModelAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.ad.constant.ADCommonValue; 16 | import org.opensearch.timeseries.transport.DeleteModelResponse; 17 | 18 | public class DeleteADModelAction extends ActionType { 19 | // Internal Action which is not used for public facing RestAPIs. 20 | public static final String NAME = ADCommonValue.INTERNAL_ACTION_PREFIX + "model/delete"; 21 | public static final DeleteADModelAction INSTANCE = new DeleteADModelAction(); 22 | 23 | private DeleteADModelAction() { 24 | super(NAME, DeleteModelResponse::new); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/DeleteAnomalyDetectorAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.action.delete.DeleteResponse; 16 | import org.opensearch.ad.constant.ADCommonValue; 17 | 18 | public class DeleteAnomalyDetectorAction extends ActionType { 19 | // External Action which used for public facing RestAPIs. 20 | public static final String NAME = ADCommonValue.EXTERNAL_ACTION_PREFIX + "detector/delete"; 21 | public static final DeleteAnomalyDetectorAction INSTANCE = new DeleteAnomalyDetectorAction(); 22 | 23 | private DeleteAnomalyDetectorAction() { 24 | super(NAME, DeleteResponse::new); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/DeleteAnomalyResultsAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.ad.constant.ADCommonValue; 16 | import org.opensearch.index.reindex.BulkByScrollResponse; 17 | 18 | public class DeleteAnomalyResultsAction extends ActionType { 19 | // External Action which used for public facing RestAPIs. 20 | public static final String NAME = ADCommonValue.EXTERNAL_ACTION_PREFIX + "results/delete"; 21 | public static final DeleteAnomalyResultsAction INSTANCE = new DeleteAnomalyResultsAction(); 22 | 23 | private DeleteAnomalyResultsAction() { 24 | super(NAME, BulkByScrollResponse::new); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/EntityADResultAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.action.support.clustermanager.AcknowledgedResponse; 16 | import org.opensearch.ad.constant.ADCommonValue; 17 | 18 | public class EntityADResultAction extends ActionType { 19 | // Internal Action which is not used for public facing RestAPIs. 20 | public static final String NAME = ADCommonValue.INTERNAL_ACTION_PREFIX + "entity/result"; 21 | public static final EntityADResultAction INSTANCE = new EntityADResultAction(); 22 | 23 | private EntityADResultAction() { 24 | super(NAME, AcknowledgedResponse::new); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/ForwardADTaskAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.transport; 13 | 14 | import static org.opensearch.ad.constant.ADCommonName.AD_TASK; 15 | 16 | import org.opensearch.action.ActionType; 17 | import org.opensearch.ad.constant.ADCommonValue; 18 | import org.opensearch.timeseries.transport.JobResponse; 19 | 20 | public class ForwardADTaskAction extends ActionType { 21 | // Internal Action which is not used for public facing RestAPIs. 22 | public static final String NAME = ADCommonValue.INTERNAL_ACTION_PREFIX + "detector/" + AD_TASK + "/forward"; 23 | public static final ForwardADTaskAction INSTANCE = new ForwardADTaskAction(); 24 | 25 | private ForwardADTaskAction() { 26 | super(NAME, JobResponse::new); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/GetAnomalyDetectorAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.ad.constant.ADCommonValue; 16 | 17 | public class GetAnomalyDetectorAction extends ActionType { 18 | // External Action which used for public facing RestAPIs. 19 | public static final String NAME = ADCommonValue.EXTERNAL_ACTION_PREFIX + "detectors/get"; 20 | public static final GetAnomalyDetectorAction INSTANCE = new GetAnomalyDetectorAction(); 21 | 22 | private GetAnomalyDetectorAction() { 23 | super(NAME, GetAnomalyDetectorResponse::new); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/IndexAnomalyDetectorAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.ad.constant.ADCommonValue; 16 | 17 | public class IndexAnomalyDetectorAction extends ActionType { 18 | // External Action which used for public facing RestAPIs. 19 | public static final String NAME = ADCommonValue.EXTERNAL_ACTION_PREFIX + "detector/write"; 20 | public static final IndexAnomalyDetectorAction INSTANCE = new IndexAnomalyDetectorAction(); 21 | 22 | private IndexAnomalyDetectorAction() { 23 | super(NAME, IndexAnomalyDetectorResponse::new); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/PreviewAnomalyDetectorAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.ad.constant.ADCommonValue; 16 | 17 | public class PreviewAnomalyDetectorAction extends ActionType { 18 | // External Action which used for public facing RestAPIs. 19 | public static final String NAME = ADCommonValue.EXTERNAL_ACTION_PREFIX + "detector/preview"; 20 | public static final PreviewAnomalyDetectorAction INSTANCE = new PreviewAnomalyDetectorAction(); 21 | 22 | private PreviewAnomalyDetectorAction() { 23 | super(NAME, PreviewAnomalyDetectorResponse::new); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/RCFPollingAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.ad.constant.ADCommonValue; 16 | 17 | public class RCFPollingAction extends ActionType { 18 | // Internal Action which is not used for public facing RestAPIs. 19 | public static final String NAME = ADCommonValue.INTERNAL_ACTION_PREFIX + "rcfpolling"; 20 | public static final RCFPollingAction INSTANCE = new RCFPollingAction(); 21 | 22 | private RCFPollingAction() { 23 | super(NAME, RCFPollingResponse::new); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/RCFResultAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.ad.constant.ADCommonValue; 16 | 17 | public class RCFResultAction extends ActionType { 18 | // Internal Action which is not used for public facing RestAPIs. 19 | public static final String NAME = ADCommonValue.INTERNAL_ACTION_PREFIX + "rcf/result"; 20 | public static final RCFResultAction INSTANCE = new RCFResultAction(); 21 | 22 | private RCFResultAction() { 23 | super(NAME, RCFResultResponse::new); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/SearchADTasksAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.action.search.SearchResponse; 16 | import org.opensearch.ad.constant.ADCommonValue; 17 | 18 | public class SearchADTasksAction extends ActionType { 19 | // External Action which used for public facing RestAPIs. 20 | public static final String NAME = ADCommonValue.EXTERNAL_ACTION_PREFIX + "tasks/search"; 21 | public static final SearchADTasksAction INSTANCE = new SearchADTasksAction(); 22 | 23 | private SearchADTasksAction() { 24 | super(NAME, SearchResponse::new); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/SearchAnomalyDetectorAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.action.search.SearchResponse; 16 | import org.opensearch.ad.constant.ADCommonValue; 17 | 18 | public class SearchAnomalyDetectorAction extends ActionType { 19 | // External Action which used for public facing RestAPIs. 20 | public static final String NAME = ADCommonValue.EXTERNAL_ACTION_PREFIX + "detector/search"; 21 | public static final SearchAnomalyDetectorAction INSTANCE = new SearchAnomalyDetectorAction(); 22 | 23 | private SearchAnomalyDetectorAction() { 24 | super(NAME, SearchResponse::new); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/SearchAnomalyDetectorInfoAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.ad.constant.ADCommonValue; 16 | import org.opensearch.timeseries.transport.SearchConfigInfoResponse; 17 | 18 | public class SearchAnomalyDetectorInfoAction extends ActionType { 19 | // External Action which used for public facing RestAPIs. 20 | public static final String NAME = ADCommonValue.EXTERNAL_ACTION_PREFIX + "detector/info"; 21 | public static final SearchAnomalyDetectorInfoAction INSTANCE = new SearchAnomalyDetectorInfoAction(); 22 | 23 | private SearchAnomalyDetectorInfoAction() { 24 | super(NAME, SearchConfigInfoResponse::new); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/SearchAnomalyResultAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.action.search.SearchResponse; 16 | import org.opensearch.ad.constant.ADCommonValue; 17 | 18 | public class SearchAnomalyResultAction extends ActionType { 19 | // External Action which used for public facing RestAPIs. 20 | public static final String NAME = ADCommonValue.EXTERNAL_ACTION_PREFIX + "result/search"; 21 | public static final SearchAnomalyResultAction INSTANCE = new SearchAnomalyResultAction(); 22 | 23 | private SearchAnomalyResultAction() { 24 | super(NAME, SearchResponse::new); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/SearchTopAnomalyResultAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.ad.constant.ADCommonValue; 16 | 17 | public class SearchTopAnomalyResultAction extends ActionType { 18 | // External Action which used for public facing RestAPIs. 19 | public static final String NAME = ADCommonValue.EXTERNAL_ACTION_PREFIX + "result/topAnomalies"; 20 | public static final SearchTopAnomalyResultAction INSTANCE = new SearchTopAnomalyResultAction(); 21 | 22 | private SearchTopAnomalyResultAction() { 23 | super(NAME, SearchTopAnomalyResultResponse::new); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/StatsAnomalyDetectorAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.ad.constant.ADCommonValue; 16 | import org.opensearch.timeseries.transport.StatsTimeSeriesResponse; 17 | 18 | public class StatsAnomalyDetectorAction extends ActionType { 19 | // External Action which used for public facing RestAPIs. 20 | public static final String NAME = ADCommonValue.EXTERNAL_ACTION_PREFIX + "detector/stats"; 21 | public static final StatsAnomalyDetectorAction INSTANCE = new StatsAnomalyDetectorAction(); 22 | 23 | private StatsAnomalyDetectorAction() { 24 | super(NAME, StatsTimeSeriesResponse::new); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/StopDetectorAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.ad.constant.ADCommonValue; 16 | import org.opensearch.timeseries.transport.StopConfigResponse; 17 | 18 | public class StopDetectorAction extends ActionType { 19 | // Internal Action which is not used for public facing RestAPIs. 20 | public static final String NAME = ADCommonValue.INTERNAL_ACTION_PREFIX + "detector/stop"; 21 | public static final StopDetectorAction INSTANCE = new StopDetectorAction(); 22 | 23 | private StopDetectorAction() { 24 | super(NAME, StopConfigResponse::new); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/ThresholdResultAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.ad.constant.ADCommonValue; 16 | 17 | public class ThresholdResultAction extends ActionType { 18 | // Internal Action which is not used for public facing RestAPIs. 19 | public static final String NAME = ADCommonValue.INTERNAL_ACTION_PREFIX + "threshold/result"; 20 | public static final ThresholdResultAction INSTANCE = new ThresholdResultAction(); 21 | 22 | private ThresholdResultAction() { 23 | super(NAME, ThresholdResultResponse::new); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/ValidateAnomalyDetectorAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.ad.constant.ADCommonValue; 16 | import org.opensearch.timeseries.transport.ValidateConfigResponse; 17 | 18 | public class ValidateAnomalyDetectorAction extends ActionType { 19 | 20 | public static final String NAME = ADCommonValue.EXTERNAL_ACTION_PREFIX + "detector/validate"; 21 | public static final ValidateAnomalyDetectorAction INSTANCE = new ValidateAnomalyDetectorAction(); 22 | 23 | private ValidateAnomalyDetectorAction() { 24 | super(NAME, ValidateConfigResponse::new); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/ad/transport/handler/ADSearchHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.transport.handler; 13 | 14 | import org.opensearch.ad.settings.AnomalyDetectorSettings; 15 | import org.opensearch.cluster.service.ClusterService; 16 | import org.opensearch.common.settings.Settings; 17 | import org.opensearch.timeseries.transport.handler.SearchHandler; 18 | import org.opensearch.transport.client.Client; 19 | 20 | /** 21 | * Handle general search request, check user role and return search response. 22 | */ 23 | public class ADSearchHandler extends SearchHandler { 24 | 25 | public ADSearchHandler(Settings settings, ClusterService clusterService, Client client) { 26 | super(settings, clusterService, client, AnomalyDetectorSettings.AD_FILTER_BY_BACKEND_ROLES); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/ForecastTaskProfileRunner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.forecast; 7 | 8 | import org.opensearch.core.action.ActionListener; 9 | import org.opensearch.forecast.model.ForecastTask; 10 | import org.opensearch.forecast.model.ForecastTaskProfile; 11 | import org.opensearch.timeseries.TaskProfileRunner; 12 | 13 | public class ForecastTaskProfileRunner implements TaskProfileRunner { 14 | 15 | @Override 16 | public void getTaskProfile(ForecastTask configLevelTask, ActionListener listener) { 17 | // return null in other fields since forecasting have no in-memory task profiles as AD 18 | listener 19 | .onResponse( 20 | new ForecastTaskProfile( 21 | configLevelTask, 22 | null, 23 | null, 24 | null, 25 | configLevelTask == null ? null : configLevelTask.getTaskId(), 26 | null 27 | ) 28 | ); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/caching/ForecastCacheProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.forecast.caching; 7 | 8 | import org.opensearch.timeseries.caching.CacheProvider; 9 | 10 | import com.amazon.randomcutforest.parkservices.RCFCaster; 11 | 12 | public class ForecastCacheProvider extends CacheProvider { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/cluster/diskcleanup/ForecastCheckpointIndexRetention.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.forecast.cluster.diskcleanup; 7 | 8 | import java.time.Clock; 9 | import java.time.Duration; 10 | 11 | import org.opensearch.forecast.indices.ForecastIndex; 12 | import org.opensearch.timeseries.cluster.diskcleanup.BaseModelCheckpointIndexRetention; 13 | import org.opensearch.timeseries.cluster.diskcleanup.IndexCleanup; 14 | 15 | public class ForecastCheckpointIndexRetention extends BaseModelCheckpointIndexRetention { 16 | 17 | public ForecastCheckpointIndexRetention(Duration defaultCheckpointTtl, Clock clock, IndexCleanup indexCleanup) { 18 | super(defaultCheckpointTtl, clock, indexCleanup, ForecastIndex.CHECKPOINT.getIndexName()); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/constant/ForecastCommonValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.forecast.constant; 13 | 14 | public class ForecastCommonValue { 15 | public static String INTERNAL_ACTION_PREFIX = "cluster:admin/plugin/forecastinternal/"; 16 | public static String EXTERNAL_ACTION_PREFIX = "cluster:admin/plugin/forecast/"; 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/model/FilterBy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.forecast.model; 7 | 8 | public enum FilterBy { 9 | BUILD_IN_QUERY, 10 | CUSTOM_QUERY 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/model/Order.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.forecast.model; 7 | 8 | public enum Order { 9 | ASC, 10 | DESC 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/stats/ForecastStats.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.forecast.stats; 7 | 8 | import java.util.Map; 9 | 10 | import org.opensearch.timeseries.stats.Stats; 11 | import org.opensearch.timeseries.stats.TimeSeriesStat; 12 | 13 | public class ForecastStats extends Stats { 14 | 15 | public ForecastStats(Map> stats) { 16 | super(stats); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/stats/suppliers/ForecastModelsOnNodeCountSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.forecast.stats.suppliers; 7 | 8 | import java.util.function.Supplier; 9 | 10 | import org.opensearch.forecast.caching.ForecastCacheProvider; 11 | 12 | /** 13 | * ModelsOnNodeCountSupplier provides the number of models a node contains 14 | */ 15 | public class ForecastModelsOnNodeCountSupplier implements Supplier { 16 | private ForecastCacheProvider forecastCache; 17 | 18 | /** 19 | * Constructor 20 | * 21 | * @param forecastCache object that manages models 22 | */ 23 | public ForecastModelsOnNodeCountSupplier(ForecastCacheProvider forecastCache) { 24 | this.forecastCache = forecastCache; 25 | } 26 | 27 | @Override 28 | public Long get() { 29 | return forecastCache.get().getAllModels().stream().count(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/transport/BuildInQuery.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.forecast.transport; 7 | 8 | public enum BuildInQuery { 9 | MIN_CONFIDENCE_INTERVAL_WIDTH, 10 | MAX_CONFIDENCE_INTERVAL_WIDTH, 11 | MIN_VALUE_WITHIN_THE_HORIZON, 12 | MAX_VALUE_WITHIN_THE_HORIZON, 13 | DISTANCE_TO_THRESHOLD_VALUE 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/transport/DeleteForecastModelAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.forecast.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.forecast.constant.ForecastCommonValue; 16 | import org.opensearch.timeseries.transport.DeleteModelResponse; 17 | 18 | public class DeleteForecastModelAction extends ActionType { 19 | // Internal Action which is not used for public facing RestAPIs. 20 | public static final String NAME = ForecastCommonValue.INTERNAL_ACTION_PREFIX + "model/delete"; 21 | public static final DeleteForecastModelAction INSTANCE = new DeleteForecastModelAction(); 22 | 23 | private DeleteForecastModelAction() { 24 | super(NAME, DeleteModelResponse::new); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/transport/DeleteForecasterAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.forecast.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.action.delete.DeleteResponse; 16 | import org.opensearch.forecast.constant.ForecastCommonValue; 17 | 18 | public class DeleteForecasterAction extends ActionType { 19 | // External Action which used for public facing RestAPIs. 20 | public static final String NAME = ForecastCommonValue.EXTERNAL_ACTION_PREFIX + "forecaster/delete"; 21 | public static final DeleteForecasterAction INSTANCE = new DeleteForecasterAction(); 22 | 23 | private DeleteForecasterAction() { 24 | super(NAME, DeleteResponse::new); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/transport/EntityForecastResultAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | package org.opensearch.forecast.transport; 12 | 13 | import org.opensearch.action.ActionType; 14 | import org.opensearch.action.support.clustermanager.AcknowledgedResponse; 15 | import org.opensearch.forecast.constant.ForecastCommonValue; 16 | 17 | public class EntityForecastResultAction extends ActionType { 18 | // Internal Action which is not used for public facing RestAPIs. 19 | public static final String NAME = ForecastCommonValue.INTERNAL_ACTION_PREFIX + "entity/result"; 20 | public static final EntityForecastResultAction INSTANCE = new EntityForecastResultAction(); 21 | 22 | private EntityForecastResultAction() { 23 | super(NAME, AcknowledgedResponse::new); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/transport/ForecastEntityProfileAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.forecast.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.forecast.constant.ForecastCommonValue; 16 | import org.opensearch.timeseries.transport.EntityProfileResponse; 17 | 18 | public class ForecastEntityProfileAction extends ActionType { 19 | // Internal Action which is not used for public facing RestAPIs. 20 | public static final String NAME = ForecastCommonValue.INTERNAL_ACTION_PREFIX + "forecasters/profile/entity"; 21 | public static final ForecastEntityProfileAction INSTANCE = new ForecastEntityProfileAction(); 22 | 23 | private ForecastEntityProfileAction() { 24 | super(NAME, EntityProfileResponse::new); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/transport/ForecastImputeMissingValueAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.forecast.transport; 7 | 8 | import org.opensearch.action.ActionType; 9 | import org.opensearch.action.support.clustermanager.AcknowledgedResponse; 10 | import org.opensearch.forecast.constant.ForecastCommonValue; 11 | 12 | public class ForecastImputeMissingValueAction extends ActionType { 13 | // Internal Action which is not used for public facing RestAPIs. 14 | public static final String NAME = ForecastCommonValue.INTERNAL_ACTION_PREFIX + "impute"; 15 | public static final ForecastImputeMissingValueAction INSTANCE = new ForecastImputeMissingValueAction(); 16 | 17 | public ForecastImputeMissingValueAction() { 18 | super(NAME, AcknowledgedResponse::new); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/transport/ForecastProfileAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.forecast.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.forecast.constant.ForecastCommonValue; 16 | import org.opensearch.timeseries.transport.ProfileResponse; 17 | 18 | /** 19 | * Profile transport action 20 | */ 21 | public class ForecastProfileAction extends ActionType { 22 | // Internal Action which is not used for public facing RestAPIs. 23 | public static final String NAME = ForecastCommonValue.EXTERNAL_ACTION_PREFIX + "forecasters/profile"; 24 | public static final ForecastProfileAction INSTANCE = new ForecastProfileAction(); 25 | 26 | /** 27 | * Constructor 28 | */ 29 | private ForecastProfileAction() { 30 | super(NAME, ProfileResponse::new); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/transport/ForecastResultAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.forecast.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.forecast.constant.ForecastCommonValue; 16 | 17 | public class ForecastResultAction extends ActionType { 18 | // External Action which used for public facing RestAPIs or actions we need to assume cx's role. 19 | public static final String NAME = ForecastCommonValue.EXTERNAL_ACTION_PREFIX + "forecaster/run"; 20 | public static final ForecastResultAction INSTANCE = new ForecastResultAction(); 21 | 22 | private ForecastResultAction() { 23 | super(NAME, ForecastResultResponse::new); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/transport/ForecastResultBulkRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.forecast.transport; 13 | 14 | import java.io.IOException; 15 | 16 | import org.opensearch.core.common.io.stream.StreamInput; 17 | import org.opensearch.forecast.model.ForecastResult; 18 | import org.opensearch.forecast.ratelimit.ForecastResultWriteRequest; 19 | import org.opensearch.timeseries.transport.ResultBulkRequest; 20 | 21 | public class ForecastResultBulkRequest extends ResultBulkRequest { 22 | 23 | public ForecastResultBulkRequest() { 24 | super(); 25 | } 26 | 27 | public ForecastResultBulkRequest(StreamInput in) throws IOException { 28 | super(in, ForecastResultWriteRequest::new); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/transport/ForecastRunOnceAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.forecast.transport; 7 | 8 | import org.opensearch.action.ActionType; 9 | import org.opensearch.forecast.constant.ForecastCommonValue; 10 | 11 | public class ForecastRunOnceAction extends ActionType { 12 | // External Action which used for public facing RestAPIs. 13 | public static final String NAME = ForecastCommonValue.EXTERNAL_ACTION_PREFIX + "forecaster/runOnce"; 14 | public static final ForecastRunOnceAction INSTANCE = new ForecastRunOnceAction(); 15 | 16 | private ForecastRunOnceAction() { 17 | super(NAME, ForecastResultResponse::new); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/transport/ForecastRunOnceProfileAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.forecast.transport; 7 | 8 | import org.opensearch.action.ActionType; 9 | import org.opensearch.forecast.constant.ForecastCommonValue; 10 | 11 | public class ForecastRunOnceProfileAction extends ActionType { 12 | // External Action which used for public facing RestAPIs. 13 | public static final String NAME = ForecastCommonValue.EXTERNAL_ACTION_PREFIX + "forecaster/runOnceProfile"; 14 | public static final ForecastRunOnceProfileAction INSTANCE = new ForecastRunOnceProfileAction(); 15 | 16 | private ForecastRunOnceProfileAction() { 17 | super(NAME, ForecastRunOnceProfileResponse::new); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/transport/ForecastRunOnceProfileNodeRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.forecast.transport; 7 | 8 | import java.io.IOException; 9 | 10 | import org.opensearch.core.common.io.stream.StreamInput; 11 | import org.opensearch.core.common.io.stream.StreamOutput; 12 | import org.opensearch.transport.TransportRequest; 13 | 14 | public class ForecastRunOnceProfileNodeRequest extends TransportRequest { 15 | private ForecastRunOnceProfileRequest request; 16 | 17 | public ForecastRunOnceProfileNodeRequest() { 18 | super(); 19 | } 20 | 21 | public ForecastRunOnceProfileNodeRequest(StreamInput in) throws IOException { 22 | super(in); 23 | request = new ForecastRunOnceProfileRequest(in); 24 | } 25 | 26 | public ForecastRunOnceProfileNodeRequest(ForecastRunOnceProfileRequest request) { 27 | this.request = request; 28 | } 29 | 30 | @Override 31 | public void writeTo(StreamOutput out) throws IOException { 32 | super.writeTo(out); 33 | request.writeTo(out); 34 | } 35 | 36 | public String getConfigId() { 37 | return request.getConfigId(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/transport/ForecastSingleStreamResultAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.forecast.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.action.support.clustermanager.AcknowledgedResponse; 16 | import org.opensearch.forecast.constant.ForecastCommonValue; 17 | 18 | public class ForecastSingleStreamResultAction extends ActionType { 19 | // Internal Action which is not used for public facing RestAPIs. 20 | public static final String NAME = ForecastCommonValue.INTERNAL_ACTION_PREFIX + "singlestream/result"; 21 | public static final ForecastSingleStreamResultAction INSTANCE = new ForecastSingleStreamResultAction(); 22 | 23 | private ForecastSingleStreamResultAction() { 24 | super(NAME, AcknowledgedResponse::new); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/transport/ForecastStatsNodesAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.forecast.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.forecast.constant.ForecastCommonValue; 16 | import org.opensearch.timeseries.transport.StatsNodesResponse; 17 | 18 | /** 19 | * ADStatsNodesAction class 20 | */ 21 | public class ForecastStatsNodesAction extends ActionType { 22 | 23 | // Internal Action which is not used for public facing RestAPIs. 24 | public static final String NAME = ForecastCommonValue.INTERNAL_ACTION_PREFIX + "stats/nodes"; 25 | public static final ForecastStatsNodesAction INSTANCE = new ForecastStatsNodesAction(); 26 | 27 | /** 28 | * Constructor 29 | */ 30 | private ForecastStatsNodesAction() { 31 | super(NAME, StatsNodesResponse::new); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/transport/ForecasterJobAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.forecast.transport; 7 | 8 | import org.opensearch.action.ActionType; 9 | import org.opensearch.forecast.constant.ForecastCommonValue; 10 | import org.opensearch.timeseries.transport.JobResponse; 11 | 12 | public class ForecasterJobAction extends ActionType { 13 | // External Action which used for public facing RestAPIs. 14 | public static final String NAME = ForecastCommonValue.EXTERNAL_ACTION_PREFIX + "forecaster/jobmanagement"; 15 | public static final ForecasterJobAction INSTANCE = new ForecasterJobAction(); 16 | 17 | private ForecasterJobAction() { 18 | super(NAME, JobResponse::new); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/transport/GetForecasterAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.forecast.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.forecast.constant.ForecastCommonValue; 16 | 17 | public class GetForecasterAction extends ActionType { 18 | // External Action which used for public facing RestAPIs. 19 | public static final String NAME = ForecastCommonValue.EXTERNAL_ACTION_PREFIX + "forecasters/get"; 20 | public static final GetForecasterAction INSTANCE = new GetForecasterAction(); 21 | 22 | private GetForecasterAction() { 23 | super(NAME, GetForecasterResponse::new); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/transport/IndexForecasterAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.forecast.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.forecast.constant.ForecastCommonValue; 16 | 17 | public class IndexForecasterAction extends ActionType { 18 | // External Action which used for public facing RestAPIs. 19 | public static final String NAME = ForecastCommonValue.EXTERNAL_ACTION_PREFIX + "forecaster/write"; 20 | public static final IndexForecasterAction INSTANCE = new IndexForecasterAction(); 21 | 22 | private IndexForecasterAction() { 23 | super(NAME, IndexForecasterResponse::new); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/transport/RelationalOperation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.forecast.transport; 7 | 8 | public enum RelationalOperation { 9 | GREATER_THAN(">"), 10 | GREATER_THAN_OR_EQUAL_TO(">="), 11 | LESS_THAN("<"), 12 | LESS_THAN_OR_EQUAL_TO("<="); 13 | 14 | private final String symbol; 15 | 16 | RelationalOperation(String symbol) { 17 | this.symbol = symbol; 18 | } 19 | 20 | public String getSymbol() { 21 | return this.symbol; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/transport/SearchForecastTasksAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.forecast.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.action.search.SearchResponse; 16 | import org.opensearch.forecast.constant.ForecastCommonValue; 17 | 18 | public class SearchForecastTasksAction extends ActionType { 19 | // External Action which used for public facing RestAPIs. 20 | public static final String NAME = ForecastCommonValue.EXTERNAL_ACTION_PREFIX + "tasks/search"; 21 | public static final SearchForecastTasksAction INSTANCE = new SearchForecastTasksAction(); 22 | 23 | private SearchForecastTasksAction() { 24 | super(NAME, SearchResponse::new); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/transport/SearchForecasterAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.forecast.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.action.search.SearchResponse; 16 | import org.opensearch.forecast.constant.ForecastCommonValue; 17 | 18 | public class SearchForecasterAction extends ActionType { 19 | // External Action which used for public facing RestAPIs. 20 | public static final String NAME = ForecastCommonValue.EXTERNAL_ACTION_PREFIX + "forecasters/search"; 21 | public static final SearchForecasterAction INSTANCE = new SearchForecasterAction(); 22 | 23 | private SearchForecasterAction() { 24 | super(NAME, SearchResponse::new); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/transport/SearchForecasterInfoAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.forecast.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.forecast.constant.ForecastCommonValue; 16 | import org.opensearch.timeseries.transport.SearchConfigInfoResponse; 17 | 18 | public class SearchForecasterInfoAction extends ActionType { 19 | // External Action which used for public facing RestAPIs. 20 | public static final String NAME = ForecastCommonValue.EXTERNAL_ACTION_PREFIX + "forecaster/info"; 21 | public static final SearchForecasterInfoAction INSTANCE = new SearchForecasterInfoAction(); 22 | 23 | private SearchForecasterInfoAction() { 24 | super(NAME, SearchConfigInfoResponse::new); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/transport/SearchForecasterInfoTransportAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.forecast.transport; 13 | 14 | import org.opensearch.action.support.ActionFilters; 15 | import org.opensearch.common.inject.Inject; 16 | import org.opensearch.forecast.constant.ForecastCommonName; 17 | import org.opensearch.timeseries.transport.BaseSearchConfigInfoTransportAction; 18 | import org.opensearch.transport.TransportService; 19 | import org.opensearch.transport.client.Client; 20 | 21 | public class SearchForecasterInfoTransportAction extends BaseSearchConfigInfoTransportAction { 22 | 23 | @Inject 24 | public SearchForecasterInfoTransportAction(TransportService transportService, ActionFilters actionFilters, Client client) { 25 | super(transportService, actionFilters, client, SearchForecasterInfoAction.NAME, ForecastCommonName.CONFIG_INDEX); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/transport/SearchTopForecastResultAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.forecast.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.forecast.constant.ForecastCommonValue; 16 | 17 | public class SearchTopForecastResultAction extends ActionType { 18 | // External Action which used for public facing RestAPIs. 19 | public static final String NAME = ForecastCommonValue.EXTERNAL_ACTION_PREFIX + "result/topForecasts"; 20 | public static final SearchTopForecastResultAction INSTANCE = new SearchTopForecastResultAction(); 21 | 22 | private SearchTopForecastResultAction() { 23 | super(NAME, SearchTopForecastResultResponse::new); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/transport/StatsForecasterAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.forecast.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.forecast.constant.ForecastCommonValue; 16 | import org.opensearch.timeseries.transport.StatsTimeSeriesResponse; 17 | 18 | public class StatsForecasterAction extends ActionType { 19 | // External Action which used for public facing RestAPIs. 20 | public static final String NAME = ForecastCommonValue.EXTERNAL_ACTION_PREFIX + "forecaster/stats"; 21 | public static final StatsForecasterAction INSTANCE = new StatsForecasterAction(); 22 | 23 | private StatsForecasterAction() { 24 | super(NAME, StatsTimeSeriesResponse::new); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/transport/StopForecasterAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.forecast.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.forecast.constant.ForecastCommonValue; 16 | import org.opensearch.timeseries.transport.StopConfigResponse; 17 | 18 | public class StopForecasterAction extends ActionType { 19 | // Internal Action which is not used for public facing RestAPIs. 20 | public static final String NAME = ForecastCommonValue.INTERNAL_ACTION_PREFIX + "forecaster/stop"; 21 | public static final StopForecasterAction INSTANCE = new StopForecasterAction(); 22 | 23 | private StopForecasterAction() { 24 | super(NAME, StopConfigResponse::new); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/transport/SuggestForecasterParamAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.forecast.transport; 7 | 8 | import org.opensearch.action.ActionType; 9 | import org.opensearch.forecast.constant.ForecastCommonValue; 10 | import org.opensearch.timeseries.transport.SuggestConfigParamResponse; 11 | 12 | public class SuggestForecasterParamAction extends ActionType { 13 | public static final String NAME = ForecastCommonValue.EXTERNAL_ACTION_PREFIX + "forecaster/suggest"; 14 | public static final SuggestForecasterParamAction INSTANCE = new SuggestForecasterParamAction(); 15 | 16 | private SuggestForecasterParamAction() { 17 | super(NAME, SuggestConfigParamResponse::new); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/transport/ValidateForecasterAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.forecast.transport; 7 | 8 | import org.opensearch.action.ActionType; 9 | import org.opensearch.forecast.constant.ForecastCommonValue; 10 | import org.opensearch.timeseries.transport.ValidateConfigResponse; 11 | 12 | public class ValidateForecasterAction extends ActionType { 13 | public static final String NAME = ForecastCommonValue.EXTERNAL_ACTION_PREFIX + "forecaster/validate"; 14 | public static final ValidateForecasterAction INSTANCE = new ValidateForecasterAction(); 15 | 16 | private ValidateForecasterAction() { 17 | super(NAME, ValidateConfigResponse::new); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/forecast/transport/handler/ForecastSearchHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.forecast.transport.handler; 13 | 14 | import org.opensearch.cluster.service.ClusterService; 15 | import org.opensearch.common.settings.Settings; 16 | import org.opensearch.forecast.settings.ForecastSettings; 17 | import org.opensearch.timeseries.transport.handler.SearchHandler; 18 | import org.opensearch.transport.client.Client; 19 | 20 | /** 21 | * Handle general search request, check user role and return search response. 22 | */ 23 | public class ForecastSearchHandler extends SearchHandler { 24 | 25 | public ForecastSearchHandler(Settings settings, ClusterService clusterService, Client client) { 26 | super(settings, clusterService, client, ForecastSettings.FORECAST_FILTER_BY_BACKEND_ROLES); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/AnalysisModelSize.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries; 13 | 14 | import java.util.Map; 15 | 16 | public interface AnalysisModelSize { 17 | /** 18 | * Gets all of a detector's model sizes hosted on a node 19 | * 20 | * @param id Analysis Id 21 | * @return a map of model id to its memory size 22 | */ 23 | Map getModelSize(String id); 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/AnalysisType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.timeseries; 7 | 8 | public enum AnalysisType { 9 | AD, 10 | FORECAST; 11 | 12 | public boolean isForecast() { 13 | return this == FORECAST; 14 | } 15 | 16 | public boolean isAD() { 17 | return this == AD; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/CleanState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries; 13 | 14 | /** 15 | * Represent a state organized via detectorId. When deleting a detector's state, 16 | * we can remove it from the state. 17 | * 18 | * 19 | */ 20 | public interface CleanState { 21 | /** 22 | * Remove state associated with a detector Id 23 | * @param detectorId Detector Id 24 | */ 25 | void clear(String detectorId); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/ExceptionRecorder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries; 13 | 14 | import java.util.Optional; 15 | 16 | public interface ExceptionRecorder { 17 | public void setException(String id, Exception e); 18 | 19 | public Optional fetchExceptionAndClear(String id); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/ExpiringState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries; 13 | 14 | import java.time.Duration; 15 | import java.time.Instant; 16 | 17 | /** 18 | * Represent a state that can be expired with a duration if not accessed 19 | * 20 | */ 21 | public interface ExpiringState { 22 | default boolean expired(Instant lastAccessTime, Duration stateTtl, Instant now) { 23 | return lastAccessTime.plus(stateTtl).isBefore(now); 24 | } 25 | 26 | boolean expired(Duration stateTtl); 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/MaintenanceState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries; 13 | 14 | import java.time.Duration; 15 | import java.util.Map; 16 | 17 | /** 18 | * Represent a state that needs to maintain its metadata regularly 19 | * 20 | * 21 | */ 22 | public interface MaintenanceState { 23 | default void maintenance(Map stateToClean, Duration stateTtl) { 24 | stateToClean.entrySet().stream().forEach(entry -> { 25 | K configId = entry.getKey(); 26 | 27 | V state = entry.getValue(); 28 | if (state.expired(stateTtl)) { 29 | stateToClean.remove(configId); 30 | } 31 | 32 | }); 33 | } 34 | 35 | void maintenance(); 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/Name.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries; 13 | 14 | import java.util.Collection; 15 | import java.util.HashSet; 16 | import java.util.List; 17 | import java.util.Set; 18 | import java.util.function.Function; 19 | import java.util.stream.Collectors; 20 | 21 | /** 22 | * A super type for enum types returning names 23 | * 24 | */ 25 | public interface Name { 26 | String getName(); 27 | 28 | static Set getNameFromCollection(Collection names, Function getName) { 29 | Set res = new HashSet<>(); 30 | for (String name : names) { 31 | res.add(getName.apply(name)); 32 | } 33 | return res; 34 | } 35 | 36 | static Set getListStrs(List profileList) { 37 | return profileList.stream().map(profile -> profile.getName()).collect(Collectors.toSet()); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/ProfileTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.timeseries; 7 | 8 | import org.opensearch.core.action.ActionListener; 9 | import org.opensearch.timeseries.model.TimeSeriesTask; 10 | 11 | /** 12 | * Break the cross dependency between TaskManager and ProfileRunner. Instead of 13 | * depending on each other, they depend on the interface. 14 | * 15 | */ 16 | public interface ProfileTask> { 17 | void getTaskProfile(TaskClass configLevelTask, ActionListener listener); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/TaskProfileRunner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.timeseries; 7 | 8 | import org.opensearch.core.action.ActionListener; 9 | import org.opensearch.timeseries.model.TimeSeriesTask; 10 | 11 | /** 12 | * break the cross dependency between ProfileRunner and TaskManager. Instead, both of them depend on TaskProfileRunner. 13 | */ 14 | public interface TaskProfileRunner> { 15 | void getTaskProfile(TaskClass configLevelTask, ActionListener listener); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/annotation/Generated.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries.annotation; 13 | 14 | import java.lang.annotation.ElementType; 15 | import java.lang.annotation.Retention; 16 | import java.lang.annotation.RetentionPolicy; 17 | import java.lang.annotation.Target; 18 | 19 | /** 20 | * Jacoco will ignore the annotated code. 21 | * Similar to Lombok Generated annotation. Create this similar annotation as we don't involve Lombok. 22 | */ 23 | @Target({ ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.FIELD, ElementType.TYPE }) 24 | @Retention(RetentionPolicy.CLASS) 25 | public @interface Generated { 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/breaker/BreakerName.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries.breaker; 13 | 14 | public enum BreakerName { 15 | 16 | MEM("memory"), 17 | CPU("cpu"); 18 | 19 | private String name; 20 | 21 | BreakerName(String name) { 22 | this.name = name; 23 | } 24 | 25 | public String getName() { 26 | return name; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/breaker/CircuitBreaker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries.breaker; 13 | 14 | /** 15 | * An interface for circuit breaker. 16 | * 17 | * We use circuit breaker to protect a certain system resource like memory, cpu etc. 18 | */ 19 | public interface CircuitBreaker { 20 | 21 | boolean isOpen(); 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/breaker/MemoryCircuitBreaker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries.breaker; 13 | 14 | import org.opensearch.ad.settings.ADNumericSetting; 15 | import org.opensearch.monitor.jvm.JvmService; 16 | 17 | /** 18 | * A circuit breaker for memory usage. 19 | */ 20 | public class MemoryCircuitBreaker extends ThresholdCircuitBreaker { 21 | 22 | private final JvmService jvmService; 23 | 24 | public MemoryCircuitBreaker(JvmService jvmService) { 25 | super(ADNumericSetting.getJVMHeapUsageThreshold()); 26 | this.jvmService = jvmService; 27 | } 28 | 29 | public MemoryCircuitBreaker(int threshold, JvmService jvmService) { 30 | super(threshold); 31 | this.jvmService = jvmService; 32 | } 33 | 34 | @Override 35 | public boolean isOpen() { 36 | return jvmService.stats().getMem().getHeapUsedPercent() > this.getThreshold(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/breaker/ThresholdCircuitBreaker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries.breaker; 13 | 14 | /** 15 | * An abstract class for all breakers with threshold. 16 | * @param data type of threshold 17 | */ 18 | public abstract class ThresholdCircuitBreaker implements CircuitBreaker { 19 | 20 | private T threshold; 21 | 22 | public ThresholdCircuitBreaker(T threshold) { 23 | this.threshold = threshold; 24 | } 25 | 26 | public T getThreshold() { 27 | return threshold; 28 | } 29 | 30 | @Override 31 | public abstract boolean isOpen(); 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/caching/CacheProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.timeseries.caching; 7 | 8 | import org.opensearch.common.inject.Provider; 9 | 10 | import com.amazon.randomcutforest.parkservices.ThresholdedRandomCutForest; 11 | 12 | /** 13 | * A wrapper to call concrete implementation of caching. Used in transport 14 | * action. Don't use interface because transport action handler constructor 15 | * requires a concrete class as input. 16 | * 17 | */ 18 | public class CacheProvider> 19 | implements 20 | Provider { 21 | private CacheType cache; 22 | 23 | public CacheProvider() { 24 | 25 | } 26 | 27 | @Override 28 | public CacheType get() { 29 | return cache; 30 | } 31 | 32 | public void set(CacheType cache) { 33 | this.cache = cache; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/common/exception/ClientException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries.common.exception; 13 | 14 | /** 15 | * All exception visible to transport layer's client is under ClientException. 16 | */ 17 | public class ClientException extends TimeSeriesException { 18 | 19 | public ClientException(String message) { 20 | super(message); 21 | } 22 | 23 | public ClientException(String configId, String message) { 24 | super(configId, message); 25 | } 26 | 27 | public ClientException(String configId, String message, Throwable throwable) { 28 | super(configId, message, throwable); 29 | } 30 | 31 | public ClientException(String configId, Throwable cause) { 32 | super(configId, cause); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/common/exception/DuplicateTaskException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries.common.exception; 13 | 14 | public class DuplicateTaskException extends TimeSeriesException { 15 | 16 | public DuplicateTaskException(String msg) { 17 | super(msg); 18 | this.countedInStats(false); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/common/exception/InternalFailure.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries.common.exception; 13 | 14 | /** 15 | * Exception for root cause unknown failure. Maybe transient. Client can continue the detector running. 16 | * 17 | */ 18 | public class InternalFailure extends ClientException { 19 | 20 | public InternalFailure(String configId, String message) { 21 | super(configId, message); 22 | } 23 | 24 | public InternalFailure(String configId, String message, Throwable cause) { 25 | super(configId, message, cause); 26 | } 27 | 28 | public InternalFailure(String configId, Throwable cause) { 29 | super(configId, cause); 30 | } 31 | 32 | public InternalFailure(TimeSeriesException cause) { 33 | super(cause.getConfigId(), cause); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/common/exception/ResourceNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries.common.exception; 13 | 14 | /** 15 | * This exception is thrown when a resource is not found. 16 | */ 17 | public class ResourceNotFoundException extends TimeSeriesException { 18 | 19 | /** 20 | * Constructor with a config ID and a message. 21 | * 22 | * @param configId ID of the config related to the resource 23 | * @param message explains which resource is not found 24 | */ 25 | public ResourceNotFoundException(String configId, String message) { 26 | super(configId, message); 27 | countedInStats(false); 28 | } 29 | 30 | public ResourceNotFoundException(String message) { 31 | super(message); 32 | countedInStats(false); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/common/exception/TaskCancelledException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries.common.exception; 13 | 14 | public class TaskCancelledException extends TimeSeriesException { 15 | private String cancelledBy; 16 | 17 | public TaskCancelledException(String msg, String user) { 18 | super(msg); 19 | this.cancelledBy = user; 20 | this.countedInStats(false); 21 | } 22 | 23 | public String getCancelledBy() { 24 | return cancelledBy; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/common/exception/VersionException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries.common.exception; 13 | 14 | /** 15 | * AD version incompatible exception. 16 | */ 17 | public class VersionException extends TimeSeriesException { 18 | 19 | public VersionException(String message) { 20 | super(message); 21 | } 22 | 23 | public VersionException(String configId, String message) { 24 | super(configId, message); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/constant/CommonValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.timeseries.constant; 7 | 8 | public class CommonValue { 9 | // unknown or no schema version 10 | public static Integer NO_SCHEMA_VERSION = 0; 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/dataprocessor/ImputationMethod.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.timeseries.dataprocessor; 7 | 8 | public enum ImputationMethod { 9 | /** 10 | * This method replaces all missing values with 0's. It's a simple approach, but it may introduce bias if the data is not centered around zero. 11 | */ 12 | ZERO, 13 | /** 14 | * This method replaces missing values with a predefined set of values. The values are the same for each input dimension, and they need to be specified by the user. 15 | */ 16 | FIXED_VALUES, 17 | /** 18 | * This method replaces missing values with the last known value in the respective input dimension. It's a commonly used method for time series data, where temporal continuity is expected. 19 | */ 20 | PREVIOUS, 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/function/BiCheckedFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.timeseries.function; 7 | 8 | @FunctionalInterface 9 | public interface BiCheckedFunction { 10 | R apply(T t, F f) throws E; 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/function/ExecutorFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries.function; 13 | 14 | @FunctionalInterface 15 | public interface ExecutorFunction { 16 | 17 | /** 18 | * Performs this operation. 19 | * 20 | * Notes: don't forget to send back responses via channel if you process response with this method. 21 | */ 22 | void execute(); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/function/ResponseTransformer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.timeseries.function; 7 | 8 | /** 9 | * A functional interface for response transformation 10 | * 11 | * @param input type 12 | * @param output type 13 | */ 14 | @FunctionalInterface 15 | public interface ResponseTransformer { 16 | R transform(T input); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/function/ThrowingConsumer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries.function; 13 | 14 | /** 15 | * A consumer that can throw checked exception 16 | * 17 | * @param method parameter type 18 | * @param Exception type 19 | */ 20 | @FunctionalInterface 21 | public interface ThrowingConsumer { 22 | void accept(T t) throws E; 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/function/ThrowingSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries.function; 13 | 14 | /** 15 | * A supplier that can throw checked exception 16 | * 17 | * @param method parameter type 18 | * @param Exception type 19 | */ 20 | @FunctionalInterface 21 | public interface ThrowingSupplier { 22 | T get() throws E; 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/indices/TimeSeriesIndex.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries.indices; 13 | 14 | import org.opensearch.timeseries.constant.CommonName; 15 | 16 | public interface TimeSeriesIndex { 17 | String CUSTOM_RESULT_INDEX = "custom_result_index"; 18 | 19 | public String getIndexName(); 20 | 21 | public boolean isAlias(); 22 | 23 | public String getMapping(); 24 | 25 | public boolean isConfigIndex(); 26 | 27 | public default boolean isJobIndex() { 28 | return CommonName.JOB_INDEX.equals(getIndexName()); 29 | } 30 | 31 | public default boolean isCustomResultIndex() { 32 | return getIndexName() == CUSTOM_RESULT_INDEX; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/model/ConfigState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries.model; 13 | 14 | public enum ConfigState { 15 | DISABLED, 16 | INIT, 17 | RUNNING 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/model/EntityState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries.model; 13 | 14 | public enum EntityState { 15 | UNKNOWN, 16 | INIT, 17 | RUNNING 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/model/Mergeable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries.model; 13 | 14 | public interface Mergeable { 15 | void merge(Mergeable other); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/model/MergeableList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries.model; 13 | 14 | import java.util.List; 15 | 16 | public class MergeableList implements Mergeable { 17 | 18 | private final List elements; 19 | 20 | public List getElements() { 21 | return elements; 22 | } 23 | 24 | public MergeableList(List elements) { 25 | this.elements = elements; 26 | } 27 | 28 | @Override 29 | public void merge(Mergeable other) { 30 | if (this == other || other == null || getClass() != other.getClass()) { 31 | return; 32 | } 33 | MergeableList otherList = (MergeableList) other; 34 | if (otherList.getElements() != null) { 35 | this.elements.addAll(otherList.getElements()); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/model/ShingleGetter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.timeseries.model; 7 | 8 | public interface ShingleGetter { 9 | Integer getShingleSize(Integer customShingleSize); 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/model/TaskType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.timeseries.model; 7 | 8 | import java.util.List; 9 | import java.util.stream.Collectors; 10 | 11 | public interface TaskType { 12 | String name(); 13 | 14 | public static List taskTypeToString(List adTaskTypes) { 15 | return adTaskTypes.stream().map(type -> type.name()).collect(Collectors.toList()); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/ratelimit/CheckpointMaintainRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries.ratelimit; 13 | 14 | public class CheckpointMaintainRequest extends QueuedRequest { 15 | private String modelId; 16 | 17 | public CheckpointMaintainRequest(long expirationEpochMs, String configId, RequestPriority priority, String entityModelId) { 18 | super(expirationEpochMs, configId, priority); 19 | this.modelId = entityModelId; 20 | } 21 | 22 | public String getModelId() { 23 | return modelId; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/ratelimit/CheckpointWriteRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries.ratelimit; 13 | 14 | import org.opensearch.action.update.UpdateRequest; 15 | 16 | public class CheckpointWriteRequest extends QueuedRequest { 17 | private final UpdateRequest updateRequest; 18 | 19 | public CheckpointWriteRequest(long expirationEpochMs, String detectorId, RequestPriority priority, UpdateRequest updateRequest) { 20 | super(expirationEpochMs, detectorId, priority); 21 | this.updateRequest = updateRequest; 22 | } 23 | 24 | public UpdateRequest getUpdateRequest() { 25 | return updateRequest; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/ratelimit/RequestPriority.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries.ratelimit; 13 | 14 | public enum RequestPriority { 15 | LOW, 16 | MEDIUM, 17 | HIGH 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/ratelimit/SaveResultStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.timeseries.ratelimit; 7 | 8 | import java.time.Instant; 9 | import java.util.Optional; 10 | 11 | import org.opensearch.timeseries.ml.IntermediateResult; 12 | import org.opensearch.timeseries.model.Config; 13 | import org.opensearch.timeseries.model.Entity; 14 | import org.opensearch.timeseries.model.IndexableResult; 15 | 16 | public interface SaveResultStrategy> { 17 | void saveResult(RCFResultType result, Config config, FeatureRequest origRequest, String modelId); 18 | 19 | void saveResult( 20 | RCFResultType result, 21 | Config config, 22 | Instant dataStart, 23 | Instant dataEnd, 24 | String modelId, 25 | double[] currentData, 26 | Optional entity, 27 | String taskId 28 | ); 29 | 30 | void saveResult(IndexableResultType result, Config config); 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/rest/RestJobAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.timeseries.rest; 7 | 8 | import static org.opensearch.core.xcontent.XContentParserUtils.ensureExpectedToken; 9 | 10 | import java.io.IOException; 11 | import java.util.List; 12 | 13 | import org.opensearch.core.xcontent.XContentParser; 14 | import org.opensearch.rest.BaseRestHandler; 15 | import org.opensearch.rest.RestRequest; 16 | import org.opensearch.timeseries.model.DateRange; 17 | 18 | import com.google.common.collect.ImmutableList; 19 | 20 | public abstract class RestJobAction extends BaseRestHandler { 21 | protected DateRange parseInputDateRange(RestRequest request) throws IOException { 22 | if (!request.hasContent()) { 23 | return null; 24 | } 25 | XContentParser parser = request.contentParser(); 26 | ensureExpectedToken(XContentParser.Token.START_OBJECT, parser.nextToken(), parser); 27 | DateRange dateRange = DateRange.parse(parser); 28 | return dateRange; 29 | } 30 | 31 | @Override 32 | public List routes() { 33 | return ImmutableList.of(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/rest/handler/Processor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.timeseries.rest.handler; 7 | 8 | import org.opensearch.core.action.ActionListener; 9 | import org.opensearch.core.action.ActionResponse; 10 | 11 | /** 12 | * Represents a processor capable of initiating a certain process 13 | * and then notifying a listener upon completion. 14 | * 15 | * @param the type of response expected after processing, which must be a subtype of ActionResponse. 16 | */ 17 | public interface Processor { 18 | 19 | /** 20 | * Starts the processing action. Once the processing is completed, 21 | * the provided listener is notified with the outcome. 22 | * 23 | * @param listener the listener to be notified upon the completion of the processing action. 24 | */ 25 | public void start(ActionListener listener); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/stats/InternalStatNames.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries.stats; 13 | 14 | /** 15 | * Enum containing names of all internal stats which will not be returned 16 | * in AD stats REST API. 17 | */ 18 | public enum InternalStatNames { 19 | JVM_HEAP_USAGE("jvm_heap_usage"), 20 | AD_USED_BATCH_TASK_SLOT_COUNT("ad_used_batch_task_slot_count"), 21 | AD_DETECTOR_ASSIGNED_BATCH_TASK_SLOT_COUNT("ad_detector_assigned_batch_task_slot_count"); 22 | 23 | private String name; 24 | 25 | InternalStatNames(String name) { 26 | this.name = name; 27 | } 28 | 29 | /** 30 | * Get internal stat name 31 | * 32 | * @return name 33 | */ 34 | public String getName() { 35 | return name; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/stats/StatType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries.stats; 13 | 14 | public enum StatType { 15 | AD, 16 | FORECAST, 17 | TIMESERIES 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/stats/suppliers/CounterSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries.stats.suppliers; 13 | 14 | import java.util.concurrent.atomic.LongAdder; 15 | import java.util.function.Supplier; 16 | 17 | /** 18 | * CounterSupplier provides a stateful count as the value 19 | */ 20 | public class CounterSupplier implements Supplier { 21 | private LongAdder counter; 22 | 23 | /** 24 | * Constructor 25 | */ 26 | public CounterSupplier() { 27 | this.counter = new LongAdder(); 28 | } 29 | 30 | @Override 31 | public Long get() { 32 | return counter.longValue(); 33 | } 34 | 35 | /** 36 | * Increments the value of the counter by 1 37 | */ 38 | public void increment() { 39 | counter.increment(); 40 | } 41 | 42 | /** 43 | * Decrease the value of the counter by 1 44 | */ 45 | public void decrement() { 46 | counter.decrement(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/stats/suppliers/SettableSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries.stats.suppliers; 13 | 14 | import java.util.concurrent.atomic.AtomicLong; 15 | import java.util.function.Supplier; 16 | 17 | /** 18 | * SettableSupplier allows a user to set the value of the supplier to be returned 19 | */ 20 | public class SettableSupplier implements Supplier { 21 | protected AtomicLong value; 22 | 23 | /** 24 | * Constructor 25 | */ 26 | public SettableSupplier() { 27 | this.value = new AtomicLong(0L); 28 | } 29 | 30 | @Override 31 | public Long get() { 32 | return value.get(); 33 | } 34 | 35 | /** 36 | * Set value to be returned by get 37 | * 38 | * @param value to set 39 | */ 40 | public void set(Long value) { 41 | this.value.set(value); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/transport/CronAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.ad.constant.ADCommonValue; 16 | 17 | public class CronAction extends ActionType { 18 | // Internal Action which is not used for public facing RestAPIs. 19 | public static final String NAME = ADCommonValue.INTERNAL_ACTION_PREFIX + "cron"; 20 | public static final CronAction INSTANCE = new CronAction(); 21 | 22 | private CronAction() { 23 | super(NAME, CronResponse::new); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/transport/CronNodeRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries.transport; 13 | 14 | import java.io.IOException; 15 | 16 | import org.opensearch.core.common.io.stream.StreamInput; 17 | import org.opensearch.transport.TransportRequest; 18 | 19 | /** 20 | * Delete model represents the request to an individual node 21 | */ 22 | public class CronNodeRequest extends TransportRequest { 23 | 24 | public CronNodeRequest() {} 25 | 26 | public CronNodeRequest(StreamInput in) throws IOException { 27 | super(in); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/transport/CronRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries.transport; 13 | 14 | import java.io.IOException; 15 | 16 | import org.opensearch.action.support.nodes.BaseNodesRequest; 17 | import org.opensearch.cluster.node.DiscoveryNode; 18 | import org.opensearch.core.common.io.stream.StreamInput; 19 | 20 | /** 21 | * Request should be sent from the handler logic of transport delete detector API 22 | * 23 | */ 24 | public class CronRequest extends BaseNodesRequest { 25 | 26 | public CronRequest() { 27 | super((String[]) null); 28 | } 29 | 30 | public CronRequest(StreamInput in) throws IOException { 31 | super(in); 32 | } 33 | 34 | public CronRequest(DiscoveryNode... nodes) { 35 | super(nodes); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/util/DateUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.timeseries.util; 13 | 14 | import java.time.Duration; 15 | import java.time.Instant; 16 | import java.time.ZoneId; 17 | import java.time.ZonedDateTime; 18 | import java.time.temporal.ChronoField; 19 | 20 | import org.opensearch.common.unit.TimeValue; 21 | 22 | public class DateUtils { 23 | public static final ZoneId UTC = ZoneId.of("Z"); 24 | 25 | /** 26 | * Get hour of day of the input time in UTC 27 | * @param instant input time 28 | * 29 | * @return Hour of day 30 | */ 31 | public static int getUTCHourOfDay(Instant instant) { 32 | ZonedDateTime time = ZonedDateTime.ofInstant(instant, UTC); 33 | return time.get(ChronoField.HOUR_OF_DAY); 34 | } 35 | 36 | public static Duration toDuration(TimeValue timeValue) { 37 | return Duration.ofMillis(timeValue.millis()); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/util/ExpiringValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.timeseries.util; 7 | 8 | import java.time.Clock; 9 | 10 | public class ExpiringValue { 11 | private V value; 12 | private long lastAccessTime; 13 | private long expirationTimeInMillis; 14 | private Clock clock; 15 | 16 | public ExpiringValue(V value, long expirationTimeInMillis, Clock clock) { 17 | this.value = value; 18 | this.expirationTimeInMillis = expirationTimeInMillis; 19 | this.clock = clock; 20 | updateLastAccessTime(); 21 | } 22 | 23 | public V getValue() { 24 | updateLastAccessTime(); 25 | return value; 26 | } 27 | 28 | public boolean isExpired() { 29 | return isExpired(clock.millis()); 30 | } 31 | 32 | public boolean isExpired(long currentTimeMillis) { 33 | return (currentTimeMillis - lastAccessTime) >= expirationTimeInMillis; 34 | } 35 | 36 | public void updateLastAccessTime() { 37 | lastAccessTime = clock.millis(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/org/opensearch/timeseries/util/TimeUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.timeseries.util; 7 | 8 | import org.opensearch.timeseries.model.Config; 9 | import org.opensearch.timeseries.model.IntervalTimeConfiguration; 10 | 11 | public class TimeUtil { 12 | public static long calculateTimeoutMillis(Config config, long dataEndTimeMillis) { 13 | long windowDelayMillis = config.getWindowDelay() == null 14 | ? 0 15 | : ((IntervalTimeConfiguration) config.getWindowDelay()).toDuration().toMillis(); 16 | long nextExecutionEnd = dataEndTimeMillis + config.getIntervalInMilliseconds() + windowDelayMillis; 17 | return nextExecutionEnd; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/plugin-metadata/plugin-security.policy: -------------------------------------------------------------------------------- 1 | grant { 2 | // required by Jackson/Gson to (se)deserializing checkpoints 3 | permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; 4 | permission java.lang.RuntimePermission "accessDeclaredMembers"; 5 | permission java.lang.RuntimePermission "accessClassInPackage.sun.misc"; 6 | permission java.net.SocketPermission "*", "connect,resolve"; 7 | // required for GenericObjectPool in CheckpointDao 8 | permission javax.management.MBeanServerPermission "createMBeanServer"; 9 | permission javax.management.MBeanPermission "org.apache.commons.pool2.impl.GenericObjectPool#-[org.apache.commons.pool2:name=pool,type=GenericObjectPool]", "registerMBean"; 10 | permission javax.management.MBeanPermission "org.apache.commons.pool2.impl.GenericObjectPool#-[org.apache.commons.pool2:name=pool,type=GenericObjectPool]", "unregisterMBean"; 11 | permission javax.management.MBeanTrustPermission "register"; 12 | permission java.lang.RuntimePermission "getClassLoader"; 13 | permission java.lang.RuntimePermission "setContextClassLoader"; 14 | }; -------------------------------------------------------------------------------- /src/main/resources/META-INF/gradle-plugins/io.pry.gradle.offline_dependencies.properties: -------------------------------------------------------------------------------- 1 | implementation-class=io.pry.gradle.offline_dependencies.OfflineDependenciesPlugin -------------------------------------------------------------------------------- /src/main/resources/META-INF/services/org.opensearch.jobscheduler.spi.JobSchedulerExtension: -------------------------------------------------------------------------------- 1 | org.opensearch.timeseries.TimeSeriesAnalyticsPlugin 2 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/services/org.opensearch.security.spi.resources.ResourceSharingExtension: -------------------------------------------------------------------------------- 1 | org.opensearch.timeseries.TimeSeriesResourceSharingExtension 2 | -------------------------------------------------------------------------------- /src/main/resources/es-plugin.properties: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | # The OpenSearch Contributors require contributions made to 5 | # this file be licensed under the Apache-2.0 license or a 6 | # compatible open source license. 7 | # 8 | # Modifications Copyright OpenSearch Contributors. See 9 | # GitHub history for details. 10 | # 11 | 12 | plugin=org.opensearch.timeseries.TimeSeriesAnalyticsPlugin 13 | version=${project.version} -------------------------------------------------------------------------------- /src/main/resources/plugin-descriptor.properties: -------------------------------------------------------------------------------- 1 | # 2 | # SPDX-License-Identifier: Apache-2.0 3 | # 4 | # The OpenSearch Contributors require contributions made to 5 | # this file be licensed under the Apache-2.0 license or a 6 | # compatible open source license. 7 | # 8 | # Modifications Copyright OpenSearch Contributors. See 9 | # GitHub history for details. 10 | # 11 | 12 | description=${project.description} 13 | 14 | version=${project.version} 15 | 16 | name=${opensearch.plugin.name} 17 | 18 | classname=${opensearch.plugin.classname} 19 | 20 | java.version=1.8 21 | 22 | opensearch.version=${opensearch.version} -------------------------------------------------------------------------------- /src/test/java/org/opensearch/ad/cluster/ADVersionUtilTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.cluster; 13 | 14 | import org.opensearch.Version; 15 | import org.opensearch.ad.ADUnitTestCase; 16 | import org.opensearch.timeseries.cluster.VersionUtil; 17 | 18 | public class ADVersionUtilTests extends ADUnitTestCase { 19 | 20 | public void testParseVersionFromString() { 21 | Version version = VersionUtil.fromString("2.1.0.0"); 22 | assertEquals(Version.V_2_1_0, version); 23 | 24 | version = VersionUtil.fromString("2.1.0"); 25 | assertEquals(Version.V_2_1_0, version); 26 | } 27 | 28 | public void testParseVersionFromStringWithNull() { 29 | expectThrows(IllegalArgumentException.class, () -> VersionUtil.fromString(null)); 30 | } 31 | 32 | public void testParseVersionFromStringWithWrongFormat() { 33 | expectThrows(IllegalArgumentException.class, () -> VersionUtil.fromString("1.1")); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/ad/common/exception/ADTaskCancelledExceptionTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.common.exception; 13 | 14 | import org.opensearch.test.OpenSearchTestCase; 15 | import org.opensearch.timeseries.common.exception.TaskCancelledException; 16 | 17 | public class ADTaskCancelledExceptionTests extends OpenSearchTestCase { 18 | 19 | public void testConstructor() { 20 | String message = randomAlphaOfLength(5); 21 | String user = randomAlphaOfLength(5); 22 | TaskCancelledException exception = new TaskCancelledException(message, user); 23 | assertEquals(message, exception.getMessage()); 24 | assertEquals(user, exception.getCancelledBy()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/ad/common/exception/JsonPathNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.common.exception; 13 | 14 | public class JsonPathNotFoundException extends Exception { 15 | 16 | public JsonPathNotFoundException() { 17 | super("Invalid Json path"); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/ad/common/exception/LimitExceededExceptionTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.common.exception; 13 | 14 | import static org.junit.Assert.assertEquals; 15 | 16 | import org.junit.Test; 17 | import org.opensearch.timeseries.common.exception.LimitExceededException; 18 | 19 | public class LimitExceededExceptionTests { 20 | 21 | @Test 22 | public void testConstructorWithIdAndExplanation() { 23 | String id = "test id"; 24 | String message = "test message"; 25 | LimitExceededException limitExceeded = new LimitExceededException(id, message); 26 | assertEquals(id, limitExceeded.getConfigId()); 27 | assertEquals(message, limitExceeded.getMessage()); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/ad/ml/SingleStreamModelIdMapperTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.ml; 13 | 14 | import org.opensearch.test.OpenSearchTestCase; 15 | import org.opensearch.timeseries.ml.SingleStreamModelIdMapper; 16 | 17 | public class SingleStreamModelIdMapperTests extends OpenSearchTestCase { 18 | public void testGetThresholdModelIdFromRCFModelId() { 19 | assertEquals( 20 | "Y62IGnwBFHAk-4HQQeoo_model_threshold", 21 | SingleStreamModelIdMapper.getThresholdModelIdFromRCFModelId("Y62IGnwBFHAk-4HQQeoo_model_rcf_1") 22 | ); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/ad/mock/transport/MockADTaskAction_1_0.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.mock.transport; 13 | 14 | public enum MockADTaskAction_1_0 { 15 | START, 16 | STOP 17 | } 18 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/ad/mock/transport/MockAnomalyDetectorJobAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.mock.transport; 13 | 14 | import org.opensearch.action.ActionType; 15 | import org.opensearch.ad.constant.ADCommonValue; 16 | import org.opensearch.timeseries.transport.JobResponse; 17 | 18 | public class MockAnomalyDetectorJobAction extends ActionType { 19 | // External Action which used for public facing RestAPIs. 20 | public static final String NAME = ADCommonValue.EXTERNAL_ACTION_PREFIX + "detector/mockjobmanagement"; 21 | public static final MockAnomalyDetectorJobAction INSTANCE = new MockAnomalyDetectorJobAction(); 22 | 23 | private MockAnomalyDetectorJobAction() { 24 | super(NAME, JobResponse::new); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/ad/stats/suppliers/CounterSupplierTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.stats.suppliers; 13 | 14 | import org.junit.Test; 15 | import org.opensearch.test.OpenSearchTestCase; 16 | import org.opensearch.timeseries.stats.suppliers.CounterSupplier; 17 | 18 | public class CounterSupplierTests extends OpenSearchTestCase { 19 | @Test 20 | public void testGetAndIncrement() { 21 | CounterSupplier counterSupplier = new CounterSupplier(); 22 | assertEquals("get returns incorrect value", (Long) 0L, counterSupplier.get()); 23 | counterSupplier.increment(); 24 | assertEquals("get returns incorrect value", (Long) 1L, counterSupplier.get()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/ad/stats/suppliers/SettableSupplierTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.stats.suppliers; 13 | 14 | import org.junit.Test; 15 | import org.opensearch.test.OpenSearchTestCase; 16 | import org.opensearch.timeseries.stats.suppliers.SettableSupplier; 17 | 18 | public class SettableSupplierTests extends OpenSearchTestCase { 19 | @Test 20 | public void testSetGet() { 21 | Long setCount = 15L; 22 | SettableSupplier settableSupplier = new SettableSupplier(); 23 | settableSupplier.set(setCount); 24 | assertEquals("Get/Set fails", setCount, settableSupplier.get()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/ad/transport/ValidateAnomalyDetectorActionTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.transport; 13 | 14 | import org.junit.Assert; 15 | import org.junit.Test; 16 | 17 | public class ValidateAnomalyDetectorActionTests { 18 | @Test 19 | public void testValidateAnomalyDetectorActionTests() { 20 | Assert.assertNotNull(ValidateAnomalyDetectorAction.INSTANCE.name()); 21 | Assert.assertEquals(ValidateAnomalyDetectorAction.INSTANCE.name(), ValidateAnomalyDetectorAction.NAME); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/ad/util/ArrayEqMatcher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.util; 13 | 14 | import java.util.Arrays; 15 | 16 | import org.mockito.ArgumentMatcher; 17 | 18 | /** 19 | * An argument matcher based on deep equality needed for array types. 20 | * 21 | * The default eq or aryEq from Mockito fails on nested array types, such as a matrix. 22 | * This matcher takes the expected argument and returns a match result based on deep equality. 23 | */ 24 | public class ArrayEqMatcher implements ArgumentMatcher { 25 | 26 | private final T expected; 27 | 28 | /** 29 | * Constructor with expected value. 30 | * 31 | * @param expected the value expected to match by equality 32 | */ 33 | public ArrayEqMatcher(T expected) { 34 | this.expected = expected; 35 | } 36 | 37 | @Override 38 | public boolean matches(T actual) { 39 | return Arrays.deepEquals((Object[]) expected, (Object[]) actual); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/ad/util/DateUtilsTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.util; 13 | 14 | import java.time.Duration; 15 | 16 | import org.opensearch.common.unit.TimeValue; 17 | import org.opensearch.test.OpenSearchTestCase; 18 | import org.opensearch.timeseries.util.DateUtils; 19 | 20 | public class DateUtilsTests extends OpenSearchTestCase { 21 | public void testDuration() { 22 | TimeValue time = TimeValue.timeValueHours(3); 23 | assertEquals(Duration.ofHours(3), DateUtils.toDuration(time)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/ad/util/ThrowingSupplierWrapperTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package org.opensearch.ad.util; 13 | 14 | import java.io.IOException; 15 | 16 | import org.opensearch.test.OpenSearchTestCase; 17 | import org.opensearch.timeseries.function.ThrowingSupplierWrapper; 18 | 19 | public class ThrowingSupplierWrapperTests extends OpenSearchTestCase { 20 | private static String foo() throws IOException { 21 | throw new IOException("blah"); 22 | } 23 | 24 | public void testExceptionThrown() { 25 | expectThrows( 26 | RuntimeException.class, 27 | () -> ThrowingSupplierWrapper.throwingSupplierWrapper(ThrowingSupplierWrapperTests::foo).get() 28 | ); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/forecast/ForecasterTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.forecast; 7 | 8 | import java.io.IOException; 9 | import java.util.Arrays; 10 | 11 | import org.opensearch.test.OpenSearchTestCase; 12 | import org.opensearch.timeseries.TestHelpers; 13 | import org.opensearch.timeseries.common.exception.ValidationException; 14 | 15 | import com.google.common.collect.ImmutableList; 16 | 17 | public class ForecasterTests extends OpenSearchTestCase { 18 | 19 | public void testInvalidSeasonality() throws IOException { 20 | assertThrows( 21 | ValidationException.class, 22 | () -> TestHelpers.ForecasterBuilder 23 | .newInstance() 24 | .setConfigId("123") 25 | .setTimeField("timestamp") 26 | .setIndices(ImmutableList.of("test-index")) 27 | .setFeatureAttributes(Arrays.asList()) 28 | .setCategoryFields(Arrays.asList("a")) 29 | .setNullImputationOption() 30 | // should trigger ValidationException, as we need at least 8 in forecasting 31 | .setSeasonality(7) 32 | .build() 33 | ); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/forecast/settings/ForecastEnabledSettingTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.forecast.settings; 7 | 8 | import org.opensearch.test.OpenSearchTestCase; 9 | 10 | public class ForecastEnabledSettingTests extends OpenSearchTestCase { 11 | 12 | public void testIsForecastEnabled() { 13 | boolean original = ForecastEnabledSetting.isForecastEnabled(); 14 | try { 15 | ForecastEnabledSetting.getInstance().setSettingValue(ForecastEnabledSetting.FORECAST_ENABLED, true); 16 | // TODO: currently, we disable forecasting 17 | assertTrue(ForecastEnabledSetting.isForecastEnabled()); 18 | // assertTrue(!ForecastEnabledSetting.isForecastEnabled()); 19 | ForecastEnabledSetting.getInstance().setSettingValue(ForecastEnabledSetting.FORECAST_ENABLED, false); 20 | assertTrue(!ForecastEnabledSetting.isForecastEnabled()); 21 | } finally { 22 | ForecastEnabledSetting.getInstance().setSettingValue(ForecastEnabledSetting.FORECAST_ENABLED, original); 23 | } 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/test/java/org/opensearch/timeseries/settings/TimeSeriesEnabledSettingTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright OpenSearch Contributors 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | package org.opensearch.timeseries.settings; 7 | 8 | import org.opensearch.test.OpenSearchTestCase; 9 | 10 | public class TimeSeriesEnabledSettingTests extends OpenSearchTestCase { 11 | public void testIsForecastBreakerEnabled() { 12 | assertTrue(TimeSeriesEnabledSetting.isBreakerEnabled()); 13 | TimeSeriesEnabledSetting.getInstance().setSettingValue(TimeSeriesEnabledSetting.BREAKER_ENABLED, false); 14 | assertTrue(!TimeSeriesEnabledSetting.isBreakerEnabled()); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/test/java/test/org/opensearch/ad/util/MultiDimDataWithTime.java: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: Apache-2.0 3 | * 4 | * The OpenSearch Contributors require contributions made to 5 | * this file be licensed under the Apache-2.0 license or a 6 | * compatible open source license. 7 | * 8 | * Modifications Copyright OpenSearch Contributors. See 9 | * GitHub history for details. 10 | */ 11 | 12 | package test.org.opensearch.ad.util; 13 | 14 | public class MultiDimDataWithTime { 15 | public double[][] data; 16 | public long[] changeTimeStampsMs; 17 | public double[][] changes; 18 | public long[] timestampsMs; 19 | 20 | public MultiDimDataWithTime(double[][] data, long[] changeTimestamps, double[][] changes, long[] timestampsMs) { 21 | this.data = data; 22 | this.changeTimeStampsMs = changeTimestamps; 23 | this.changes = changes; 24 | this.timestampsMs = timestampsMs; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/resources/org/opensearch/ad/e2e/data/rule.label: -------------------------------------------------------------------------------- 1 | { 2 | "Phoenix": [ 3 | [ 4 | "2024-05-24T19:30:00Z", 5 | "2024-05-24T23:30:00Z" 6 | ], 7 | [ 8 | "2024-06-14T18:15:00Z", 9 | "2024-06-14T20:15:00Z" 10 | ], 11 | [ 12 | "2024-06-20T16:30:00Z", 13 | "2024-06-20T17:30:00Z" 14 | ], 15 | [ 16 | "2024-07-02T16:30:00Z", 17 | "2024-07-02T19:30:00Z" 18 | ] 19 | ], 20 | "Scottsdale": [ 21 | [ 22 | "2024-06-04T02:00:00Z", 23 | "2024-06-04T03:10:00Z" 24 | ], 25 | [ 26 | "2024-06-14T17:30:00Z", 27 | "2024-06-14T17:50:00Z" 28 | ], 29 | [ 30 | "2024-06-20T16:50:00Z", 31 | "2024-06-20T19:30:00Z" 32 | ] 33 | ] 34 | } -------------------------------------------------------------------------------- /src/test/resources/org/opensearch/ad/e2e/data/synthetic.label: -------------------------------------------------------------------------------- 1 | [ 2 | [ 3 | "2019-11-03T20:00:00Z", 4 | "2019-11-03T22:08:00Z" 5 | ], 6 | [ 7 | "2019-11-04T23:00:00Z", 8 | "2019-11-05T01:08:00Z" 9 | ], 10 | [ 11 | "2019-11-06T08:00:00Z", 12 | "2019-11-06T15:00:00Z" 13 | ], 14 | [ 15 | "2019-11-07T04:00:00Z", 16 | "2019-11-07T16:00:00Z" 17 | ] 18 | ] 19 | -------------------------------------------------------------------------------- /src/test/resources/security/test-kirk.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opensearch-project/anomaly-detection/70eb22d02d5d0a68313e68137ffdbf7c030b2a53/src/test/resources/security/test-kirk.jks --------------------------------------------------------------------------------