Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ def annotate_span_with_response!(span, response)
def create_request_span_name(request_method, request_path)
if (implementation = config[:span_name_formatter])
updated_span_name = implementation.call(request_method, request_path)
updated_span_name.is_a?(String) ? updated_span_name : "HTTP #{request_method}"
updated_span_name.is_a?(String) ? updated_span_name : request_method.to_s
else
"HTTP #{request_method}"
request_method.to_s
end
rescue StandardError
"HTTP #{request_method}"
request_method.to_s
end

def tracer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def initialize(req, options)
'server.port' => req.uri.port
}.merge!(OpenTelemetry::Common::HTTP::ClientContext.attributes)

tracer.in_span('HTTP CONNECT', attributes: attributes) do
tracer.in_span('CONNECT', attributes: attributes) do
super
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ def annotate_span_with_response!(span, response)
def create_request_span_name(request_method, request_path)
if (implementation = config[:span_name_formatter])
updated_span_name = implementation.call(request_method, request_path)
updated_span_name.is_a?(String) ? updated_span_name : "HTTP #{request_method}"
updated_span_name.is_a?(String) ? updated_span_name : request_method.to_s
else
"HTTP #{request_method}"
request_method.to_s
end
rescue StandardError
"HTTP #{request_method}"
request_method.to_s
end

def tracer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def initialize(req, options)
'server.port' => req.uri.port
}.merge!(OpenTelemetry::Common::HTTP::ClientContext.attributes)

tracer.in_span('HTTP CONNECT', attributes: attributes) do
tracer.in_span('CONNECT', attributes: attributes) do
super
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
it 'traces a simple request' do
HTTP.get('http://example.com/success')
_(exporter.finished_spans.size).must_equal(1)
_(span.name).must_equal 'HTTP GET'
_(span.name).must_equal 'GET'
# Old semantic conventions
_(span.attributes['http.method']).must_equal 'GET'
_(span.attributes['http.scheme']).must_equal 'http'
Expand Down Expand Up @@ -77,7 +77,7 @@
HTTP.post('http://example.com/failure')

_(exporter.finished_spans.size).must_equal 1
_(span.name).must_equal 'HTTP POST'
_(span.name).must_equal 'POST'
# Old semantic conventions
_(span.attributes['http.method']).must_equal 'POST'
_(span.attributes['http.scheme']).must_equal 'http'
Expand Down Expand Up @@ -107,7 +107,7 @@
end.must_raise HTTP::TimeoutError

_(exporter.finished_spans.size).must_equal 1
_(span.name).must_equal 'HTTP GET'
_(span.name).must_equal 'GET'
# Old semantic conventions
_(span.attributes['http.method']).must_equal 'GET'
_(span.attributes['http.scheme']).must_equal 'https'
Expand Down Expand Up @@ -143,7 +143,7 @@
end

_(exporter.finished_spans.size).must_equal 1
_(span.name).must_equal 'HTTP GET'
_(span.name).must_equal 'GET'
# Old semantic conventions
_(span.attributes['http.method']).must_equal 'GET'
_(span.attributes['http.scheme']).must_equal 'http'
Expand Down Expand Up @@ -172,7 +172,7 @@
let(:span_name_formatter) do
# demonstrate simple addition of path and string to span name:
lambda { |request_method, request_path|
"HTTP #{request_method} #{request_path} miniswan"
"#{request_method} #{request_path} miniswan"
}
end

Expand All @@ -182,7 +182,7 @@
end

_(exporter.finished_spans.size).must_equal 1
_(span.name).must_equal 'HTTP GET /success miniswan'
_(span.name).must_equal 'GET /success miniswan'
# Old semantic conventions
_(span.attributes['http.method']).must_equal 'GET'
_(span.attributes['http.scheme']).must_equal 'http'
Expand Down Expand Up @@ -221,7 +221,7 @@
end

_(exporter.finished_spans.size).must_equal 1
_(span.name).must_equal 'HTTP GET'
_(span.name).must_equal 'GET'
# Old semantic conventions
_(span.attributes['http.method']).must_equal 'GET'
_(span.attributes['http.scheme']).must_equal 'http'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
end

_(exporter.finished_spans.size).must_equal(2)
_(span.name).must_equal 'HTTP CONNECT'
_(span.name).must_equal 'CONNECT'
# Old semantic conventions
_(span.attributes['net.peer.name']).must_equal('localhost')
_(span.attributes['net.peer.port']).wont_be_nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
it 'traces a simple request' do
HTTP.get('http://example.com/success')
_(exporter.finished_spans.size).must_equal(1)
_(span.name).must_equal 'HTTP GET'
_(span.name).must_equal 'GET'
_(span.attributes['http.request.method']).must_equal 'GET'
_(span.attributes['url.scheme']).must_equal 'http'
_(span.attributes['http.response.status_code']).must_equal 200
Expand All @@ -69,7 +69,7 @@
HTTP.post('http://example.com/failure')

_(exporter.finished_spans.size).must_equal 1
_(span.name).must_equal 'HTTP POST'
_(span.name).must_equal 'POST'
_(span.attributes['http.request.method']).must_equal 'POST'
_(span.attributes['url.scheme']).must_equal 'http'
_(span.attributes['http.response.status_code']).must_equal 500
Expand All @@ -91,7 +91,7 @@
end.must_raise HTTP::TimeoutError

_(exporter.finished_spans.size).must_equal 1
_(span.name).must_equal 'HTTP GET'
_(span.name).must_equal 'GET'
_(span.attributes['http.request.method']).must_equal 'GET'
_(span.attributes['url.scheme']).must_equal 'https'
_(span.attributes['http.response.status_code']).must_be_nil
Expand Down Expand Up @@ -119,7 +119,7 @@
end

_(exporter.finished_spans.size).must_equal 1
_(span.name).must_equal 'HTTP GET'
_(span.name).must_equal 'GET'
_(span.attributes['http.request.method']).must_equal 'GET'
_(span.attributes['url.scheme']).must_equal 'http'
_(span.attributes['http.response.status_code']).must_equal 200
Expand All @@ -139,7 +139,7 @@
let(:span_name_formatter) do
# demonstrate simple addition of path and string to span name:
lambda { |request_method, request_path|
"HTTP #{request_method} #{request_path} miniswan"
"#{request_method} #{request_path} miniswan"
}
end

Expand All @@ -149,7 +149,7 @@
end

_(exporter.finished_spans.size).must_equal 1
_(span.name).must_equal 'HTTP GET /success miniswan'
_(span.name).must_equal 'GET /success miniswan'
_(span.attributes['http.request.method']).must_equal 'GET'
_(span.attributes['url.scheme']).must_equal 'http'
_(span.attributes['http.response.status_code']).must_equal 200
Expand Down Expand Up @@ -179,7 +179,7 @@
end

_(exporter.finished_spans.size).must_equal 1
_(span.name).must_equal 'HTTP GET'
_(span.name).must_equal 'GET'
_(span.attributes['http.request.method']).must_equal 'GET'
_(span.attributes['url.scheme']).must_equal 'http'
_(span.attributes['http.response.status_code']).must_equal 200
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
end

_(exporter.finished_spans.size).must_equal(2)
_(span.name).must_equal 'HTTP CONNECT'
_(span.name).must_equal 'CONNECT'
_(span.attributes['server.address']).must_equal('localhost')
_(span.attributes['server.port']).wont_be_nil
ensure
Expand Down