-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Extensions] Migrates AnomalyResultAction, EntityResultAction, RCFResultAction #856
[Extensions] Migrates AnomalyResultAction, EntityResultAction, RCFResultAction #856
Conversation
…omponents for ADResultAction, EntityResultAction, RCFResultAction. Uncomments JS dependent code Signed-off-by: Joshua Palis <[email protected]>
Signed-off-by: Joshua Palis <[email protected]>
Signed-off-by: Joshua Palis <[email protected]>
Signed-off-by: Joshua Palis <[email protected]>
Signed-off-by: Joshua Palis <[email protected]>
Signed-off-by: Joshua Palis <[email protected]>
Signed-off-by: Joshua Palis <[email protected]>
Signed-off-by: Joshua Palis <[email protected]>
… for HCAD. Preparational work for HCAD results, invokes EntityResultAction in pagelistener Signed-off-by: Joshua Palis <[email protected]>
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## feature/extensions #856 +/- ##
========================================================
- Coverage 35.93% 35.28% -0.65%
+ Complexity 1926 1897 -29
========================================================
Files 299 299
Lines 17678 17788 +110
Branches 1861 1864 +3
========================================================
- Hits 6352 6276 -76
- Misses 10870 11061 +191
+ Partials 456 451 -5
Flags with carried forward coverage won't be shown. Click here to find out more.
|
private static final Logger LOG = LogManager.getLogger(ProfileTransportAction.class); | ||
private ModelManager modelManager; | ||
private FeatureManager featureManager; | ||
private CacheProvider cacheProvider; | ||
private SDKClusterService clusterService; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clusterService to sdkClusterService.
client to sdkRestClient.
Please ensure the naming convention on variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good. With few comments
src/main/java/org/opensearch/ad/transport/AnomalyResultTransportAction.java
Show resolved
Hide resolved
src/main/java/org/opensearch/ad/transport/AnomalyResultTransportAction.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/ad/transport/RCFResultTransportAction.java
Outdated
Show resolved
Hide resolved
src/test/java/org/opensearch/ad/transport/ADResultBulkTransportActionTests.java
Show resolved
Hide resolved
@@ -8,127 +8,9 @@ | |||
* Modifications Copyright OpenSearch Contributors. See | |||
* GitHub history for details. | |||
*/ | |||
|
|||
/* @anomaly.detection Commented until we have extension support for hashring : https://github.com/opensearch-project/opensearch-sdk-java/issues/200 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have commented this out for the hashring since it set up test nodes and registers handlers for these nodes. The hashring is then used to stub calls to return the test nodes. Since we're temporarily rerouting all requests back to the extension node, most of these test classes dont even apply.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not blocking this PR for the above but we should think about the tests related to HashRing. We can modify the tests for extensionNode.
… found message rather than catching OpenSearchStatusException Signed-off-by: Joshua Palis <[email protected]>
Signed-off-by: Joshua Palis <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! If @dbwiddis can also take a look!
'org.opensearch.ad.transport.ADResultBulkTransportAction', | ||
'org.opensearch.ad.transport.ADResultBulkRequest', | ||
'org.opensearch.ad.transport.ADResultBulkAction', | ||
'org.opensearch.ad.ratelimit.ResultWriteRequest', | ||
'org.opensearch.ad.AnomalyDetectorJobRunner.1', | ||
'org.opensearch.ad.AnomalyDetectorJobRunner.2', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious why these classes are not having test coverage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test classes regarding ADResultBulkTransportAction/ResultWriteWorker have been commented out for this PR temporarily, I will handle them in this PR to enable HCAD real time analysis, as the ADResultBulkTransportAction is used to index multi entity Anomaly Results. This current PR includes some preparational work for the HCAD workflow
Description
Part of opensearch-project/opensearch-sdk-java#383
This PR registers the actions that execute an anomaly detector and facilitate the indexing of anomaly results. Currently, the job configuration, scheduling, execution and result indexing for
SINGLE ENTITY
detectors forREAL-TIME
analysis is complete.Some example logs of the single entity real time analysis job execution.
Preparational work for
MUTLI ENTITY
detectors forREAL-TIME
analysis has been done. This PR enables creating a multi-entity detector, scheduling and executing a job. The remaining item is to generate and index the anomaly results for HCAD (the blockers for multi-entity real time analysis is noted in the issue). At this state, when a multi-entity detector job is run, the job execution will end while attempting to index an anomaly result and begin again in the next iteration.Note, the hashring has been removed from the
RCFResultTransportAction
and theAnomalyResultTransportAction
. All requests to run the detector will be executed by the AD extension node.Overview of the job execution process for single entity real time analysis
ADJobRunner
receivesrunJob
() request fromJob Scheduler
, sends a request to acquire a lock and then first job execution begins and triggers theAnomalyResultAction
@timestamp
value falls between the detection window)RCFResultAction
is triggered via the client for extension nodemodelManager
is used to retrieveTRcfResult
for the model ID associated with the detectorcheckpointDao
is used to retrieveTRCFModel
(This returns nothing as checkpoint index is not initialized and there is no model that has been trained)ResourceNotFoundException
since the checkpoint is not initialized and the model is not presentrcfActionListener.onFailure()
which handles the prediction failure, and then invokescoldStartIfNoModel
ResourceNotFoundException
thrown by the model managerrcfActionListener
triggersAnomalyResultTransportAction listener.onFailure()
to return no model exception (model not ready)ADJobRunner
, which then indexes exception toAnomalyResultIndex
(creates it if not present)ThreshHoldedRandomCutForest
result and returned as anRCFResultResponse
AnomalyResult
Index and the next job execution is scheduledHow to run data generation script
"1s"
AnomalyDetectionExtension
and OpenSearch with Job Scheduler installed (enable feature flag)python3 generate-cosine-data-multi-entity.py -ep localhost -i server_log --shards 5 -t 10 --no-security -nh 5 -np 5 --ingestion-frequency 10 --points 30000
(will take about 30 seconds)Detector Configurations Used to test real time analysis
Once the data in ingested, then we can create a detector for the created index
server_log
with the following configurations. The data generation script provides test data with two feature fields (cpuTime
andjvmGcTime
), and two category fields (host
andprocess
) that can be used for HCAD. Once the detector is created, we can start the detectorSingle-Entity Detector :
Multi-Entity Detector
Issues Resolved
opensearch-project/opensearch-sdk-java#626
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.