Skip to content

Commit 0009ea6

Browse files
dmathieumwear
andauthored
remove component attribute from all adapters (#265)
See open-telemetry/opentelemetry-specification#447 Adapters will later be able to specify what instrumentation library they are, and the exporters can then log this however they want: #264 Co-authored-by: Matthew Wear <[email protected]>
1 parent 2976399 commit 0009ea6

File tree

16 files changed

+1
-32
lines changed

16 files changed

+1
-32
lines changed

adapters/ethon/lib/opentelemetry/adapters/ethon/patches/easy.rb

-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ def otel_before_request
7171
@otel_span = tracer.start_span(
7272
HTTP_METHODS_TO_SPAN_NAMES[method],
7373
attributes: {
74-
'component' => 'http',
7574
'http.method' => method,
7675
'http.url' => url
7776
},

adapters/ethon/test/opentelemetry/adapters/ethon/adapter_test.rb

-4
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171
easy.perform
7272

7373
_(span.name).must_equal 'HTTP N/A'
74-
_(span.attributes['component']).must_equal 'http'
7574
_(span.attributes['http.method']).must_equal 'N/A'
7675
_(span.attributes['http.status_code']).must_be_nil
7776
_(span.attributes['http.url']).must_equal 'http://example.com/test'
@@ -94,7 +93,6 @@ def stub_response(options)
9493
it 'when response is successful' do
9594
stub_response(response_code: 200) do
9695
_(span.name).must_equal 'HTTP N/A'
97-
_(span.attributes['component']).must_equal 'http'
9896
_(span.attributes['http.method']).must_equal 'N/A'
9997
_(span.attributes['http.status_code']).must_equal 200
10098
_(span.attributes['http.url']).must_equal 'http://example.com/test'
@@ -108,7 +106,6 @@ def stub_response(options)
108106
it 'when response is not successful' do
109107
stub_response(response_code: 500) do
110108
_(span.name).must_equal 'HTTP N/A'
111-
_(span.attributes['component']).must_equal 'http'
112109
_(span.attributes['http.method']).must_equal 'N/A'
113110
_(span.attributes['http.status_code']).must_equal 500
114111
_(span.attributes['http.url']).must_equal 'http://example.com/test'
@@ -122,7 +119,6 @@ def stub_response(options)
122119
it 'when request times out' do
123120
stub_response(response_code: 0, return_code: :operation_timedout) do
124121
_(span.name).must_equal 'HTTP N/A'
125-
_(span.attributes['component']).must_equal 'http'
126122
_(span.attributes['http.method']).must_equal 'N/A'
127123
_(span.attributes['http.status_code']).must_be_nil
128124
_(span.attributes['http.url']).must_equal 'http://example.com/test'

adapters/excon/lib/opentelemetry/adapters/excon/middlewares/tracer_middleware.rb

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ def request_call(datum) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
3030
tracer.start_span(
3131
"HTTP #{http_method}",
3232
attributes: {
33-
'component' => 'http',
3433
'http.host' => datum[:host],
3534
'http.method' => http_method,
3635
'http.scheme' => datum[:scheme],

adapters/excon/test/opentelemetry/adapters/excon/adapter_test.rb

-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050

5151
_(exporter.finished_spans.size).must_equal 1
5252
_(span.name).must_equal 'HTTP GET'
53-
_(span.attributes['component']).must_equal 'http'
5453
_(span.attributes['http.method']).must_equal 'GET'
5554
_(span.attributes['http.status_code']).must_equal 200
5655
_(span.attributes['http.scheme']).must_equal 'http'
@@ -68,7 +67,6 @@
6867

6968
_(exporter.finished_spans.size).must_equal 1
7069
_(span.name).must_equal 'HTTP GET'
71-
_(span.attributes['component']).must_equal 'http'
7270
_(span.attributes['http.method']).must_equal 'GET'
7371
_(span.attributes['http.status_code']).must_equal 500
7472
_(span.attributes['http.scheme']).must_equal 'http'
@@ -88,7 +86,6 @@
8886

8987
_(exporter.finished_spans.size).must_equal 1
9088
_(span.name).must_equal 'HTTP GET'
91-
_(span.attributes['component']).must_equal 'http'
9289
_(span.attributes['http.method']).must_equal 'GET'
9390
_(span.attributes['http.scheme']).must_equal 'http'
9491
_(span.attributes['http.host']).must_equal 'example.com'

adapters/faraday/lib/opentelemetry/adapters/faraday/middlewares/tracer_middleware.rb

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def call(env)
2929
tracer.in_span(
3030
"HTTP #{http_method}",
3131
attributes: {
32-
'component' => 'http',
3332
'http.method' => http_method,
3433
'http.url' => env.url.to_s
3534
},

adapters/faraday/test/opentelemetry/adapters/faraday/middlewares/tracer_middleware_test.rb

-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
response = client.get('/success')
5151

5252
_(span.name).must_equal 'HTTP GET'
53-
_(span.attributes['component']).must_equal 'http'
5453
_(span.attributes['http.method']).must_equal 'GET'
5554
_(span.attributes['http.status_code']).must_equal 200
5655
_(span.attributes['http.url']).must_equal 'http://example.com/success'
@@ -63,7 +62,6 @@
6362
response = client.get('/not_found')
6463

6564
_(span.name).must_equal 'HTTP GET'
66-
_(span.attributes['component']).must_equal 'http'
6765
_(span.attributes['http.method']).must_equal 'GET'
6866
_(span.attributes['http.status_code']).must_equal 404
6967
_(span.attributes['http.url']).must_equal 'http://example.com/not_found'
@@ -76,7 +74,6 @@
7674
response = client.get('/failure')
7775

7876
_(span.name).must_equal 'HTTP GET'
79-
_(span.attributes['component']).must_equal 'http'
8077
_(span.attributes['http.method']).must_equal 'GET'
8178
_(span.attributes['http.status_code']).must_equal 500
8279
_(span.attributes['http.url']).must_equal 'http://example.com/failure'

adapters/net_http/lib/opentelemetry/adapters/net/http/patches/instrumentation.rb

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ def request(req, body = nil, &block)
2121
tracer.in_span(
2222
HTTP_METHODS_TO_SPAN_NAMES[req.method],
2323
attributes: {
24-
'component' => 'http',
2524
'http.method' => req.method,
2625
'http.scheme' => USE_SSL_TO_SCHEME[use_ssl?],
2726
'http.target' => req.path,

adapters/net_http/test/opentelemetry/adapters/net/http/adapter_test.rb

-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050

5151
_(exporter.finished_spans.size).must_equal 1
5252
_(span.name).must_equal 'HTTP GET'
53-
_(span.attributes['component']).must_equal 'http'
5453
_(span.attributes['http.method']).must_equal 'GET'
5554
_(span.attributes['http.scheme']).must_equal 'http'
5655
_(span.attributes['http.status_code']).must_equal 200
@@ -69,7 +68,6 @@
6968

7069
_(exporter.finished_spans.size).must_equal 1
7170
_(span.name).must_equal 'HTTP POST'
72-
_(span.attributes['component']).must_equal 'http'
7371
_(span.attributes['http.method']).must_equal 'POST'
7472
_(span.attributes['http.scheme']).must_equal 'http'
7573
_(span.attributes['http.status_code']).must_equal 500
@@ -90,7 +88,6 @@
9088

9189
_(exporter.finished_spans.size).must_equal 1
9290
_(span.name).must_equal 'HTTP GET'
93-
_(span.attributes['component']).must_equal 'http'
9491
_(span.attributes['http.method']).must_equal 'GET'
9592
_(span.attributes['http.scheme']).must_equal 'https'
9693
_(span.attributes['http.status_code']).must_be_nil

adapters/rack/lib/opentelemetry/adapters/rack/middlewares/tracer_middleware.rb

-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ def create_frontend_span(env, extracted_context)
8383
span = tracer.start_span('http_server.proxy',
8484
with_parent_context: extracted_context,
8585
attributes: {
86-
'component' => 'http',
8786
'start_time' => request_start_time.to_f
8887
},
8988
kind: :server)
@@ -105,7 +104,6 @@ def tracer
105104

106105
def request_span_attributes(env:)
107106
{
108-
'component' => 'http',
109107
'http.method' => env['REQUEST_METHOD'],
110108
'http.host' => env['HTTP_HOST'] || 'unknown',
111109
'http.scheme' => env['rack.url_scheme'],

adapters/rack/test/opentelemetry/adapters/rack/middlewares/tracer_middleware_test.rb

-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
end
5858

5959
it 'records attributes' do
60-
_(first_span.attributes['component']).must_equal 'http'
6160
_(first_span.attributes['http.method']).must_equal 'GET'
6261
_(first_span.attributes['http.status_code']).must_equal 200
6362
_(first_span.attributes['http.status_text']).must_equal 'OK'

adapters/redis/lib/opentelemetry/adapters/redis/patches/client.rb

-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ def client_attributes
4949
port = options[:port]
5050

5151
{
52-
'component' => 'redis',
5352
'db.type' => 'redis',
5453
'db.instance' => options[:db].to_s,
5554
'db.url' => "redis://#{host}:#{port}",

adapters/redis/test/opentelemetry/adapters/redis/adapter_test.rb

-5
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
::Redis.new.auth('password')
3737

3838
_(span.name).must_equal 'AUTH'
39-
_(span.attributes['component']).must_equal 'redis'
4039
_(span.attributes['db.type']).must_equal 'redis'
4140
_(span.attributes['db.instance']).must_equal '0'
4241
_(span.attributes['db.statement']).must_equal 'AUTH ?'
@@ -54,7 +53,6 @@
5453

5554
set_span = exporter.finished_spans.first
5655
_(set_span.name).must_equal 'SET'
57-
_(set_span.attributes['component']).must_equal 'redis'
5856
_(set_span.attributes['db.type']).must_equal 'redis'
5957
_(set_span.attributes['db.instance']).must_equal '0'
6058
_(set_span.attributes['db.statement']).must_equal(
@@ -66,7 +64,6 @@
6664

6765
get_span = exporter.finished_spans.last
6866
_(get_span.name).must_equal 'GET'
69-
_(get_span.attributes['component']).must_equal 'redis'
7067
_(get_span.attributes['db.type']).must_equal 'redis'
7168
_(get_span.attributes['db.instance']).must_equal '0'
7269
_(get_span.attributes['db.statement']).must_equal 'GET K'
@@ -82,7 +79,6 @@
8279

8380
_(exporter.finished_spans.size).must_equal 1
8481
_(span.name).must_equal 'THIS_IS_NOT_A_REDIS_FUNC'
85-
_(span.attributes['component']).must_equal 'redis'
8682
_(span.attributes['db.type']).must_equal 'redis'
8783
_(span.attributes['db.instance']).must_equal '0'
8884
_(span.attributes['db.statement']).must_equal(
@@ -108,7 +104,6 @@
108104

109105
_(exporter.finished_spans.size).must_equal 1
110106
_(span.name).must_equal 'pipeline'
111-
_(span.attributes['component']).must_equal 'redis'
112107
_(span.attributes['db.type']).must_equal 'redis'
113108
_(span.attributes['db.instance']).must_equal '0'
114109
_(span.attributes['db.statement']).must_equal "SET v1 0\nINCR v1\nGET v1"

adapters/restclient/lib/opentelemetry/adapters/restclient/patches/request.rb

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ def trace_request # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
2323
span = tracer.start_span(
2424
"HTTP #{http_method}",
2525
attributes: {
26-
'component' => 'http',
2726
'http.method' => http_method,
2827
'http.url' => url
2928
},

adapters/restclient/test/opentelemetry/adapters/restclient/adapter_test.rb

-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949

5050
_(exporter.finished_spans.size).must_equal 1
5151
_(span.name).must_equal 'HTTP GET'
52-
_(span.attributes['component']).must_equal 'http'
5352
_(span.attributes['http.method']).must_equal 'GET'
5453
_(span.attributes['http.status_code']).must_equal 200
5554
_(span.attributes['http.url']).must_equal 'http://example.com/success'
@@ -67,7 +66,6 @@
6766

6867
_(exporter.finished_spans.size).must_equal 1
6968
_(span.name).must_equal 'HTTP GET'
70-
_(span.attributes['component']).must_equal 'http'
7169
_(span.attributes['http.method']).must_equal 'GET'
7270
_(span.attributes['http.status_code']).must_equal 500
7371
_(span.attributes['http.url']).must_equal 'http://example.com/failure'

adapters/sinatra/lib/opentelemetry/adapters/sinatra/middlewares/tracer_middleware.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ def initialize(app)
1717
def call(env)
1818
tracer.in_span(
1919
env['PATH_INFO'],
20-
attributes: { 'component' => 'http',
21-
'http.method' => env['REQUEST_METHOD'],
20+
attributes: { 'http.method' => env['REQUEST_METHOD'],
2221
'http.url' => env['PATH_INFO'] },
2322
kind: :server,
2423
with_parent_context: parent_context(env)

adapters/sinatra/test/opentelemetry/adapters/sinatra_test.rb

-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
get '/one/endpoint'
8484

8585
_(exporter.finished_spans.first.attributes).must_equal(
86-
'component' => 'http',
8786
'http.method' => 'GET',
8887
'http.url' => '/endpoint',
8988
'http.status_code' => 200,

0 commit comments

Comments
 (0)