Skip to content

Conversation

aparajita31pandey
Copy link
Contributor

@aparajita31pandey aparajita31pandey commented Aug 9, 2025

Description

This change introduces a gRPC Interceptor Chain into the transport-grpc module. The chain allows multiple interceptors to be applied in a defined order for every gRPC request. It lays the foundation for future needs (e.g., profiling, observability, logging), where ServerInterceptor provides a convenient hook.

Each interceptor can perform logic such as authentication, logging, or metrics collection before the request reaches the actual service. Interceptors are discovered using a provider interface and validated to ensure no duplicate order values.

If all interceptors succeed, the request proceeds to the service.
If any interceptor throws an exception, the chain logs the error, closes the call with an INTERNAL status, and stops further processing. This ensures a strict fail-fast model where faulty interceptors cannot be bypassed.This design makes gRPC extension points in OpenSearch opensearch-project/security#5379.

Related Issues

Resolves #5379

Test Plan

The changes are covered with unit tests to check interceptor ordering, duplicate detection, and error handling. Example scenarios include:

  1. Verifying that interceptors execute in the correct sequence.
  2. Ensuring that a failing interceptor stops the request when failures are not ignored.
  3. Confirming that ignored failures allow the request to proceed to the next interceptor and service.
  4. Checking that the system behaves the same when no interceptors are present.
  5. Tested end to end with plugin having transport-grpc extension using gRPCInterceptor

Check List

  • Functionality includes testing.

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.

@aparajita31pandey aparajita31pandey requested a review from a team as a code owner August 9, 2025 15:29
Copy link
Contributor

github-actions bot commented Aug 9, 2025

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

@aparajita31pandey aparajita31pandey changed the title WIP: Introduce gprc interceptor WIP: gprc interceptor Aug 19, 2025
@aparajita31pandey aparajita31pandey force-pushed the introduceGprcInterceptor branch from 722ee62 to fbee539 Compare August 24, 2025 17:08
Copy link
Contributor

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

@aparajita31pandey aparajita31pandey force-pushed the introduceGprcInterceptor branch 3 times, most recently from 6433438 to 99bbac2 Compare August 24, 2025 17:58
@aparajita31pandey aparajita31pandey marked this pull request as draft August 24, 2025 18:02
Copy link
Contributor

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

@aparajita31pandey aparajita31pandey changed the title WIP: gprc interceptor WIP: gRPC interceptor Sep 8, 2025
Copy link
Contributor

❌ Gradle check result for 14301f8: 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 6a01d57: 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 b924e76: 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 8492d65: 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 52dc73c: null

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?

@aparajita31pandey aparajita31pandey marked this pull request as ready for review September 18, 2025 07:25
Copy link
Contributor

❌ Gradle check result for 5e22c55: 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 0ed5ca9: 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 e05670e: 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 2ef40bc: 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 0951394: 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?

@aparajita31pandey aparajita31pandey force-pushed the introduceGprcInterceptor branch 2 times, most recently from 5cd49dc to 02e7cd7 Compare September 19, 2025 02:10
aparajita31pandey and others added 2 commits October 10, 2025 03:39
Signed-off-by: Aparajita Pandey <[email protected]>
Copy link
Contributor

github-actions bot commented Oct 9, 2025

✅ Gradle check result for 9784239: SUCCESS

Copy link
Contributor

❌ Gradle check result for 020a0aa: 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 020a0aa: SUCCESS

@aparajita31pandey
Copy link
Contributor Author

@cwperks @karenyrx Have addressed all review feedback:

  1. Changed SPI dependencies to implementation
  2. Made OrderedGrpcInterceptor a nested interface
  3. Updated README with build.gradle extension examples
    All tests passing.

@karenyrx karenyrx merged commit 821045f into opensearch-project:main Oct 14, 2025
34 of 36 checks passed
peteralfonsi pushed a commit to peteralfonsi/OpenSearch that referenced this pull request Oct 15, 2025
…ct#19005)

* Introduce Interceptor to Grpc Plugin - Signed-off-by: Aparajita Pandey <[email protected]>

Signed-off-by: Aparajita Pandey <[email protected]>

* This is a combination of 7 commits.

Add testcases for gRPC Interceptor

Signed-off-by: Aparajita Pandey <[email protected]>

Ran spotlessAppy

Signed-off-by: Aparajita Pandey <[email protected]>

refactor

Signed-off-by: Aparajita Pandey <[email protected]>

spotlesssCheck

Signed-off-by: Aparajita Pandey <[email protected]>

check if it verified

Signed-off-by: Aparajita Pandey <[email protected]>

Added GrpcInterceptorChain

check if it verified

Signed-off-by: Aparajita Pandey <[email protected]>

revert

Signed-off-by: Aparajita Pandey <[email protected]>

empty commit

Signed-off-by: Aparajita Pandey <[email protected]>

Added GrpcInterceptorChain

Signed-off-by: Aparajita Pandey <[email protected]>

Added GrpcInterceptorChain

Signed-off-by: Aparajita Pandey <[email protected]>

Added GrpcInterceptorChain

Signed-off-by: Aparajita Pandey <[email protected]>

testCases

Signed-off-by: Aparajita Pandey <[email protected]>

logger

Signed-off-by: Aparajita Pandey <[email protected]>

Resolve Conflict

Signed-off-by: Aparajita Pandey <[email protected]>

javadoc

Signed-off-by: Aparajita Pandey <[email protected]>

* javadoc

Signed-off-by: Aparajita Pandey <[email protected]>

* cleanuo

Signed-off-by: Aparajita Pandey <[email protected]>

* move GrpcInterceptor Interface to spi

Signed-off-by: Aparajita Pandey <[email protected]>

* move GrpcInterceptor Interface to spi

Signed-off-by: Aparajita Pandey <[email protected]>

* build.gradle fixes

Signed-off-by: Aparajita Pandey <[email protected]>

* GrpcInterceptorChain refactoring

Signed-off-by: Aparajita Pandey <[email protected]>

* GrpcInterceptorChain refactoring

Signed-off-by: Aparajita Pandey <[email protected]>

* rebase

Signed-off-by: Aparajita Pandey <[email protected]>

* coverage

Signed-off-by: Aparajita Pandey <[email protected]>

* spotless

Signed-off-by: Aparajita Pandey <[email protected]>

* Add logic to throw exception on workload group deletion with associated rules (opensearch-project#19502)

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

* add documentation about debug-server-jvm in testing.md (opensearch-project#19567)

Signed-off-by: Vigya Sharma <[email protected]>
Signed-off-by: Aparajita Pandey <[email protected]>

* Adds a mapper for context aware segments grouping criteria (opensearch-project#19233)

* Adds Context aware grouping  mapper

The change also stores grouping criteria for each doc in parsed context

Signed-off-by: Tejas Shah <[email protected]>

* Adds a test for ContextAwareGroupingScript

Signed-off-by: Tejas Shah <[email protected]>

* Adds ContextAwareGroupingScript support in mockScriptEngine to fix integ tests

Signed-off-by: Tejas Shah <[email protected]>

* Corrects CHANGELOG.md

Signed-off-by: Tejas Shah <[email protected]>

* Fixes LangPainlessClientYamlTestSuiteIT

Signed-off-by: Tejas Shah <[email protected]>

---------

Signed-off-by: Tejas Shah <[email protected]>
Signed-off-by: Aparajita Pandey <[email protected]>

* Refactor README.md and GrpcInterceptorChain Constructor

Signed-off-by: Aparajita Pandey <[email protected]>

* UpdateREADME & switch to implmentation

Signed-off-by: Aparajita Pandey <[email protected]>

* refactoring

Signed-off-by: Aparajita Pandey <[email protected]>

* refactoring

Signed-off-by: Aparajita Pandey <[email protected]>

* Address PR review comments

- Changed SPI dependencies from api to implementation
- Made OrderedGrpcInterceptor a nested interface inside GrpcInterceptorProvider
- Updated README with build.gradle extension declaration examples
- Simplified duplicate order handling documentation

Signed-off-by: Aparajita Pandey <[email protected]>

* empty commit

Signed-off-by: Aparajita Pandey <[email protected]>

* resolve conflict

Signed-off-by: Aparajita Pandey <[email protected]>

---------

Signed-off-by: Aparajita Pandey <[email protected]>
Signed-off-by: Kaushal Kumar <[email protected]>
Signed-off-by: Vigya Sharma <[email protected]>
Signed-off-by: Tejas Shah <[email protected]>
Signed-off-by: Aparajita Pandey <[email protected]>
Co-authored-by: Kaushal Kumar <[email protected]>
Co-authored-by: Vigya Sharma <[email protected]>
Co-authored-by: Tejas Shah <[email protected]>
rgsriram pushed a commit to rgsriram/OpenSearch that referenced this pull request Oct 18, 2025
…ct#19005)

* Introduce Interceptor to Grpc Plugin - Signed-off-by: Aparajita Pandey <[email protected]>

Signed-off-by: Aparajita Pandey <[email protected]>

* This is a combination of 7 commits.

Add testcases for gRPC Interceptor

Signed-off-by: Aparajita Pandey <[email protected]>

Ran spotlessAppy

Signed-off-by: Aparajita Pandey <[email protected]>

refactor

Signed-off-by: Aparajita Pandey <[email protected]>

spotlesssCheck

Signed-off-by: Aparajita Pandey <[email protected]>

check if it verified

Signed-off-by: Aparajita Pandey <[email protected]>

Added GrpcInterceptorChain

check if it verified

Signed-off-by: Aparajita Pandey <[email protected]>

revert

Signed-off-by: Aparajita Pandey <[email protected]>

empty commit

Signed-off-by: Aparajita Pandey <[email protected]>

Added GrpcInterceptorChain

Signed-off-by: Aparajita Pandey <[email protected]>

Added GrpcInterceptorChain

Signed-off-by: Aparajita Pandey <[email protected]>

Added GrpcInterceptorChain

Signed-off-by: Aparajita Pandey <[email protected]>

testCases

Signed-off-by: Aparajita Pandey <[email protected]>

logger

Signed-off-by: Aparajita Pandey <[email protected]>

Resolve Conflict

Signed-off-by: Aparajita Pandey <[email protected]>

javadoc

Signed-off-by: Aparajita Pandey <[email protected]>

* javadoc

Signed-off-by: Aparajita Pandey <[email protected]>

* cleanuo

Signed-off-by: Aparajita Pandey <[email protected]>

* move GrpcInterceptor Interface to spi

Signed-off-by: Aparajita Pandey <[email protected]>

* move GrpcInterceptor Interface to spi

Signed-off-by: Aparajita Pandey <[email protected]>

* build.gradle fixes

Signed-off-by: Aparajita Pandey <[email protected]>

* GrpcInterceptorChain refactoring

Signed-off-by: Aparajita Pandey <[email protected]>

* GrpcInterceptorChain refactoring

Signed-off-by: Aparajita Pandey <[email protected]>

* rebase

Signed-off-by: Aparajita Pandey <[email protected]>

* coverage

Signed-off-by: Aparajita Pandey <[email protected]>

* spotless

Signed-off-by: Aparajita Pandey <[email protected]>

* Add logic to throw exception on workload group deletion with associated rules (opensearch-project#19502)

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

* add documentation about debug-server-jvm in testing.md (opensearch-project#19567)

Signed-off-by: Vigya Sharma <[email protected]>
Signed-off-by: Aparajita Pandey <[email protected]>

* Adds a mapper for context aware segments grouping criteria (opensearch-project#19233)

* Adds Context aware grouping  mapper

The change also stores grouping criteria for each doc in parsed context

Signed-off-by: Tejas Shah <[email protected]>

* Adds a test for ContextAwareGroupingScript

Signed-off-by: Tejas Shah <[email protected]>

* Adds ContextAwareGroupingScript support in mockScriptEngine to fix integ tests

Signed-off-by: Tejas Shah <[email protected]>

* Corrects CHANGELOG.md

Signed-off-by: Tejas Shah <[email protected]>

* Fixes LangPainlessClientYamlTestSuiteIT

Signed-off-by: Tejas Shah <[email protected]>

---------

Signed-off-by: Tejas Shah <[email protected]>
Signed-off-by: Aparajita Pandey <[email protected]>

* Refactor README.md and GrpcInterceptorChain Constructor

Signed-off-by: Aparajita Pandey <[email protected]>

* UpdateREADME & switch to implmentation

Signed-off-by: Aparajita Pandey <[email protected]>

* refactoring

Signed-off-by: Aparajita Pandey <[email protected]>

* refactoring

Signed-off-by: Aparajita Pandey <[email protected]>

* Address PR review comments

- Changed SPI dependencies from api to implementation
- Made OrderedGrpcInterceptor a nested interface inside GrpcInterceptorProvider
- Updated README with build.gradle extension declaration examples
- Simplified duplicate order handling documentation

Signed-off-by: Aparajita Pandey <[email protected]>

* empty commit

Signed-off-by: Aparajita Pandey <[email protected]>

* resolve conflict

Signed-off-by: Aparajita Pandey <[email protected]>

---------

Signed-off-by: Aparajita Pandey <[email protected]>
Signed-off-by: Kaushal Kumar <[email protected]>
Signed-off-by: Vigya Sharma <[email protected]>
Signed-off-by: Tejas Shah <[email protected]>
Signed-off-by: Aparajita Pandey <[email protected]>
Co-authored-by: Kaushal Kumar <[email protected]>
Co-authored-by: Vigya Sharma <[email protected]>
Co-authored-by: Tejas Shah <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants