Skip to content

Commit 0088dce

Browse files
committed
feat: update span name
1 parent fdb03e1 commit 0088dce

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

instrumentation/excon/lib/opentelemetry/instrumentation/excon/middlewares/dup/tracer_middleware.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class TracerMiddleware < ::Excon::Middleware::Base
1919
end.freeze
2020

2121
HTTP_METHODS_TO_SPAN_NAMES = HTTP_METHODS_TO_UPPERCASE.values.each_with_object({}) do |uppercase_method, hash|
22-
hash[uppercase_method] ||= "HTTP #{uppercase_method}"
22+
hash[uppercase_method] ||= uppercase_method
2323
end.freeze
2424

2525
# Constant for the HTTP status range

instrumentation/excon/lib/opentelemetry/instrumentation/excon/middlewares/stable/tracer_middleware.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class TracerMiddleware < ::Excon::Middleware::Base
1919
end.freeze
2020

2121
HTTP_METHODS_TO_SPAN_NAMES = HTTP_METHODS_TO_UPPERCASE.values.each_with_object({}) do |uppercase_method, hash|
22-
hash[uppercase_method] ||= "HTTP #{uppercase_method}"
22+
hash[uppercase_method] ||= uppercase_method
2323
end.freeze
2424

2525
# Constant for the HTTP status range

instrumentation/excon/lib/opentelemetry/instrumentation/excon/patches/dup/socket.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def connect
3232
}.merge!(OpenTelemetry::Common::HTTP::ClientContext.attributes)
3333

3434
if is_a?(::Excon::SSLSocket) && @data[:proxy]
35-
span_name = 'HTTP CONNECT'
35+
span_name = 'CONNECT'
3636
span_kind = :client
3737
else
3838
span_name = 'connect'

instrumentation/excon/lib/opentelemetry/instrumentation/excon/patches/stable/socket.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def connect
2727
attributes = { 'server.address' => conn_address, 'server.port' => conn_port }.merge!(OpenTelemetry::Common::HTTP::ClientContext.attributes)
2828

2929
if is_a?(::Excon::SSLSocket) && @data[:proxy]
30-
span_name = 'HTTP CONNECT'
30+
span_name = 'CONNECT'
3131
span_kind = :client
3232
else
3333
span_name = 'connect'

instrumentation/excon/test/opentelemetry/instrumentation/excon/dup/instrumentation_test.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
Excon.get('http://example.com/success')
5252

5353
_(exporter.finished_spans.size).must_equal 1
54-
_(span.name).must_equal 'HTTP GET'
54+
_(span.name).must_equal 'GET'
5555
_(span.attributes['http.host']).must_equal 'example.com'
5656
_(span.attributes['http.method']).must_equal 'GET'
5757
_(span.attributes['http.scheme']).must_equal 'http'
@@ -82,7 +82,7 @@
8282
Excon.get('http://example.com/failure')
8383

8484
_(exporter.finished_spans.size).must_equal 1
85-
_(span.name).must_equal 'HTTP GET'
85+
_(span.name).must_equal 'GET'
8686
_(span.attributes['http.host']).must_equal 'example.com'
8787
_(span.attributes['http.method']).must_equal 'GET'
8888
_(span.attributes['http.scheme']).must_equal 'http'
@@ -109,7 +109,7 @@
109109
end.must_raise Excon::Error::Timeout
110110

111111
_(exporter.finished_spans.size).must_equal 1
112-
_(span.name).must_equal 'HTTP GET'
112+
_(span.name).must_equal 'GET'
113113
_(span.attributes['http.host']).must_equal 'example.com'
114114
_(span.attributes['http.method']).must_equal 'GET'
115115
_(span.attributes['http.scheme']).must_equal 'http'
@@ -145,7 +145,7 @@
145145
end
146146

147147
_(exporter.finished_spans.size).must_equal 1
148-
_(span.name).must_equal 'HTTP GET'
148+
_(span.name).must_equal 'GET'
149149
_(span.attributes['http.host']).must_equal 'example.com'
150150
_(span.attributes['http.method']).must_equal 'OVERRIDE'
151151
_(span.attributes['http.scheme']).must_equal 'http'
@@ -232,7 +232,7 @@
232232
Excon.get('http://example.com/body')
233233

234234
_(exporter.finished_spans.size).must_equal 1
235-
_(span.name).must_equal 'HTTP GET'
235+
_(span.name).must_equal 'GET'
236236
_(span.attributes['http.host']).must_equal 'example.com'
237237
_(span.attributes['http.method']).must_equal 'GET'
238238
_(span.attributes['http.request.method']).must_equal 'GET'
@@ -330,7 +330,7 @@
330330
_(-> { Excon.get('https://localhost/', proxy: 'https://proxy_user:proxy_pass@localhost') }).must_raise(Excon::Error::Socket)
331331

332332
_(exporter.finished_spans.size).must_equal(3)
333-
_(span.name).must_equal 'HTTP CONNECT'
333+
_(span.name).must_equal 'CONNECT'
334334
_(span.kind).must_equal(:client)
335335
_(span.attributes['net.peer.name']).must_equal('localhost')
336336
_(span.attributes['net.peer.port']).must_equal(443)
@@ -367,7 +367,7 @@
367367

368368
def assert_http_spans(scheme: 'http', host: 'localhost', port: nil, target: '/', exception: nil)
369369
exporter.finished_spans[1..].each do |http_span|
370-
_(http_span.name).must_equal 'HTTP GET'
370+
_(http_span.name).must_equal 'GET'
371371
_(http_span.attributes['http.host']).must_equal host
372372
_(http_span.attributes['http.method']).must_equal 'GET'
373373
_(http_span.attributes['http.scheme']).must_equal scheme

instrumentation/excon/test/opentelemetry/instrumentation/excon/stable/instrumentation_test.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
Excon.get('http://example.com/success')
5252

5353
_(exporter.finished_spans.size).must_equal 1
54-
_(span.name).must_equal 'HTTP GET'
54+
_(span.name).must_equal 'GET'
5555
_(span.attributes['http.host']).must_equal 'example.com'
5656
_(span.attributes['http.request.method']).must_equal 'GET'
5757
_(span.attributes['url.scheme']).must_equal 'http'
@@ -76,7 +76,7 @@
7676
Excon.get('http://example.com/failure')
7777

7878
_(exporter.finished_spans.size).must_equal 1
79-
_(span.name).must_equal 'HTTP GET'
79+
_(span.name).must_equal 'GET'
8080
_(span.attributes['http.host']).must_equal 'example.com'
8181
_(span.attributes['http.request.method']).must_equal 'GET'
8282
_(span.attributes['url.scheme']).must_equal 'http'
@@ -97,7 +97,7 @@
9797
end.must_raise Excon::Error::Timeout
9898

9999
_(exporter.finished_spans.size).must_equal 1
100-
_(span.name).must_equal 'HTTP GET'
100+
_(span.name).must_equal 'GET'
101101
_(span.attributes['http.host']).must_equal 'example.com'
102102
_(span.attributes['http.request.method']).must_equal 'GET'
103103
_(span.attributes['url.scheme']).must_equal 'http'
@@ -128,7 +128,7 @@
128128
end
129129

130130
_(exporter.finished_spans.size).must_equal 1
131-
_(span.name).must_equal 'HTTP GET'
131+
_(span.name).must_equal 'GET'
132132
_(span.attributes['http.host']).must_equal 'example.com'
133133
_(span.attributes['http.request.method']).must_equal 'OVERRIDE'
134134
_(span.attributes['url.scheme']).must_equal 'http'
@@ -209,7 +209,7 @@
209209
Excon.get('http://example.com/body')
210210

211211
_(exporter.finished_spans.size).must_equal 1
212-
_(span.name).must_equal 'HTTP GET'
212+
_(span.name).must_equal 'GET'
213213
_(span.attributes['http.host']).must_equal 'example.com'
214214
_(span.attributes['http.request.method']).must_equal 'GET'
215215
end
@@ -294,7 +294,7 @@
294294
_(-> { Excon.get('https://localhost/', proxy: 'https://proxy_user:proxy_pass@localhost') }).must_raise(Excon::Error::Socket)
295295

296296
_(exporter.finished_spans.size).must_equal(3)
297-
_(span.name).must_equal 'HTTP CONNECT'
297+
_(span.name).must_equal 'CONNECT'
298298
_(span.kind).must_equal(:client)
299299
_(span.attributes['server.address']).must_equal('localhost')
300300
_(span.attributes['server.port']).must_equal(443)
@@ -325,7 +325,7 @@
325325

326326
def assert_http_spans(scheme: 'http', host: 'localhost', port: nil, target: '/', exception: nil)
327327
exporter.finished_spans[1..].each do |http_span|
328-
_(http_span.name).must_equal 'HTTP GET'
328+
_(http_span.name).must_equal 'GET'
329329
_(http_span.attributes['http.host']).must_equal host
330330
_(http_span.attributes['http.request.method']).must_equal 'GET'
331331
_(http_span.attributes['url.scheme']).must_equal scheme

0 commit comments

Comments
 (0)