Skip to content

Conversation

@ruai0511
Copy link
Contributor

@ruai0511 ruai0511 commented Apr 4, 2025

Description

This PR introduces the update Rule API Logic.

An exampe API request is:

curl -XPUT "localhost:9200/_wlm/rule/{rule_id}" -H 'Content-Type: application/json' -d '    
{
    "description": "description",
     "index_pattern": ["log*", "event*"],
     "query_group": "dev_query_group_id_2"
}'

And the return would be

{
    "id":"CtbfXZUBl5pUFqUjPirs",
    "description":"description",
    "index_pattern":["log*","event*"],
    "query_group":"dev_query_group_id_2",
    "updated_at":"2025-03-03T21:17:46.271Z"
}

Rule Schema PR:
#17238
RFC:
#16797

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

@ruai0511 ruai0511 changed the title [rule based autotagging] Add Update Rule API Logicadd update rule api logic [rule based autotagging] Add Update Rule API Logic Apr 4, 2025
@ruai0511 ruai0511 added the backport 2.x Backport to 2.x branch label Apr 4, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Apr 4, 2025

❌ Gradle check result for 9aa6685: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@ruai0511 ruai0511 force-pushed the update-rule-api-PR branch from 9aa6685 to c83500d Compare April 4, 2025 08:02
@github-actions
Copy link
Contributor

github-actions bot commented Apr 4, 2025

❌ Gradle check result for c83500d: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

@kaushalmahi12 kaushalmahi12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some high level comments. You can try to review these comments for other API PRs as well to avoid duplicated effort given there is lot of shared code here

@ruai0511 ruai0511 force-pushed the update-rule-api-PR branch 2 times, most recently from 955eafe to 3de620c Compare June 9, 2025 23:48
@github-actions
Copy link
Contributor

❌ Gradle check result for 3de620c: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@jainankitk
Copy link
Contributor

@ruai0511 - Gradle failures are related to these code changes. Can you address those?

[Test Result](https://build.ci.opensearch.org/job/gradle-check/58995/testReport/) (4 failures / +4)

    [org.opensearch.rule.rest.RestDeleteRuleActionTests.testRoutes](https://build.ci.opensearch.org/job/gradle-check/58995/testReport/junit/org.opensearch.rule.rest/RestDeleteRuleActionTests/testRoutes/)
    [org.opensearch.rule.rest.RestGetRuleActionTests.testRoutes](https://build.ci.opensearch.org/job/gradle-check/58995/testReport/junit/org.opensearch.rule.rest/RestGetRuleActionTests/testRoutes/)

Also comments have to be resolved, before PR can be merged

@ruai0511 ruai0511 force-pushed the update-rule-api-PR branch from 3de620c to 13d7147 Compare June 10, 2025 18:35
@github-actions
Copy link
Contributor

❌ Gradle check result for 13d7147: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@ruai0511 ruai0511 force-pushed the update-rule-api-PR branch from 13d7147 to e4a4e88 Compare June 10, 2025 20:02
@github-actions
Copy link
Contributor

❌ Gradle check result for e4a4e88: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@ruai0511 ruai0511 force-pushed the update-rule-api-PR branch from e4a4e88 to 84d43f0 Compare June 10, 2025 20:46
@github-actions
Copy link
Contributor

❌ Gradle check result for 84d43f0: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>
@ruai0511 ruai0511 force-pushed the update-rule-api-PR branch from 84d43f0 to 4fea47c Compare June 10, 2025 22:02
@ruai0511
Copy link
Contributor Author

flaky test failed. Retrying

@github-actions
Copy link
Contributor

✅ Gradle check result for 4fea47c: SUCCESS

@codecov
Copy link

codecov bot commented Jun 10, 2025

Codecov Report

Attention: Patch coverage is 50.26455% with 94 lines in your changes missing coverage. Please review.

Project coverage is 72.67%. Comparing base (6ad6f4e) to head (4fea47c).
Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
...nsearch/rule/action/TransportUpdateRuleAction.java 0.00% 29 Missing ⚠️
...ule/service/IndexStoredRulePersistenceService.java 42.42% 18 Missing and 1 partial ⚠️
...ugin/wlm/rule/WorkloadGroupRuleRoutingService.java 0.00% 15 Missing ⚠️
...org/opensearch/rule/rest/RestUpdateRuleAction.java 21.42% 11 Missing ⚠️
...org/opensearch/rule/autotagging/RuleValidator.java 45.45% 2 Missing and 4 partials ⚠️
...ain/java/org/opensearch/rule/autotagging/Rule.java 44.44% 5 Missing ⚠️
...n/src/main/java/org/opensearch/rule/RuleUtils.java 78.57% 0 Missing and 3 partials ⚠️
...va/org/opensearch/rule/rest/RestGetRuleAction.java 25.00% 3 Missing ⚠️
...org/opensearch/rule/rest/RestDeleteRuleAction.java 33.33% 2 Missing ⚠️
...org/opensearch/rule/rest/RestCreateRuleAction.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##               main   #17797    +/-   ##
==========================================
  Coverage     72.66%   72.67%            
- Complexity    67858    67974   +116     
==========================================
  Files          5521     5526     +5     
  Lines        312541   312676   +135     
  Branches      45364    45373     +9     
==========================================
+ Hits         227113   227227   +114     
- Misses        66903    66992    +89     
+ Partials      18525    18457    -68     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jainankitk jainankitk merged commit d0c2e39 into opensearch-project:main Jun 10, 2025
29 of 30 checks passed
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 128

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/OpenSearch/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch/backport-2.x
# Create a new branch
git switch --create backport/backport-17797-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 d0c2e39ae05454775b8063e09a88dd5f5834c49f
# Push it to GitHub
git push --set-upstream origin backport/backport-17797-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-17797-to-2.x.

abhita pushed a commit to abhita/OpenSearch that referenced this pull request Jun 17, 2025
…t#17797)

---------

Signed-off-by: Lingxi Chen <lingxich@amazon.com>
Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>
Co-authored-by: Lingxi Chen <lingxich@amazon.com>
neuenfeldttj added a commit to neuenfeldttj/OpenSearch that referenced this pull request Jun 26, 2025
…t#17797)

---------

Signed-off-by: Lingxi Chen <lingxich@amazon.com>
Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>
Co-authored-by: Lingxi Chen <lingxich@amazon.com>Signed-off-by: TJ Neuenfeldt <tjneu@amazon.com>
neuenfeldttj pushed a commit to neuenfeldttj/OpenSearch that referenced this pull request Jun 26, 2025
…t#17797)

---------

Signed-off-by: Lingxi Chen <lingxich@amazon.com>
Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>
Co-authored-by: Lingxi Chen <lingxich@amazon.com>
tandonks pushed a commit to tandonks/OpenSearch that referenced this pull request Aug 5, 2025
…t#17797)

---------

Signed-off-by: Lingxi Chen <lingxich@amazon.com>
Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>
Co-authored-by: Lingxi Chen <lingxich@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 2.x Backport to 2.x branch backport-failed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants