Skip to content

[Rule based auto tagging] Add in-memory rule processing service #17365

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

Merged
merged 19 commits into from
Apr 3, 2025

Conversation

kaushalmahi12
Copy link
Contributor

@kaushalmahi12 kaushalmahi12 commented Feb 14, 2025

Description

This change adds the service class for managing in-memory view of rules and evaluates the target label for incoming search requests.

Do not review the following files since they are part of other PRs

  • Rule.java PR
  • build.gradle, Everything under storage package and corresponding UTs PR

Related Issues

#16797 (comment)

Check List

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

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.

Copy link
Contributor

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

@kaushalmahi12 kaushalmahi12 added backport 2.x Backport to 2.x branch backport 2.0 Backport to 2.0 branch and removed backport 2.0 Backport to 2.0 branch labels Feb 14, 2025
Copy link
Contributor

❌ Gradle check result for 3bea59a: 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

@kaushalmahi12 - Precommit failing due to license error:

Execution failed for task ':plugins:workload-management:dependencyLicenses'.
> Licences dir /home/runner/work/OpenSearch/OpenSearch/plugins/workload-management/licenses does not exist, but there are dependencies: commons-collections4-4.4.jar

Copy link
Contributor

@sgup432 sgup432 left a comment

Choose a reason for hiding this comment

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

LGTM overall

Copy link
Contributor

github-actions bot commented Apr 1, 2025

❌ Gradle check result for e502a38:

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

@jainankitk jainankitk left a comment

Choose a reason for hiding this comment

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

Thanks @kaushalmahi12 for this PR. Mostly looks good, have few minor comments

Copy link
Contributor

github-actions bot commented Apr 2, 2025

❌ Gradle check result for cfeaace: 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: Kaushal Kumar <[email protected]>
Copy link
Contributor

github-actions bot commented Apr 3, 2025

❌ Gradle check result for 512b0ca: 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: Kaushal Kumar <[email protected]>
Copy link
Contributor

github-actions bot commented Apr 3, 2025

✅ Gradle check result for 8a9aeb8: SUCCESS

Copy link

codecov bot commented Apr 3, 2025

Codecov Report

Attention: Patch coverage is 87.32394% with 9 lines in your changes missing coverage. Please review.

Project coverage is 72.39%. Comparing base (15d27a1) to head (8a9aeb8).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
...wlm/rule/attribute_extractor/IndicesExtractor.java 0.00% 5 Missing ⚠️
...opensearch/rule/InMemoryRuleProcessingService.java 94.87% 0 Missing and 2 partials ⚠️
...earch/rule/storage/AttributeValueStoreFactory.java 83.33% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #17365      +/-   ##
============================================
- Coverage     72.43%   72.39%   -0.05%     
+ Complexity    66065    66027      -38     
============================================
  Files          5351     5355       +4     
  Lines        306220   306338     +118     
  Branches      44376    44386      +10     
============================================
- Hits         221812   221759      -53     
- Misses        66272    66445     +173     
+ Partials      18136    18134       -2     

☔ 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 8312e42 into opensearch-project:main Apr 3, 2025
31 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-17365-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 8312e42362e3fdb068cbe6b36edaeabc2f987f47
# Push it to GitHub
git push --set-upstream origin backport/backport-17365-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-17365-to-2.x.

kaushalmahi12 added a commit to kaushalmahi12/OpenSearch that referenced this pull request Apr 3, 2025
…search-project#17365)

* [rule based autotagging] add attribute value store

Signed-off-by: Kaushal Kumar <[email protected]>

* add in-memory rule processing service

Signed-off-by: Kaushal Kumar <[email protected]>

* add missing javadoc

Signed-off-by: Kaushal Kumar <[email protected]>

* merge the in-memory store changes:

commit d02e544
Author: Kaushal Kumar <[email protected]>
Date:   Mon Feb 17 13:05:20 2025 -0800

    add licenses directory

    Signed-off-by: Kaushal Kumar <[email protected]>

commit 3f98f9d
Author: Kaushal Kumar <[email protected]>
Date:   Mon Feb 17 11:52:56 2025 -0800

    improve binary search bisecting expression

    Signed-off-by: Kaushal Kumar <[email protected]>

commit 630a3ee
Author: Kaushal Kumar <[email protected]>
Date:   Mon Feb 17 11:14:39 2025 -0800

    improve javadoc for attribute value store

    Signed-off-by: Kaushal Kumar <[email protected]>

commit acdb27c
Author: Kaushal Kumar <[email protected]>
Date:   Fri Feb 14 10:09:58 2025 -0800

    add missing javadoc

    Signed-off-by: Kaushal Kumar <[email protected]>

commit 24c4ea6
Author: Kaushal Kumar <[email protected]>
Date:   Fri Feb 14 09:28:46 2025 -0800

    run spotless apply

    Signed-off-by: Kaushal Kumar <[email protected]>

commit 75b6e68
Author: Kaushal Kumar <[email protected]>
Date:   Fri Feb 14 09:24:32 2025 -0800

    make the store interface generic

    Signed-off-by: Kaushal Kumar <[email protected]>

Signed-off-by: Kaushal Kumar <[email protected]>

* fix generics error

Signed-off-by: Kaushal Kumar <[email protected]>

* add CHANGELOG entry

Signed-off-by: Kaushal Kumar <[email protected]>

* remove stubs

Signed-off-by: Kaushal Kumar <[email protected]>

* move generic logic to lib

Signed-off-by: Kaushal Kumar <[email protected]>

* fix javadoc error

Signed-off-by: Kaushal Kumar <[email protected]>

* fix javadoc error

Signed-off-by: Kaushal Kumar <[email protected]>

* delete licenses from the wlm plugin

Signed-off-by: Kaushal Kumar <[email protected]>

* expose feature level attribute value store init method

Signed-off-by: Kaushal Kumar <[email protected]>

* add extra space to remove unwanted entry from the changelog diff

Signed-off-by: Kaushal Kumar <[email protected]>

* address comments

Signed-off-by: Kaushal Kumar <[email protected]>

* use constructors over static methods

Signed-off-by: Kaushal Kumar <[email protected]>

* make member var final in InMemoryRuleProcessingService

Signed-off-by: Kaushal Kumar <[email protected]>

* make concurrency checks more granular

Signed-off-by: Kaushal Kumar <[email protected]>

* add concurrent test

Signed-off-by: Kaushal Kumar <[email protected]>

* remove forbidden api usage

Signed-off-by: Kaushal Kumar <[email protected]>

---------

Signed-off-by: Kaushal Kumar <[email protected]>
jainankitk pushed a commit that referenced this pull request Apr 3, 2025
…g service (#17781)

* [Rule based auto tagging] Add in-memory rule processing service (#17365)

* [rule based autotagging] add attribute value store

Signed-off-by: Kaushal Kumar <[email protected]>

* add in-memory rule processing service

Signed-off-by: Kaushal Kumar <[email protected]>

* add missing javadoc

Signed-off-by: Kaushal Kumar <[email protected]>

* merge the in-memory store changes:

commit d02e544
Author: Kaushal Kumar <[email protected]>
Date:   Mon Feb 17 13:05:20 2025 -0800

    add licenses directory

    Signed-off-by: Kaushal Kumar <[email protected]>

commit 3f98f9d
Author: Kaushal Kumar <[email protected]>
Date:   Mon Feb 17 11:52:56 2025 -0800

    improve binary search bisecting expression

    Signed-off-by: Kaushal Kumar <[email protected]>

commit 630a3ee
Author: Kaushal Kumar <[email protected]>
Date:   Mon Feb 17 11:14:39 2025 -0800

    improve javadoc for attribute value store

    Signed-off-by: Kaushal Kumar <[email protected]>

commit acdb27c
Author: Kaushal Kumar <[email protected]>
Date:   Fri Feb 14 10:09:58 2025 -0800

    add missing javadoc

    Signed-off-by: Kaushal Kumar <[email protected]>

commit 24c4ea6
Author: Kaushal Kumar <[email protected]>
Date:   Fri Feb 14 09:28:46 2025 -0800

    run spotless apply

    Signed-off-by: Kaushal Kumar <[email protected]>

commit 75b6e68
Author: Kaushal Kumar <[email protected]>
Date:   Fri Feb 14 09:24:32 2025 -0800

    make the store interface generic

    Signed-off-by: Kaushal Kumar <[email protected]>

Signed-off-by: Kaushal Kumar <[email protected]>

* fix generics error

Signed-off-by: Kaushal Kumar <[email protected]>

* add CHANGELOG entry

Signed-off-by: Kaushal Kumar <[email protected]>

* remove stubs

Signed-off-by: Kaushal Kumar <[email protected]>

* move generic logic to lib

Signed-off-by: Kaushal Kumar <[email protected]>

* fix javadoc error

Signed-off-by: Kaushal Kumar <[email protected]>

* fix javadoc error

Signed-off-by: Kaushal Kumar <[email protected]>

* delete licenses from the wlm plugin

Signed-off-by: Kaushal Kumar <[email protected]>

* expose feature level attribute value store init method

Signed-off-by: Kaushal Kumar <[email protected]>

* add extra space to remove unwanted entry from the changelog diff

Signed-off-by: Kaushal Kumar <[email protected]>

* address comments

Signed-off-by: Kaushal Kumar <[email protected]>

* use constructors over static methods

Signed-off-by: Kaushal Kumar <[email protected]>

* make member var final in InMemoryRuleProcessingService

Signed-off-by: Kaushal Kumar <[email protected]>

* make concurrency checks more granular

Signed-off-by: Kaushal Kumar <[email protected]>

* add concurrent test

Signed-off-by: Kaushal Kumar <[email protected]>

* remove forbidden api usage

Signed-off-by: Kaushal Kumar <[email protected]>

---------

Signed-off-by: Kaushal Kumar <[email protected]>

* add changelog entry

Signed-off-by: Kaushal Kumar <[email protected]>

* remove generic type usage with instanceof operator

Signed-off-by: Kaushal Kumar <[email protected]>

---------

Signed-off-by: Kaushal Kumar <[email protected]>
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.

3 participants