-
Notifications
You must be signed in to change notification settings - Fork 796
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
feat: add grpc attribute "rpc.grpc.authority" #5151
Conversation
@@ -43,6 +43,7 @@ | |||
public <REQUEST, RESPONSE> ClientCall<REQUEST, RESPONSE> interceptCall( | |||
MethodDescriptor<REQUEST, RESPONSE> method, CallOptions callOptions, Channel next) { | |||
GrpcRequest request = new GrpcRequest(method, null, null); | |||
request.setAuthority(next.authority()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Javadocs for authority()
say the following:
The authority of the destination this channel connects to. Typically this is in the format host:port.
Is there any significant difference between capturing authority()
and the net.peer.*
attributes?
@@ -17,6 +17,8 @@ | |||
|
|||
@Nullable private volatile SocketAddress remoteAddress; | |||
|
|||
@Nullable private volatile String authority; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not change during this object's life, it's set once just after the construction - can you make it a final field instead?
@@ -14,7 +14,9 @@ | |||
final class GrpcAttributesExtractor implements AttributesExtractor<GrpcRequest, Status> { | |||
@Override | |||
public void onStart(AttributesBuilder attributes, GrpcRequest grpcRequest) { | |||
// No request attributes | |||
if (grpcRequest.getAuthority() != null) { | |||
attributes.put(GrpcHelper.RPC_GRPC_AUTHORITY, grpcRequest.getAuthority()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new attribute does not seem to be present in the RPC semantic conventions spec. Would you mind opening a PR/issue against the spec repo that introduces this attribute?
And, for now, how about moving it to a separate AttributesExtractor
that's disabled by default? We're using the experimental-span-attributes
for these, e.g. otel.instrumentation.aws-sdk.experimental-span-attributes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that I agree this attribute seems to already be captured as part of net.peer
so unless there is a difference, we probably wouldn't want to go forward with even an experimental attribute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your reply. I found in grpc client spans there were no net.peer
attributes. So I add the authority
attribute by this PR and then we can know the invoked remote service's host and port. Is this a bug in grpc client instrumentation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No description provided.