-
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
Make Custom Result Index Name an Alias #1225
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Previously, we used configured custom result index names as the index name, creating the index only when a detector was created. This approach caused several problems for index management: 1. **Index State Management (ISM) Incompatibility**: ISM requires an alias for rolling over an index, but we only had the index name. 2. **Index Recognition Issue**: Even if we managed to roll over an index, AD could not recognize it because the index would not be recreated unless the detector was recreated. 3. **Result History and Top Anomaly Results**: The result history on the dashboard and top anomaly results were reading from a single index instead of an index pattern. Thus, after rolling over an index, the result history and top anomaly results would be lost. This PR addresses these issues: 1. **Custom Result Index Creation**: We now create a custom result index with the name `<custom-name-history-{now/d}-1>` and use the alias `custom-name` to point to it. 2. **Index Recreation**: We recreate an index when failing to find a result index, updating the configured alias to point to the new index. This ensures continuity when an index is rolled over and new indices do not exist. 3. **Query Index Pattern**: The top anomaly result API now queries an index pattern instead of a single index. The result history on the dashboard follows the same approach. The dashboard code will be posted in a separate PR. Additionally, this PR updates the custom result index mapping when the mapping is outdated, similar to existing logic on the default result index. **Testing Done**: * Successfully updated the mapping of the custom result index when the mapping is outdated. * Verified that the frontend can still see old and new results after a rollover. * Confirmed that the backend can still write to new indices after a rollover. * Ensured all existing tests pass. More tests will be added in the following PRs. Signed-off-by: Kaituo Li <[email protected]>
kaituo
requested review from
jmazanec15,
jngz-es,
saratvemulapalli,
ohltyler,
vamshin,
VijayanB,
ylwu-amzn,
amitgalitz,
jackiehanyang,
sean-zheng-amazon,
dbwiddis,
owaiskazi19 and
joshpalis
as code owners
June 6, 2024 23:45
opensearch-trigger-bot
bot
added
infra
Changes to infrastructure, testing, CI/CD, pipelines, etc.
backport 2.x
labels
Jun 6, 2024
Synced offline about this pr. Thanks for the change! |
jackiehanyang
approved these changes
Jun 7, 2024
The backport to
To backport manually, run these commands in your terminal: # Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/anomaly-detection/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/anomaly-detection/backport-2.x
# Create a new branch
git switch --create backport/backport-1225-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 4d400e3c926528ec884b54749e035c7855fb104c
# Push it to GitHub
git push --set-upstream origin backport/backport-1225-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/anomaly-detection/backport-2.x Then, create a pull request where the |
4 tasks
kaituo
added a commit
to kaituo/anomaly-detection-1
that referenced
this pull request
Jun 10, 2024
Previously, we used configured custom result index names as the index name, creating the index only when a detector was created. This approach caused several problems for index management: 1. **Index State Management (ISM) Incompatibility**: ISM requires an alias for rolling over an index, but we only had the index name. 2. **Index Recognition Issue**: Even if we managed to roll over an index, AD could not recognize it because the index would not be recreated unless the detector was recreated. 3. **Result History and Top Anomaly Results**: The result history on the dashboard and top anomaly results were reading from a single index instead of an index pattern. Thus, after rolling over an index, the result history and top anomaly results would be lost. This PR addresses these issues: 1. **Custom Result Index Creation**: We now create a custom result index with the name `<custom-name-history-{now/d}-1>` and use the alias `custom-name` to point to it. 2. **Index Recreation**: We recreate an index when failing to find a result index, updating the configured alias to point to the new index. This ensures continuity when an index is rolled over and new indices do not exist. 3. **Query Index Pattern**: The top anomaly result API now queries an index pattern instead of a single index. The result history on the dashboard follows the same approach. The dashboard code will be posted in a separate PR. Additionally, this PR updates the custom result index mapping when the mapping is outdated, similar to existing logic on the default result index. **Testing Done**: * Successfully updated the mapping of the custom result index when the mapping is outdated. * Verified that the frontend can still see old and new results after a rollover. * Confirmed that the backend can still write to new indices after a rollover. * Ensured all existing tests pass. More tests will be added in the following PRs. Signed-off-by: Kaituo Li <[email protected]>
kaituo
added a commit
that referenced
this pull request
Jun 10, 2024
Previously, we used configured custom result index names as the index name, creating the index only when a detector was created. This approach caused several problems for index management: 1. **Index State Management (ISM) Incompatibility**: ISM requires an alias for rolling over an index, but we only had the index name. 2. **Index Recognition Issue**: Even if we managed to roll over an index, AD could not recognize it because the index would not be recreated unless the detector was recreated. 3. **Result History and Top Anomaly Results**: The result history on the dashboard and top anomaly results were reading from a single index instead of an index pattern. Thus, after rolling over an index, the result history and top anomaly results would be lost. This PR addresses these issues: 1. **Custom Result Index Creation**: We now create a custom result index with the name `<custom-name-history-{now/d}-1>` and use the alias `custom-name` to point to it. 2. **Index Recreation**: We recreate an index when failing to find a result index, updating the configured alias to point to the new index. This ensures continuity when an index is rolled over and new indices do not exist. 3. **Query Index Pattern**: The top anomaly result API now queries an index pattern instead of a single index. The result history on the dashboard follows the same approach. The dashboard code will be posted in a separate PR. Additionally, this PR updates the custom result index mapping when the mapping is outdated, similar to existing logic on the default result index. **Testing Done**: * Successfully updated the mapping of the custom result index when the mapping is outdated. * Verified that the frontend can still see old and new results after a rollover. * Confirmed that the backend can still write to new indices after a rollover. * Ensured all existing tests pass. More tests will be added in the following PRs. Signed-off-by: Kaituo Li <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Previously, we used configured custom result index names as the index name, creating the index only when a detector was created. This approach caused several problems for index management:
This PR addresses these issues:
<custom-name-history-{now/d}-1>
and use the aliascustom-name
to point to it.Additionally, this PR updates the custom result index mapping when the mapping is outdated, similar to existing logic on the default result index.
Testing Done:
More tests will be added in the following PRs.
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.