Skip to content

Add sentry_trace connection example#1444

Merged
st0012 merged 1 commit into
masterfrom
add-sentry-trace-example
May 20, 2021
Merged

Add sentry_trace connection example#1444
st0012 merged 1 commit into
masterfrom
add-sentry-trace-example

Conversation

@st0012

@st0012 st0012 commented May 14, 2021

Copy link
Copy Markdown
Contributor
  • Parent: sentry-rails' example app
  • Child: sentry-ruby's sinatra example

Usage:

  1. $ cd sentry-rails/examples/rails-6.0
  2. $ bundle exec rails s
  3. $ cd sentry-ruby/examples/sinatra
  4. $ bundle exec ruby app.rb
  5. Visit http://localhost:3000/connect_trace in browser

connect sentry trace

- Parent: sentry-rails' example app
- Child: sentry-ruby's sinatra example

Usage:

1. `$ cd sentry-rails/examples/rails-6.0`
2. `$ bundle exec rails s`
3. `$ cd sentry-ruby/examples/sinatra`
4. `$ bundle exec ruby app.rb`
5. Visit `http://localhost:3000/connect_trace` in browser

@rhcarvalho rhcarvalho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the example!

uri = URI("http://localhost:4567/connect_trace")
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Get.new(uri.request_uri)
request["SENTRY_TRACE"] = transaction.to_sentry_trace

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@st0012 if this line is required, then it explains the current difficulty in #1411 as this would be a required manual step for trace propagation.

We try to make HTTP clients automatically propagate traces with auto instrumentation, perhaps that's missing in Ruby?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not aware of this requirement in the backend SDK 🤔 can you point me the implementation in sentry-python and sentry-go?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@rhcarvalho I see, thanks. I'll merge this PR now and then implemented the propagation. after that's done I'll update the example again.

@codecov-commenter

codecov-commenter commented May 17, 2021

Copy link
Copy Markdown

Codecov Report

Merging #1444 (3fc4545) into master (e56b1f1) will increase coverage by 0.61%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1444      +/-   ##
==========================================
+ Coverage   98.22%   98.83%   +0.61%     
==========================================
  Files         213      118      -95     
  Lines       10034     6197    -3837     
==========================================
- Hits         9856     6125    -3731     
+ Misses        178       72     -106     
Impacted Files Coverage Δ
...try-raven/lib/sentry-raven-without-integrations.rb
sentry-raven/lib/raven/integrations/rails.rb
...-raven/spec/raven/integrations/delayed_job_spec.rb
sentry-raven/lib/raven/client.rb
...b/raven/integrations/sidekiq/cleanup_middleware.rb
...ntry-raven/lib/raven/core_ext/object/duplicable.rb
...ven/breadcrumbs/active_support_breadcrumbs_spec.rb
sentry-raven/spec/raven/cli_spec.rb
sentry-raven/spec/raven/instance_spec.rb
...ry-raven/spec/raven/interfaces/stack_trace_spec.rb
... and 85 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 e56b1f1...3fc4545. Read the comment docs.

@st0012
st0012 merged commit 5ce32c1 into master May 20, 2021
@st0012
st0012 deleted the add-sentry-trace-example branch May 20, 2021 07:05
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.

3 participants