Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[Extensions] Fixing BaseException imports and fixing Cluster Index Health request #929

Merged
merged 1 commit into from
Jun 20, 2023

Conversation

joshpalis
Copy link
Member

@joshpalis joshpalis commented Jun 19, 2023

Description

Fixes imports due to changes upstream : opensearch-project/OpenSearch#8035

Resolves AD stats API issue with null indices from Cluster health request by setting the cluster health request level to indices

Logs from testing stats API after creating a detector

dev-dsk-jpalis-2c-27c8aa11 % curl -XPOST "localhost:9200/_extensions/_ad-extension/detectors?pretty" -H "Content-Type:application/json" --data '{"name":"test-detector","description":"Test detector","time_field":"@timestamp","indices":["server_log"],"feature_attributes":[{"feature_name":"test","feature_enabled":true,"aggregation_query":{"test":{"avg":{"field":"jvmGcTime"}}}}],"detection_interval":{"period":{"interval":1,"unit":"Minutes"}},"window_delay":{"period":{"interval":1,"unit":"Minutes"}}}'
{
  "_id": "MS3P1YgBNCgmfjRHOqMe",
  "_version": 1,
  "_seq_no": 0,
  "anomaly_detector": {
    "name": "test-detector",
    "description": "Test detector",
    "time_field": "@timestamp",
    "indices": [
      "server_log"
    ],
    "filter_query": {
      "match_all": {
        "boost": 1
      }
    },
    "detection_interval": {
      "period": {
        "interval": 1,
        "unit": "Minutes"
      }
    },
    "window_delay": {
      "period": {
        "interval": 1,
        "unit": "Minutes"
      }
    },
    "shingle_size": 8,
    "schema_version": 0,
    "feature_attributes": [
      {
        "feature_id": "LAHP1YgBci4k6u0KNtDc",
        "feature_name": "test",
        "feature_enabled": true,
        "aggregation_query": {
          "test": {
            "avg": {
              "field": "jvmGcTime"
            }
          }
        }
      }
    ],
    "last_update_time": 1687214307861,
    "detector_type": "SINGLE_ENTITY"
  },
  "_primary_term": 1
}%                              

(23-06-19 22:38:27) <0> [~/repos/delete/anomaly-detection/dataGeneration]  
dev-dsk-jpalis-2c-27c8aa11 % curl -X GET "localhost:9200/_extensions/_ad-extension/stats/"
{
  "anomaly_detectors_index_status": "yellow",
  "anomaly_detection_state_status": "non-existent",
  "single_entity_detector_count": 1,
  "detector_count": 1,
  "multi_entity_detector_count": 0,
  "anomaly_detection_job_index_status": "non-existent",
  "models_checkpoint_index_status": "non-existent",
  "anomaly_results_index_status": "non-existent",
  "nodes": {
    "ad-extension": {
      "ad_execute_request_count": 0,
      "models": [],
      "ad_canceled_batch_task_count": 0,
      "ad_hc_execute_request_count": 0,
      "ad_hc_execute_failure_count": 0,
      "model_count": 0,
      "ad_execute_failure_count": 0,
      "ad_batch_task_failure_count": 0,
      "ad_total_batch_task_execution_count": 0,
      "ad_executing_batch_task_count": 0
    }
  }
}%        

Issues Resolved

opensearch-project/opensearch-sdk-java#674

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.

@joshpalis
Copy link
Member Author

All tests have passed locally, haven't been able to reproduce the failing tests

@cwperks
Copy link
Member

cwperks commented Jun 20, 2023

@joshpalis main needs to incorporate the changes from this PR as well: #928

Signed-off-by: Joshua Palis <[email protected]>
@codecov
Copy link

codecov bot commented Jun 20, 2023

Codecov Report

Merging #929 (8c6496c) into feature/extensions (54a6b1c) will decrease coverage by 0.02%.
The diff coverage is 90.90%.

Impacted file tree graph

@@                   Coverage Diff                    @@
##             feature/extensions     #929      +/-   ##
========================================================
- Coverage                 42.86%   42.84%   -0.02%     
  Complexity                 2420     2420              
========================================================
  Files                       301      301              
  Lines                     18168    18169       +1     
  Branches                   1873     1873              
========================================================
- Hits                       7787     7784       -3     
- Misses                     9806     9810       +4     
  Partials                    575      575              
Flag Coverage Δ
plugin 42.84% <90.90%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...c/main/java/org/opensearch/ad/util/IndexUtils.java 1.31% <0.00%> (-0.02%) ⬇️
...common/exception/NotSerializedADExceptionName.java 76.74% <100.00%> (ø)

... and 2 files with indirect coverage changes

@owaiskazi19 owaiskazi19 merged commit 766fd6e into opensearch-project:feature/extensions Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants