-
Notifications
You must be signed in to change notification settings - Fork 867
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
Net attributes getters changes (in preparation for HTTP spec impl) #6503
Conversation
Looks good! One thing I'm not sure about is keeping logical net.peer.name, net.peer.port (and host pair) in NetAttribute*. The alternative is something like I don't have a strong opinion, methods are already there and more abstractions won't make life easier. I also assume that every network-related semantic convention would need logical attributes, so current approach in this PR is fine too. |
Hmm, I think I'll leave them in the |
a46d26a
to
312cc62
Compare
312cc62
to
b3285ad
Compare
b3285ad
to
6574cbe
Compare
@open-telemetry/java-instrumentation-maintainers this PR is ready for review. It is absurdly huge though (net semconv is used in the vast majority of all instrumentations after all) -- I tried to split it into 3 commits (instrumentation-api changes, actual getter implementation changes, fixing tests) to make it more readable, but if you have any alternative idea please let me know -- I'll try making this PR more manageable. |
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.
will keep reviewing, just wanted to leave first comments
...rc/main/java/io/opentelemetry/instrumentation/testing/junit/http/AbstractHttpServerTest.java
Show resolved
Hide resolved
...rc/main/java/io/opentelemetry/instrumentation/testing/junit/http/AbstractHttpClientTest.java
Outdated
Show resolved
Hide resolved
testing-common/src/main/groovy/io/opentelemetry/instrumentation/test/base/HttpServerTest.groovy
Outdated
Show resolved
Hide resolved
...mconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetAttributes.java
Outdated
Show resolved
Hide resolved
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.
a couple more comments, sorry for the pace..
...in/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesGetter.java
Outdated
Show resolved
Hide resolved
// dubbo 3 doesn't set remote address for client calls | ||
if (address == null) { | ||
URL url = request.url(); | ||
address = InetSocketAddress.createUnresolved(url.getHost(), url.getPort()); | ||
} |
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 is a nice example where the new semantic conventions cleared things up
...lemetry/instrumentation/api/instrumenter/net/InetSocketAddressNetClientAttributesGetter.java
Outdated
Show resolved
Hide resolved
...o/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpClientRequest.java
Outdated
Show resolved
Hide resolved
...ain/java/io/opentelemetry/instrumentation/apachehttpclient/v4_3/ApacheHttpClientRequest.java
Outdated
Show resolved
Hide resolved
} | ||
} | ||
|
||
requestInfo.setPeerAddress(channelHandlerContext.channel().remoteAddress()); |
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.
nice
No problem at all! This PR is so huge that I don't expect anybody to review it in one go 🙈 😅 |
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.
😅 that was not the straight-forward refactoring I was expecting, thx for going through all of those instrumentations to map them correctly
...tation/liberty/compile-stub/src/main/java/com/ibm/wsspi/http/channel/HttpRequestMessage.java
Show resolved
Hide resolved
instrumentation/jedis/jedis-4.0/javaagent/src/test/groovy/Jedis40ClientTest.groovy
Show resolved
Hide resolved
if (remoteAddress instanceof Inet6Address) { | ||
return "inet6"; | ||
} | ||
return null; |
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.
@lmolkova should we report inet
when that is known? the spec says we don't need to, but it feels like we may be losing something by not reporting it?
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.
I think I understand now.
It's conditionally required
If different than inet and if any of net.sock.peer.addr or net.sock.host.addr are set. Consumers of telemetry SHOULD accept both IPv4 and IPv6 formats for the address in net.sock.peer.addr if net.sock.family is not set. This is to support instrumentations that follow previous versions of this document.
So if consumers see net.sock.peer.addr
or net.sock.host.addr
, and they do not see any net.sock.family
, then they are allowed to assume that the net.sock.family
is inet
.
...n/grpc-1.6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcRequest.java
Outdated
Show resolved
Hide resolved
...brary/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/TracingClientInterceptor.java
Outdated
Show resolved
Hide resolved
...metry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyNetClientAttributesGetter.java
Show resolved
Hide resolved
if (remoteAddress == null) { | ||
remoteAddress = request.remoteAddressOnStart(); | ||
public String peerName(NettyConnectionRequest request, @Nullable Channel channel) { | ||
SocketAddress requestedAddress = request.remoteAddressOnStart(); |
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.
it seems like all netty operations are at socket layer, can you clarify why this works for net.peer.name
?
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.
My reasoning here was that in the establishing connection phase, the socket address passed at the start (before the DNS lookup & connection occurs) is actually a logical address
@mateuszrzeszutek any reason not to merge this for 1.18.0? |
If you're fine with it then I'm fine with it too 👍 |
…pen-telemetry#6503) * Net attributes getters changes: instrumentation-api-semconv changes * Net attributes getters changes: getter implementations * Net attributes getters changes: test fixes * Remove net.sock.host.name * code review comments * default getter methods & getPeerSocketAddress() method name * set authority in grpc earlier
…pen-telemetry#6503) * Net attributes getters changes: instrumentation-api-semconv changes * Net attributes getters changes: getter implementations * Net attributes getters changes: test fixes * Remove net.sock.host.name * code review comments * default getter methods & getPeerSocketAddress() method name * set authority in grpc earlier
…pen-telemetry#6503) * Net attributes getters changes: instrumentation-api-semconv changes * Net attributes getters changes: getter implementations * Net attributes getters changes: test fixes * Remove net.sock.host.name * code review comments * default getter methods & getPeerSocketAddress() method name * set authority in grpc earlier
@mateuszrzeszutek this is an issue with the apache httpasyncclient instrumentation. So we have used If I see on maven central with apache httpasyncclient v4.1 https://mvnrepository.com/artifact/org.apache.httpcomponents/httpasyncclient/4.1 The default version that comes along for httpcore is 4.4.x but that doesn't mean that the user doesn't have a way to override this. Hence someone using httpasyncclient 4.1.x with < 4.4.x version of httpcore, things will break. |
@anuragagarwal561994 can you open a new issue for this comment so it does not get lost? thx! |
@trask done |
I started working on implementing the most recent HTTP spec changes, and I think I ran into several problems with the current shape of our
net.*
attributes extractors.NetServerAttributesGetter
(I think these will be needed in the RPC semconv too)InetSocketAddress
retrieved from the library code actually represents the socket address, not the logical name/port. It is especially true for most of the HTTP instrumentations, since in these the peer name/port is supposed to be extracted from the URL, not from the socket. I decided to change theInetSocket...
classes so that they only extractnet.sock.*
attributes from theInetSocketAddress
classes, and leavepeerName
/peerPort
for the user to implement.@trask @lmolkova please take a look at this draft - I'm quite interested in your opinion on the
InetSocketAddress
changes in particular.(the 2nd commit contains the actual changes, the first one is just cleanup)