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

Support for tracing Faraday requests #2345

Merged

Conversation

solnic
Copy link
Collaborator

@solnic solnic commented Jul 18, 2024

This adds support for automatic tracing of HTTP requests when using Faraday. It leverages its instrumentation middleware to do the magic.

Screenshot 2024-07-25 at 12 52 21

Todo

  • Figure out how to use the instrumentation middleware
  • Add a Sentry middleware that will set everything up turned out we needed a monkeypatch after all
  • Figure out how to enable the integration automatically
  • Cover the same cases that are specified by the net/http_spec
  • (optional/stretch) unify implementation between net/http MP and faraday extension if we decide to do it, it should go to a separate PR
  • Figure out what to do with the default net/http patch

Closes #1795

@solnic solnic added the wip label Jul 18, 2024
@solnic solnic linked an issue Jul 18, 2024 that may be closed by this pull request
Copy link

codecov bot commented Jul 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.68%. Comparing base (94a8063) to head (c7bfc1d).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2345      +/-   ##
==========================================
+ Coverage   98.66%   98.68%   +0.01%     
==========================================
  Files         205      207       +2     
  Lines       13559    13741     +182     
==========================================
+ Hits        13378    13560     +182     
  Misses        181      181              
Components Coverage Δ
sentry-ruby 99.04% <100.00%> (+0.01%) ⬆️
sentry-rails 97.41% <ø> (ø)
sentry-sidekiq 97.01% <ø> (ø)
sentry-resque 96.79% <ø> (ø)
sentry-delayed_job 98.92% <ø> (ø)
sentry-opentelemetry 100.00% <ø> (ø)
Files Coverage Δ
sentry-ruby/lib/sentry-ruby.rb 96.66% <100.00%> (+0.01%) ⬆️
sentry-ruby/lib/sentry/faraday.rb 100.00% <100.00%> (ø)
sentry-ruby/spec/sentry/faraday_spec.rb 100.00% <100.00%> (ø)

@sl0thentr0py
Copy link
Member

sl0thentr0py commented Jul 18, 2024

looks great so far!

as you noted in the description, you need to further

sentry-ruby/CHANGELOG.md Outdated Show resolved Hide resolved
@solnic solnic force-pushed the solnic/1795-add-tracing-support-for-faraday-requests branch 2 times, most recently from bab2bac to 295cf2e Compare July 23, 2024 12:59
@solnic
Copy link
Collaborator Author

solnic commented Jul 23, 2024

@sl0thentr0py http patch is one of the default ones, which means we should skip setting up faraday patch if its adapter is net/http - does this make sense?

@sl0thentr0py
Copy link
Member

@solnic yes please!

@solnic solnic requested a review from sl0thentr0py July 24, 2024 07:38
@solnic solnic force-pushed the solnic/1795-add-tracing-support-for-faraday-requests branch 3 times, most recently from fe10b09 to 14e3e1d Compare July 25, 2024 10:12
@solnic solnic force-pushed the solnic/1795-add-tracing-support-for-faraday-requests branch from 14e3e1d to 037e5cf Compare July 25, 2024 10:16
@solnic solnic added enhancement and removed wip labels Jul 25, 2024
@solnic solnic marked this pull request as ready for review July 25, 2024 10:26
Copy link
Member

@sl0thentr0py sl0thentr0py left a comment

Choose a reason for hiding this comment

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

great first PR @solnic!
just a few nits and comments

sentry-ruby/lib/sentry/faraday.rb Outdated Show resolved Hide resolved
sentry-ruby/lib/sentry/faraday.rb Show resolved Hide resolved
sentry-ruby/lib/sentry/faraday.rb Outdated Show resolved Hide resolved
sentry-ruby/spec/sentry/faraday_spec.rb Show resolved Hide resolved
@solnic solnic requested a review from sl0thentr0py July 26, 2024 05:42
Copy link
Member

@sl0thentr0py sl0thentr0py left a comment

Choose a reason for hiding this comment

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

perfect, ty and grats on landing your first PR!

@sl0thentr0py sl0thentr0py merged commit 09f348e into master Jul 26, 2024
126 checks passed
@sl0thentr0py sl0thentr0py deleted the solnic/1795-add-tracing-support-for-faraday-requests branch July 26, 2024 11:07
@solnic
Copy link
Collaborator Author

solnic commented Jul 26, 2024

Ahh yes! Thanks for the reviews!

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

Successfully merging this pull request may close these issues.

Add tracing support for faraday requests
2 participants