You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for stopping by to let us know something could be better!
Is your feature request related to a problem? Please describe.
My current system receives request from other system which defines deadline/finishby timeout which varies from request type to request type.
I'd like to instruct spanner client to propagate this value to spanner using 'grpc-timeout' header.
Currently it's possible to do this interacting directly with GrpcCallContext via SpannerOptions.CallContextConfigurator.
It would be great to have it as part of SpannerStubSettings, so I don't need to provide my own implementation of SpannerOptions.CallContextConfigurator and attach it to GrpcContext each time it's needed.
Describe the solution you'd like
Not sure of what would be the best approach here. I have one idea in mind:
SpannerStubSettings.Builder already contains method applyToAllUnaryMethods(...).
But it's invoked once when settings are build.
applyDynamicallyToAllUnaryMethods(ApiFunction f) method could be introduced which causes invocation of provided ApiFunction on each method invocation (or limit it to specific methods only to move it to UnaryCallSettings level).
Describe alternatives you've considered
Currently my system interact with GrpcCallContext directly via SpannerOptions.CallContextConfigurator:
public static class SpannerGrpcCallContextConfigurator implements SpannerOptions.CallContextConfigurator {
public <ReqT, RespT> ApiCallContext configure(ApiCallContext context, ReqT request,
MethodDescriptor<ReqT, RespT> method) {
if (method == SpannerGrpc.getStreamingReadMethod()) {
return GrpcCallContext.createDefault().withCallOptions(CallOptions.DEFAULT.withDeadlineAfter(/*some deadline*/));
}
return null;
}
}
then spanner invocation is wrapped with custom grpc context:
Context.current()
.withValue(SpannerOptions.CALL_CONTEXT_CONFIGURATOR_KEY, new SpannerGrpcCallContextConfigurator())
.run(() -> { /* spanner invocation here */ });
The text was updated successfully, but these errors were encountered:
Thanks for stopping by to let us know something could be better!
Is your feature request related to a problem? Please describe.
My current system receives request from other system which defines deadline/finishby timeout which varies from request type to request type.
I'd like to instruct spanner client to propagate this value to spanner using 'grpc-timeout' header.
Currently it's possible to do this interacting directly with GrpcCallContext via SpannerOptions.CallContextConfigurator.
It would be great to have it as part of SpannerStubSettings, so I don't need to provide my own implementation of SpannerOptions.CallContextConfigurator and attach it to GrpcContext each time it's needed.
Describe the solution you'd like
Not sure of what would be the best approach here. I have one idea in mind:
SpannerStubSettings.Builder already contains method applyToAllUnaryMethods(...).
But it's invoked once when settings are build.
applyDynamicallyToAllUnaryMethods(ApiFunction f) method could be introduced which causes invocation of provided ApiFunction on each method invocation (or limit it to specific methods only to move it to UnaryCallSettings level).
Describe alternatives you've considered
Currently my system interact with GrpcCallContext directly via SpannerOptions.CallContextConfigurator:
then spanner invocation is wrapped with custom grpc context:
The text was updated successfully, but these errors were encountered: