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

Integrate with httpclient #1311

Merged
merged 1 commit into from
Jan 20, 2021
Merged

Conversation

agrobbin
Copy link
Contributor

@agrobbin agrobbin commented Jan 16, 2021

This is my first dd-trace-rb contribution, so please let me know if I've missed anything!

  • show a sample trace (will add as soon as I see tests pass here and I can test it in our application)

httpclient is the underlying transport framework used by google-api-ruby-client, and it'd be great to have it instrumented by Datadog like the other libraries it already supports. This is based on #853, when http.rb integration was added. I've implemented this in a very similar way as other HTTP client libraries that don't offer an official integration feature (i.e. a middleware stack).

@agrobbin agrobbin requested a review from a team January 16, 2021 04:09
@codecov-io
Copy link

codecov-io commented Jan 16, 2021

Codecov Report

Merging #1311 (2ce6a09) into master (a770176) will decrease coverage by 0.01%.
The diff coverage is 97.64%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1311      +/-   ##
==========================================
- Coverage   98.13%   98.12%   -0.02%     
==========================================
  Files         752      759       +7     
  Lines       35783    36120     +337     
==========================================
+ Hits        35117    35444     +327     
- Misses        666      676      +10     
Impacted Files Coverage Δ
lib/ddtrace/ext/git.rb 100.00% <ø> (ø)
lib/ddtrace/contrib/httpclient/patcher.rb 88.23% <88.23%> (ø)
lib/ddtrace/contrib/httpclient/instrumentation.rb 92.68% <92.68%> (ø)
lib/ddtrace.rb 100.00% <100.00%> (ø)
...trace/contrib/httpclient/configuration/settings.rb 100.00% <100.00%> (ø)
lib/ddtrace/contrib/httpclient/ext.rb 100.00% <100.00%> (ø)
lib/ddtrace/contrib/httpclient/integration.rb 100.00% <100.00%> (ø)
lib/ddtrace/ext/ci.rb 98.33% <100.00%> (+0.01%) ⬆️
...ddtrace/contrib/httpclient/instrumentation_spec.rb 100.00% <100.00%> (ø)
...pec/ddtrace/contrib/httpclient/integration_spec.rb 100.00% <100.00%> (ø)
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dba4c21...2ce6a09. Read the comment docs.

marcotc
marcotc previously approved these changes Jan 19, 2021
Copy link
Member

@marcotc marcotc left a comment

Choose a reason for hiding this comment

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

Thank you so much for your contribution, @agrobbin.
Everything looks great already!

If you are able to test these changes internally in your application it would give us a lot of confidence that the value it provides is what users (like yourself) want from httpclient.

Let me know if any progress with using it yourself, or if you are unable to.

Again, awesome stuff! 🎉

I've implemented this in a very similar way as other HTTP client libraries that don't offer an official integration feature (i.e. a middleware stack).
@agrobbin
Copy link
Contributor Author

Thanks @marcotc! I've was able to get this out into our staging environment (which is instrumented by Datadog), and here is the first trace from this new integration:

Screen Shot 2021-01-19 at 6 47 10 PM

I've hidden a few bits of information that could be considered sensitive to our application, but tried to showcase as much information as possible.

At first glance, this looks correct, but I'd love to get your 👀 on it to be sure!

@djlmills
Copy link

@agrobbin Thanks for tackling this. We are also using google-api-ruby-client and this integration is exactly what I was looking for (and contemplating building).

@agrobbin
Copy link
Contributor Author

My pleasure @djlmills! It does seem like google-api-ruby-client is planning to move from httpclient to Faraday (googleapis/google-api-ruby-client#2348), but I'm sure that won't happen overnight, so this is definitely going to be valuable!

Copy link
Member

@marcotc marcotc left a comment

Choose a reason for hiding this comment

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

Thank you again, @agrobbin!

Even if Google is moving away from httpclient, the gem still has almost 100 million downloads of its latest version (admittedly likely due to Google's API).

@marcotc marcotc merged commit 7c680ee into DataDog:master Jan 20, 2021
@marcotc marcotc added community Was opened by a community member feature Involves a product feature integrations Involves tracing integrations labels Jan 20, 2021
@github-actions github-actions bot added this to the 0.45.0 milestone Jan 20, 2021
@marcotc
Copy link
Member

marcotc commented Jan 27, 2021

👋 @agrobbin and @djlmills, we've just released v0.45.0, which includes this PR.

Please let us know if you have any further feedback on this feature!

@agrobbin agrobbin deleted the httpclient-integration branch December 3, 2023 03:18
@agrobbin agrobbin restored the httpclient-integration branch December 3, 2023 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Was opened by a community member feature Involves a product feature integrations Involves tracing integrations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants