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

[faraday] Add hostname to faraday annotation #387

Closed
Closed
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
2 changes: 1 addition & 1 deletion lib/ddtrace/contrib/faraday/middleware.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def call(env)
attr_reader :app, :options, :tracer

def annotate!(span, env)
span.resource = env[:method].to_s.upcase
span.resource = [env[:method].to_s.upcase, env[:url].host].join(' ')
span.service = service_name(env)
span.span_type = Ext::HTTP::TYPE
span.set_tag(Ext::HTTP::URL, env[:url].path)
Expand Down
6 changes: 3 additions & 3 deletions test/contrib/faraday/middleware_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_successful_request

assert_equal(SERVICE, span.service)
assert_equal(NAME, span.name)
assert_equal('GET', span.resource)
assert_equal('GET example.com', span.resource)
assert_equal('GET', span.get_tag(Ext::HTTP::METHOD))
assert_equal('200', span.get_tag(Ext::HTTP::STATUS_CODE))
assert_equal('/success', span.get_tag(Ext::HTTP::URL))
Expand All @@ -49,7 +49,7 @@ def test_error_response

assert_equal(SERVICE, span.service)
assert_equal(NAME, span.name)
assert_equal('POST', span.resource)
assert_equal('POST example.com', span.resource)
assert_equal('POST', span.get_tag(Ext::HTTP::METHOD))
assert_equal('/failure', span.get_tag(Ext::HTTP::URL))
assert_equal('500', span.get_tag(Ext::HTTP::STATUS_CODE))
Expand Down Expand Up @@ -82,7 +82,7 @@ def test_split_by_domain_option

assert_equal(span.name, NAME)
assert_equal(span.service, 'example.com')
assert_equal(span.resource, 'GET')
assert_equal(span.resource, 'GET example.com')
end

def test_default_tracing_headers
Expand Down