Skip to content

Conversation

@ruai0511
Copy link
Contributor

Description

This PR introduces the get Rule API Logic.

An example API request is:

curl -XGET "localhost:9200/_wlm/rule" // get all rules
curl -XGET "localhost:9200/_wlm/rule/{_id}" // get single rule by id
curl -XGET "localhost:9200/_wlm/rule?index_pattern=a,b" // get all rules containing index_pattern as a or b 

And the return would be

{
   "rules":[
      {
         "_id":"LN1z8pQBW57iKqfUCG6A",
         "index_pattern":[
            "logs*",
            "events*"
         ],
         "query_group":"dev_query_group_id_2",
         "updated_at":"2025-02-11T00:40:12.671Z"
      },
      ...
   ]
}

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.

@github-actions
Copy link
Contributor

❌ Gradle check result for db57bcb: 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 changed the title Add Get Rule API Logic [rule based autotagging] Add Get Rule API Logic Feb 12, 2025
@github-actions
Copy link
Contributor

❌ Gradle check result for f7bea2e: 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?

@github-actions
Copy link
Contributor

❌ Gradle check result for 4d2d843: 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?

@github-actions
Copy link
Contributor

❌ Gradle check result for 218c090: 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?

@github-actions
Copy link
Contributor

❌ Gradle check result for 52c1954: 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 get-rule-api-PR branch 2 times, most recently from de5a136 to 50f3d11 Compare April 23, 2025 04:32
@github-actions
Copy link
Contributor

❌ Gradle check result for 50f3d11: 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?

@github-actions
Copy link
Contributor

❌ Gradle check result for 9087c7f: 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

Unrelated failures, retrying gradle check:

[Test Result](https://build.ci.opensearch.org/job/gradle-check/56957/testReport/) (1 failure / -5)

    [org.opensearch.rest.ReactorNetty4StreamingStressIT.testCloseClientStreamingRequest](https://build.ci.opensearch.org/job/gradle-check/56957/testReport/junit/org.opensearch.rest/ReactorNetty4StreamingStressIT/testCloseClientStreamingRequest/)

@github-actions
Copy link
Contributor

❌ Gradle check result for 9087c7f: 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 get-rule-api-PR branch 3 times, most recently from 9b215e1 to 14237d2 Compare April 23, 2025 07:48
@github-actions
Copy link
Contributor

✅ Gradle check result for 14237d2: SUCCESS

@github-actions
Copy link
Contributor

✅ Gradle check result for f1f2108: SUCCESS

Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>
@github-actions
Copy link
Contributor

✅ Gradle check result for d6b3e79: SUCCESS

@jainankitk jainankitk merged commit 8932876 into opensearch-project:main Apr 23, 2025
31 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Apr 23, 2025
* add get rule api logic
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>

* modify based on comments
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>

* rebase from main after the schema merged
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>

* modify based on comments
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>

* extract common logics to libs
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>

* Add javadocs for libs
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>

* modify based on comments
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>

* modify based on comments
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>

* modify based on comments
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>

* correct UT
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>

* modify based on comments
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>

r

* refactor code and fix ut

Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>

* remove commented code

Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>

* address comments

Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>

* change method name

Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>

* fix merge conflicts

Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>

* rename queryGroup to workloadGroup

Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>

* add guice binding related changes

Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>

* refactor code to create a generic rule framework structure

Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>

* fix javadoc
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>

* fix UT
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>

* restructure tests

Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>

* rebase with mainline

Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>

* fix gradlew file
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>

* add UT
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>

* add action UTs

Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>

* correct the comment

Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>

* add more UT
Signed-off-by: Ruirui Zhang <mariazrr@amazon.com>

---------

Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>
Co-authored-by: Kaushal Kumar <ravi.kaushal97@gmail.com>
(cherry picked from commit 8932876)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@ruai0511 ruai0511 deleted the get-rule-api-PR branch July 9, 2025 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants