grundprinzip opened a new pull request, #38320:
URL: https://github.com/apache/spark/pull/38320
### What changes were proposed in this pull request?
To be able to modify the incoming requests for the Spark Connect GRPC
service, for example to be able to translate metadata from the HTTP/2 request
to values in the proto message the GRPC service needs to be configured using an
interceptor.
This patch adds two ways to configure interceptors for the GRPC service.
First, we can now configure interceptors in the
`SparkConnectInterceptorRegistry` by adding a value to the `interceptorChain`
like in the example below:
```
object SparkConnectInterceptorRegistry {
// Contains the list of configured interceptors.
private lazy val interceptorChain: Seq[InterceptorBuilder] = Seq(
interceptor[LoggingInterceptor](classOf[LoggingInterceptor])
)
// ...
}
```
The second way to configure interceptors is by configuring them using Spark
configuration values at startup. Therefore a new config key has been added
called: `spark.connect.grpc.interceptor.classes`. This config value contains a
comma-separated list of classes that are added as interceptors to the system.
```
./bin/pyspark --conf
spark.connect.grpc.interceptor.classes=com.my.important.LoggingInterceptor
```
During startup all of the interceptors are added in order to the
`NettyServerBuilder`.
```
// Add all registered interceptors to the server builder.
SparkConnectInterceptorRegistry.chainInterceptors(sb)
```
### Why are the changes needed?
Provide a configurable and extensible way to configure interceptors.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Unit Tests
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]