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
Add instrumentation for Apache HttpAsyncClient #809
Conversation
8ee0796
to
10c0656
Compare
Extract http client tests to shared class.
10c0656
to
9ad06a6
Compare
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.
Just added a comment that is relevant in my opinion and should be quick to address.
Other than that this looks super good to me.
...java/datadog/trace/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientDecorator.java
Outdated
Show resolved
Hide resolved
...java/datadog/trace/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientDecorator.java
Show resolved
Hide resolved
...java/datadog/trace/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientDecorator.java
Outdated
Show resolved
Hide resolved
7c5658a
to
0d61488
Compare
de00a1b
to
cb2eb87
Compare
Make handling of it more consistent in decorator.
cb2eb87
to
68a68f1
Compare
Making the URI handling consistent took more effort than I expected. Sorry for the big PR. |
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.
Just a few questions but other than that this looks very good to me!
@@ -32,9 +36,39 @@ public Span onRequest(final Span span, final REQUEST request) { | |||
assert span != null; | |||
if (request != null) { | |||
Tags.HTTP_METHOD.set(span, method(request)); | |||
Tags.HTTP_URL.set(span, url(request)); | |||
|
|||
// Copy of HttpServerDecorator url handling |
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.
[Non-blocking] Just created a task for the future as a reminder to remove this code duplication in both classes. This does not represent a blocker for me at the moment, just wanted to keep track of it.
...ava-agent/agent-tooling/src/main/java/datadog/trace/agent/decorator/HttpClientDecorator.java
Show resolved
Hide resolved
@@ -42,23 +43,31 @@ public Span onRequest(final Span span, final REQUEST request) { | |||
if (request != null) { | |||
Tags.HTTP_METHOD.set(span, method(request)); | |||
|
|||
// Copy of HttpClientDecorator url handling |
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.
[Non-blocking] I just noted that we added this here (I thought it already existed). Created a task to remove this code duplication (pairing it with the client class).
Other than dev speed any other reason why we had to duplicate?
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.
Dev speed and I didn’t see an obvious place to put the shared code. Perhaps in a util class?
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 may be a good place. I think that we may need it over and over in our instrumentations.
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.
Part of the reason I put it here is so we hopefully don't need it in all the instrumentation. The child decorators and each instrumentation need just return a URI, then this class should handle the special casing.
@@ -281,7 +275,7 @@ class AwsClientTest extends AgentTestRunner { | |||
childOf(span(0)) | |||
tags { | |||
"$Tags.COMPONENT.key" "apache-httpclient" | |||
"$Tags.HTTP_URL.key" "http://localhost:$server.address.port/someBucket/someKey" | |||
"$Tags.HTTP_URL.key" "$server.address/someBucket/someKey" |
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 potentially may be a breaking change for our users (say they had set an alert or monitor). What is commonly our approach to this?
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 particular line does not represent an actual change in the value. The main change in this PR for some integrations is forcing a path of / instead of empty for the URL.
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.
LGTM! Moving code duplication to a separate class can be done at a later stage. We opened a new task to keep track of it.
Extract http client tests to shared class.