getAttributes() always empty if called from SimpleForwardingClientCall
See original GitHub issueWhat version of gRPC are you using?
1.10.0
What did you expect to see?
Let’s say we have the following client interceptor which is attached to our channel:
class LoggingClientInterceptor implements ClientInterceptor {
private static final Logger log = LoggerFactory.getLogger(LoggingClientInterceptor.class);
@Override
public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(MethodDescriptor<ReqT, RespT> method,
CallOptions callOptions, Channel next) {
return new SimpleForwardingClientCall<ReqT, RespT>(next.newCall(method, callOptions)) {
@Override
public void start(Listener<RespT> responseListener, Metadata headers) {
log.info("grpc request; method: {}, attributes: {}", method.getFullMethodName(),
getAttributes());
super.start(responseListener, headers);
}
};
}
}
When calling the getAttributes()
method I expected to see a set of attributes which contains at least the information about the server to which the client is going to make a request to. Unfortunately, getAttributes()
method always empty.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
ForwardingClientCall.SimpleForwardingClientCall (grpc-all ...
Method Summary ; Attributes · getAttributes(). Returns additional properties of the call. ; void, halfClose(). Close the call for request message sending.
Read more >Index (grpc-all 1.25.0 API) - javadoc.io
Returns mutable services registered with the server, or an empty list if not supported by the implementation. getName() - Method in class io.grpc.inprocess....
Read more >Diff - platform/external/grpc-grpc-java - Google Git
+ + // targetName is the server service account name for secure name checking. ... + @Attr public Attributes getAttributes() { return attrs;...
Read more >io.grpc.DecompressorRegistry Example - Program Talk
NONE; } } // Always put compressor, even if it's idenreplacedy. ... @Test public void getAttributes() { ClientCallImpl<Void, Void> call = new ...
Read more >io.grpc.ForwardingClientCall.SimpleForwardingClientCall
This page shows Java code examples of io.grpc. ... return new SimpleForwardingClientCall<ReqT, RespT>(call) { @Override public void start(Listener<RespT> ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
+1
@maseev, your updated interceptor will work correctly. But if you are using plaintext, no attributes will be added by the grpc library. If you are using Netty transport with TLS, two attributes may be added:
Grpc.TRANSPORT_ATTR_SSL_SESSION
andGrpc.TRANSPORT_ATTR_REMOTE_ADDR
Oh, I didn’t know that. I do use
plaintext
actually. I guess that explains everything. Thank you for your help @zpencer @dapengzhang0.