Skip to content
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

Migrate Netty 4.x client instrumentations (except CONNECT) to Instrum… #4381

Merged

Conversation

mateuszrzeszutek
Copy link
Member

…enter API

Connection spans are not included in this PR, I'll migrate them separately to make those PRs a bit easier to review.

Part of #2713

@@ -139,9 +139,4 @@ class Netty40ClientTest extends HttpClientTest<DefaultFullHttpRequest> implement
boolean testHttps() {
false
}

@Override
boolean testReadTimeout() {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we've switched over to using NetClientAttributesExtractor in netty instrumentations the net.peer.* attributes are no longer captured (channel.remoteAddress() returns null in case of timeout) and this test case fails.
There are no more tests in any instrumentations that enable it - we should verify how other clients behave and, if the lack of net.* attributes is a common thing, change the test scenario to reflect that. I'll create a separate issue for this once this PR gets merged.

Copy link
Contributor

@laurit laurit Oct 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test was added for #3558 I'm sure we have other instrumentations that behave the same way, when there is an error they can't provide all attributes because response isn't available. To me this really doesn't seem ideal. I'd assume that having attributes on errored request might be more useful than having them on successful requests as these are the ones that someone might actually try to inspect. #4287 removed setting net attributes in onStart, would restoring the old behaviour make this test work?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#4287 removed setting net attributes in onStart, would restoring the old behaviour make this test work?

Yep, that should work.

Also, for a broader picture, note that exception & http request attributes are being set, it's only net attributes that are missing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll create a separate issue for this once this PR gets merged.

👍

btw, is the problem that Channel.remoteAddress() returns null in onEnd (while it returns non-null earlier in onStart)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, is the problem that Channel.remoteAddress() returns null in onEnd (while it returns non-null earlier in onStart)?

Yep, it's exactly that. I believe that we can do 2 things to fix that:

  1. change the assertions in the timeout test so that they don't expect net.* attributes - this has a downside of losing some attributes that, as Lauri said, might be incredibly useful on a failing request span;
  2. always capture net.* attributes on start - which would probably force us to re-think the net attributes extractors naming; it is also worth noticing that there were some HTTP clients that reported net* attributes on start, so it could be worth implementing anyway.

I think I'm leaning towards option 2, and just simply reusing the server net attributes extractor in this PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more way would be to capture remote address when it is still available and just use it in onEnd. I suspect that always capturing in onStart isn't good either as clients only know an URI there and resolve an InetSocketAddress later on.

Copy link
Member

@trask trask left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like bringing back that test caught an issue 💯

@trask trask merged commit ac479d4 into open-telemetry:main Oct 16, 2021
@mateuszrzeszutek mateuszrzeszutek deleted the netty-4-client-instrumenter branch October 18, 2021 08:26
RashmiRam pushed a commit to RashmiRam/opentelemetry-auto-instr-java that referenced this pull request May 23, 2022
open-telemetry#4381)

* Migrate Netty 4.x client instrumentations (except CONNECT) to Instrumenter API

* Revert testReadTimeout changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants