Skip to content
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

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

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.

Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>
Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>
Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>
Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>
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?

Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>
@kaushalmahi12 kaushalmahi12 added the backport 2.x Backport to 2.x branch label Feb 14, 2025
@kaushalmahi12 kaushalmahi12 added 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
Collaborator

@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

assert attribute.getValueStore() != null;

for (String value : attributeEntry.getValue()) {
attribute.getValueStore().add(value, this.rule.getLabel());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not have reference to the rule itself, instead of String label?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe there is no added advantage of adding rule reference here at this place. Do you think that will add any additional value ?

* @param rule to be added
*/
public void add(final Rule rule) {
new AddRuleOperation(rule).perform();
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am assuming that the add method has addMerge semantics, so it will take care of updates as well?

Copy link
Contributor Author

@kaushalmahi12 kaushalmahi12 Feb 17, 2025

Choose a reason for hiding this comment

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

Yes, So the update will translate into delete + add. We will need to delete the existing rule first since the update might miss some values for an attribute. For example lets say the rule had ["logs_","pay_"] but the updated values for this attribute now is ["pay_","order_"] now if we simply add these value to the in-memory store there will be this "logs_" as a dangling value.

commit d02e544
Author: Kaushal Kumar <ravi.kaushal97@gmail.com>
Date:   Mon Feb 17 13:05:20 2025 -0800

    add licenses directory

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

commit 3f98f9d
Author: Kaushal Kumar <ravi.kaushal97@gmail.com>
Date:   Mon Feb 17 11:52:56 2025 -0800

    improve binary search bisecting expression

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

commit 630a3ee
Author: Kaushal Kumar <ravi.kaushal97@gmail.com>
Date:   Mon Feb 17 11:14:39 2025 -0800

    improve javadoc for attribute value store

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

commit acdb27c
Author: Kaushal Kumar <ravi.kaushal97@gmail.com>
Date:   Fri Feb 14 10:09:58 2025 -0800

    add missing javadoc

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

commit 24c4ea6
Author: Kaushal Kumar <ravi.kaushal97@gmail.com>
Date:   Fri Feb 14 09:28:46 2025 -0800

    run spotless apply

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

commit 75b6e68
Author: Kaushal Kumar <ravi.kaushal97@gmail.com>
Date:   Fri Feb 14 09:24:32 2025 -0800

    make the store interface generic

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

Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>
@kaushalmahi12
Copy link
Contributor Author

kaushalmahi12 commented Feb 17, 2025

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

I have fixed it in this PR : https://github.com/opensearch-project/OpenSearch/pull/17342/files
I will bring the those changes into this one.

Copy link
Contributor

❌ Gradle check result for 6ecbaad: 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

❌ Gradle check result for 5104b36: 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

❌ Gradle check result for aaf3c05: 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 <ravi.kaushal97@gmail.com>
Copy link
Contributor

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

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants