Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Forward porting profile API related PRs #128

Merged
merged 3 commits into from
May 20, 2020

Conversation

kaituo
Copy link
Member

@kaituo kaituo commented May 19, 2020

Issue #, if available:

Description of changes:
e06cf6f
85d2768
a40ccf6

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

kaituo added 3 commits May 19, 2020 16:09
…API (opendistro-for-elasticsearch#113)

Hash ring helps identify node X runs the AD job for a detector Y with models on node 1,2,3.  This helps oncalls locate logs. Total model size gives transparency relating to the current memory usage. What's more, shingle size help answer question "why my detector does not report anything?"

This PR adds the above info to profile API via a broadcast call that consults ModelManager and FeatureManager about current state pertaining to a detector.  Then these states are consolidated into information humans can parse.

This PR also queries all AD result indices instead of only current result index so that we can fetch a stopped detector's error after the result index with the error is rotated.

Testing done:
1. add unit tests for the newly added code
2. Run end-to-end testing to verify new profiles make senses when a detector stops running and is running
DetectorProfile's merge does not include new fields added.  This PR fixes that.

Testing done:
* Manually verified profile API works as expected
…icsearch#117)

Previously, profile API scans all anomaly result indices to get a detector's most recent error, which can cause performance bottleneck with large anomaly result indices. This PR improves this aspect via various efforts.

First, when a detector is running, we only need to scan the current index, not all of the rolled over ones since we are interested in the latest error.
Second, when a detector is disabled, we only need to scan the latest anomaly result indices created before the detector's enable time.
Third, setting track total hits false makes ES terminate search early. ES will not try to count the number of documents and will be able to end the query as soon as N document have been collected per segment.

Testing done:
1. patched a cluster with 1,000 detectors and 2GB anomaly result indices. Without the PR, scanning anomaly result indices 1000 times would timeout after 30 seconds. After the PR, we would not see the timeout.
2. A detector's error message can be on a rotated index. Adds a test case to makes sure we get error info from .opendistro-anomaly-results index that has been rolled over.
@kaituo kaituo merged commit 72a59eb into opendistro-for-elasticsearch:master May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants