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

Add instrumentation for Apache HttpAsyncClient #809

Merged
merged 3 commits into from Apr 29, 2019

Conversation

tylerbenson
Copy link
Contributor

Extract http client tests to shared class.

@tylerbenson tylerbenson added the inst: others All other instrumentations label Apr 23, 2019
@tylerbenson tylerbenson added this to the 0.27.0 milestone Apr 23, 2019
@tylerbenson tylerbenson force-pushed the tyler/httpasyncclient branch 2 times, most recently from 8ee0796 to 10c0656 Compare April 23, 2019 23:22
Extract http client tests to shared class.
Copy link
Member

@labbati labbati left a 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.

@tylerbenson tylerbenson force-pushed the tyler/httpasyncclient branch 3 times, most recently from de00a1b to cb2eb87 Compare April 26, 2019 16:46
Make handling of it more consistent in decorator.
@tylerbenson
Copy link
Contributor Author

Making the URI handling consistent took more effort than I expected. Sorry for the big PR.

Copy link
Member

@labbati labbati left a 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
Copy link
Member

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.

@@ -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
Copy link
Member

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?

Copy link
Contributor Author

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?

Copy link
Member

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.

Copy link
Contributor Author

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"
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

@labbati labbati left a 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.

@tylerbenson tylerbenson merged commit 25d1097 into master Apr 29, 2019
@tylerbenson tylerbenson deleted the tyler/httpasyncclient branch April 29, 2019 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inst: others All other instrumentations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants