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

Fix skipping 'connect' spans #2364

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
- Closes [#1795](https://github.com/getsentry/sentry-ruby/issues/1795)
- Please note that the Faraday instrumentation has some limitations in case of async requests: https://github.com/lostisland/faraday/issues/1381

### Bug Fixes

- Fix skipping `connect` spans in open-telemetry [#2364](https://github.com/getsentry/sentry-ruby/pull/2364)

## 5.18.2

### Bug Fixes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def from_sentry_sdk?(otel_span)
dsn = Sentry.configuration.dsn
return false unless dsn

if otel_span.name.start_with?("HTTP")
if otel_span.name.start_with?("HTTP") || otel_span.name == "connect"
# only check client requests, connects are sometimes internal
return false unless INTERNAL_SPAN_KINDS.include?(otel_span.kind)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@
tracer.start_span('HTTP POST', with_parent: root_parent_context, attributes: attributes, kind: :client)
end

let(:child_internal_span_connect) do
attributes = {
'http.method' => 'POST',
'http.scheme' => 'https',
'http.target' => '/api/5434472/envelope/',
'net.peer.name' => 'sentry.localdomain',
'net.peer.port' => 443
}

tracer.start_span('connect', with_parent: root_parent_context, attributes: attributes, kind: :internal)
end

before do
perform_basic_setup
perform_otel_setup
Expand Down Expand Up @@ -153,6 +165,11 @@
subject.on_start(child_internal_span, root_parent_context)
end

it 'noops on `connect` requests' do
expect(transaction).not_to receive(:start_child)
subject.on_start(child_internal_span_connect, root_parent_context)
end

it 'starts a sentry child span on otel child span' do
expect(transaction).to receive(:start_child).and_call_original
subject.on_start(child_db_span, root_parent_context)
Expand Down
Loading