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

Remove component attribute from all adapters #265

Merged
merged 3 commits into from
May 26, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -71,7 +71,6 @@ def otel_before_request
@otel_span = tracer.start_span(
HTTP_METHODS_TO_SPAN_NAMES[method],
attributes: {
'component' => 'http',
'http.method' => method,
'http.url' => url
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
easy.perform

_(span.name).must_equal 'HTTP N/A'
_(span.attributes['component']).must_equal 'http'
_(span.attributes['http.method']).must_equal 'N/A'
_(span.attributes['http.status_code']).must_be_nil
_(span.attributes['http.url']).must_equal 'http://example.com/test'
Expand All @@ -94,7 +93,6 @@ def stub_response(options)
it 'when response is successful' do
stub_response(response_code: 200) do
_(span.name).must_equal 'HTTP N/A'
_(span.attributes['component']).must_equal 'http'
_(span.attributes['http.method']).must_equal 'N/A'
_(span.attributes['http.status_code']).must_equal 200
_(span.attributes['http.url']).must_equal 'http://example.com/test'
Expand All @@ -108,7 +106,6 @@ def stub_response(options)
it 'when response is not successful' do
stub_response(response_code: 500) do
_(span.name).must_equal 'HTTP N/A'
_(span.attributes['component']).must_equal 'http'
_(span.attributes['http.method']).must_equal 'N/A'
_(span.attributes['http.status_code']).must_equal 500
_(span.attributes['http.url']).must_equal 'http://example.com/test'
Expand All @@ -122,7 +119,6 @@ def stub_response(options)
it 'when request times out' do
stub_response(response_code: 0, return_code: :operation_timedout) do
_(span.name).must_equal 'HTTP N/A'
_(span.attributes['component']).must_equal 'http'
_(span.attributes['http.method']).must_equal 'N/A'
_(span.attributes['http.status_code']).must_be_nil
_(span.attributes['http.url']).must_equal 'http://example.com/test'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def request_call(datum) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
tracer.start_span(
"HTTP #{http_method}",
attributes: {
'component' => 'http',
'http.host' => datum[:host],
'http.method' => http_method,
'http.scheme' => datum[:scheme],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@

_(exporter.finished_spans.size).must_equal 1
_(span.name).must_equal 'HTTP GET'
_(span.attributes['component']).must_equal 'http'
_(span.attributes['http.method']).must_equal 'GET'
_(span.attributes['http.status_code']).must_equal 200
_(span.attributes['http.scheme']).must_equal 'http'
Expand All @@ -68,7 +67,6 @@

_(exporter.finished_spans.size).must_equal 1
_(span.name).must_equal 'HTTP GET'
_(span.attributes['component']).must_equal 'http'
_(span.attributes['http.method']).must_equal 'GET'
_(span.attributes['http.status_code']).must_equal 500
_(span.attributes['http.scheme']).must_equal 'http'
Expand All @@ -88,7 +86,6 @@

_(exporter.finished_spans.size).must_equal 1
_(span.name).must_equal 'HTTP GET'
_(span.attributes['component']).must_equal 'http'
_(span.attributes['http.method']).must_equal 'GET'
_(span.attributes['http.scheme']).must_equal 'http'
_(span.attributes['http.host']).must_equal 'example.com'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def call(env)
tracer.in_span(
"HTTP #{http_method}",
attributes: {
'component' => 'http',
'http.method' => http_method,
'http.url' => env.url.to_s
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
response = client.get('/success')

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

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

_(span.name).must_equal 'HTTP GET'
_(span.attributes['component']).must_equal 'http'
_(span.attributes['http.method']).must_equal 'GET'
_(span.attributes['http.status_code']).must_equal 500
_(span.attributes['http.url']).must_equal 'http://example.com/failure'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ def request(req, body = nil, &block)
tracer.in_span(
HTTP_METHODS_TO_SPAN_NAMES[req.method],
attributes: {
'component' => 'http',
'http.method' => req.method,
'http.scheme' => USE_SSL_TO_SCHEME[use_ssl?],
'http.target' => req.path,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@

_(exporter.finished_spans.size).must_equal 1
_(span.name).must_equal 'HTTP GET'
_(span.attributes['component']).must_equal 'http'
_(span.attributes['http.method']).must_equal 'GET'
_(span.attributes['http.scheme']).must_equal 'http'
_(span.attributes['http.status_code']).must_equal 200
Expand All @@ -69,7 +68,6 @@

_(exporter.finished_spans.size).must_equal 1
_(span.name).must_equal 'HTTP POST'
_(span.attributes['component']).must_equal 'http'
_(span.attributes['http.method']).must_equal 'POST'
_(span.attributes['http.scheme']).must_equal 'http'
_(span.attributes['http.status_code']).must_equal 500
Expand All @@ -90,7 +88,6 @@

_(exporter.finished_spans.size).must_equal 1
_(span.name).must_equal 'HTTP GET'
_(span.attributes['component']).must_equal 'http'
_(span.attributes['http.method']).must_equal 'GET'
_(span.attributes['http.scheme']).must_equal 'https'
_(span.attributes['http.status_code']).must_be_nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ def create_frontend_span(env, extracted_context)
span = tracer.start_span('http_server.proxy',
with_parent_context: extracted_context,
attributes: {
'component' => 'http',
'start_time' => request_start_time.to_f
},
kind: :server)
Expand All @@ -105,7 +104,6 @@ def tracer

def request_span_attributes(env:)
{
'component' => 'http',
'http.method' => env['REQUEST_METHOD'],
'http.host' => env['HTTP_HOST'] || 'unknown',
'http.scheme' => env['rack.url_scheme'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
end

it 'records attributes' do
_(first_span.attributes['component']).must_equal 'http'
_(first_span.attributes['http.method']).must_equal 'GET'
_(first_span.attributes['http.status_code']).must_equal 200
_(first_span.attributes['http.status_text']).must_equal 'OK'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def client_attributes
port = options[:port]

{
'component' => 'redis',
'db.type' => 'redis',
'db.instance' => options[:db].to_s,
'db.url' => "redis://#{host}:#{port}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
::Redis.new.auth('password')

_(span.name).must_equal 'AUTH'
_(span.attributes['component']).must_equal 'redis'
_(span.attributes['db.type']).must_equal 'redis'
_(span.attributes['db.instance']).must_equal '0'
_(span.attributes['db.statement']).must_equal 'AUTH ?'
Expand All @@ -54,7 +53,6 @@

set_span = exporter.finished_spans.first
_(set_span.name).must_equal 'SET'
_(set_span.attributes['component']).must_equal 'redis'
_(set_span.attributes['db.type']).must_equal 'redis'
_(set_span.attributes['db.instance']).must_equal '0'
_(set_span.attributes['db.statement']).must_equal(
Expand All @@ -66,7 +64,6 @@

get_span = exporter.finished_spans.last
_(get_span.name).must_equal 'GET'
_(get_span.attributes['component']).must_equal 'redis'
_(get_span.attributes['db.type']).must_equal 'redis'
_(get_span.attributes['db.instance']).must_equal '0'
_(get_span.attributes['db.statement']).must_equal 'GET K'
Expand All @@ -82,7 +79,6 @@

_(exporter.finished_spans.size).must_equal 1
_(span.name).must_equal 'THIS_IS_NOT_A_REDIS_FUNC'
_(span.attributes['component']).must_equal 'redis'
_(span.attributes['db.type']).must_equal 'redis'
_(span.attributes['db.instance']).must_equal '0'
_(span.attributes['db.statement']).must_equal(
Expand All @@ -108,7 +104,6 @@

_(exporter.finished_spans.size).must_equal 1
_(span.name).must_equal 'pipeline'
_(span.attributes['component']).must_equal 'redis'
_(span.attributes['db.type']).must_equal 'redis'
_(span.attributes['db.instance']).must_equal '0'
_(span.attributes['db.statement']).must_equal "SET v1 0\nINCR v1\nGET v1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ def trace_request # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
span = tracer.start_span(
"HTTP #{http_method}",
attributes: {
'component' => 'http',
'http.method' => http_method,
'http.url' => url
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@

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

_(exporter.finished_spans.size).must_equal 1
_(span.name).must_equal 'HTTP GET'
_(span.attributes['component']).must_equal 'http'
_(span.attributes['http.method']).must_equal 'GET'
_(span.attributes['http.status_code']).must_equal 500
_(span.attributes['http.url']).must_equal 'http://example.com/failure'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ def initialize(app)
def call(env)
tracer.in_span(
env['PATH_INFO'],
attributes: { 'component' => 'http',
'http.method' => env['REQUEST_METHOD'],
attributes: { 'http.method' => env['REQUEST_METHOD'],
'http.url' => env['PATH_INFO'] },
kind: :server,
with_parent_context: parent_context(env)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
get '/one/endpoint'

_(exporter.finished_spans.first.attributes).must_equal(
'component' => 'http',
'http.method' => 'GET',
'http.url' => '/endpoint',
'http.status_code' => 200,
Expand Down