Skip to content
Open
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Unreleased

### Bug Fixes

- HTTP client spans now include status based on `http.request.method` ([#2650](https://github.com/getsentry/sentry-ruby/pull/2650))

## 5.25.0

### Features
Expand Down
2 changes: 1 addition & 1 deletion sentry-ruby/lib/sentry/utils/http_tracing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def set_span_info(sentry_span, request_info, response_status)
sentry_span.set_data(Span::DataConventions::URL, request_info[:url])
sentry_span.set_data(Span::DataConventions::HTTP_METHOD, request_info[:method])
sentry_span.set_data(Span::DataConventions::HTTP_QUERY, request_info[:query]) if request_info[:query]
sentry_span.set_data(Span::DataConventions::HTTP_STATUS_CODE, response_status)
sentry_span.set_http_status(response_status)
end

def set_propagation_headers(req)
Expand Down
5 changes: 5 additions & 0 deletions sentry-ruby/spec/sentry/net/http_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
expect(request_span.data).to eq(
{ "url" => "http://[::1]/path", "http.request.method" => "GET", "http.response.status_code" => 200 }
)
expect(request_span.status).to eq("ok")
end
end

Expand Down Expand Up @@ -68,6 +69,7 @@
"http.request.method" => "GET",
"http.query" => "foo=bar"
})
expect(request_span.status).to eq("ok")
end
end

Expand Down Expand Up @@ -99,6 +101,7 @@
"url" => "http://example.com/path",
"http.request.method" => "GET"
})
expect(request_span.status).to eq("ok")
end
end

Expand Down Expand Up @@ -342,6 +345,7 @@ def verify_spans(transaction)
"url" => "http://example.com/path",
"http.request.method" => "GET"
})
expect(request_span.status).to eq("ok")

request_span = transaction.span_recorder.spans[2]
expect(request_span.op).to eq("http.client")
Expand All @@ -355,6 +359,7 @@ def verify_spans(transaction)
"url" => "http://example.com/path",
"http.request.method" => "GET"
})
expect(request_span.status).to eq("not_found")
end

it "doesn't mess different requests' data together" do
Expand Down
Loading