Skip to content

Commit b503a28

Browse files
committed
squash: fix things
1 parent bb4ce0b commit b503a28

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

instrumentation/httpx/lib/opentelemetry/instrumentation/httpx/dup/plugin.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def finish(response, span)
5454
span.record_exception(response.error)
5555
span.status = Trace::Status.error(response.error.to_s)
5656
else
57-
span.set_attribute(OpenTelemetry::SemanticConventions::Trace::HTTP_STATUS_CODE, response.status)
57+
span.set_attribute('http.status_code', response.status)
5858
span.set_attribute('http.response.status_code', response.status)
5959

6060
if response.status.between?(400, 599)
@@ -75,13 +75,13 @@ def initialize_span(request, start_time = ::Time.now)
7575
config = HTTPX::Instrumentation.instance.config
7676

7777
attributes = {
78-
OpenTelemetry::SemanticConventions::Trace::HTTP_HOST => uri.host,
79-
OpenTelemetry::SemanticConventions::Trace::HTTP_METHOD => verb,
80-
OpenTelemetry::SemanticConventions::Trace::HTTP_SCHEME => uri.scheme,
81-
OpenTelemetry::SemanticConventions::Trace::HTTP_TARGET => uri.path,
82-
OpenTelemetry::SemanticConventions::Trace::HTTP_URL => "#{uri.scheme}://#{uri.host}",
83-
OpenTelemetry::SemanticConventions::Trace::NET_PEER_NAME => uri.host,
84-
OpenTelemetry::SemanticConventions::Trace::NET_PEER_PORT => uri.port,
78+
'http.host' => uri.host,
79+
'http.method' => verb,
80+
'http.scheme' => uri.scheme,
81+
'http.target' => uri.path,
82+
'http.url' => "#{uri.scheme}://#{uri.host}",
83+
'net.peer.name' => uri.host,
84+
'net.peer.port' => uri.port,
8585
'http.request.method' => verb,
8686
'url.scheme' => uri.scheme,
8787
'url.path' => uri.path,
@@ -91,7 +91,7 @@ def initialize_span(request, start_time = ::Time.now)
9191
}
9292

9393
attributes['url.query'] = uri.query unless uri.query.nil?
94-
attributes[OpenTelemetry::SemanticConventions::Trace::PEER_SERVICE] = config[:peer_service] if config[:peer_service]
94+
attributes['peer.service'] = config[:peer_service] if config[:peer_service]
9595
attributes.merge!(OpenTelemetry::Common::HTTP::ClientContext.attributes)
9696

9797
span_name = determine_span_name(attributes, verb)

instrumentation/httpx/lib/opentelemetry/instrumentation/httpx/helpers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module Helpers
3333
# @api private
3434
def known_methods
3535
@known_methods ||= if (env_methods = ENV.fetch('OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS', nil))
36-
env_methods.split(',').map(&:strip).map(&:upcase).freeze
36+
env_methods.split(',').map { |x| x.strip.upcase }.freeze
3737
else
3838
DEFAULT_KNOWN_METHODS
3939
end

instrumentation/httpx/lib/opentelemetry/instrumentation/httpx/old/plugin.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def finish(response, span)
5454
span.record_exception(response.error)
5555
span.status = Trace::Status.error(response.error.to_s)
5656
else
57-
span.set_attribute(OpenTelemetry::SemanticConventions::Trace::HTTP_STATUS_CODE, response.status)
57+
span.set_attribute('http.status_code', response.status)
5858

5959
if response.status.between?(400, 599)
6060
err = ::HTTPX::HTTPError.new(response)
@@ -74,16 +74,16 @@ def initialize_span(request, start_time = ::Time.now)
7474
config = HTTPX::Instrumentation.instance.config
7575

7676
attributes = {
77-
OpenTelemetry::SemanticConventions::Trace::HTTP_HOST => uri.host,
78-
OpenTelemetry::SemanticConventions::Trace::HTTP_METHOD => verb,
79-
OpenTelemetry::SemanticConventions::Trace::HTTP_SCHEME => uri.scheme,
80-
OpenTelemetry::SemanticConventions::Trace::HTTP_TARGET => uri.path,
81-
OpenTelemetry::SemanticConventions::Trace::HTTP_URL => "#{uri.scheme}://#{uri.host}",
82-
OpenTelemetry::SemanticConventions::Trace::NET_PEER_NAME => uri.host,
83-
OpenTelemetry::SemanticConventions::Trace::NET_PEER_PORT => uri.port
77+
'http.host' => uri.host,
78+
'http.method' => verb,
79+
'http.scheme' => uri.scheme,
80+
'http.target' => uri.path,
81+
'http.url' => "#{uri.scheme}://#{uri.host}",
82+
'net.peer.name' => uri.host,
83+
'net.peer.port' => uri.port
8484
}
8585

86-
attributes[OpenTelemetry::SemanticConventions::Trace::PEER_SERVICE] = config[:peer_service] if config[:peer_service]
86+
attributes['peer.service'] = config[:peer_service] if config[:peer_service]
8787
attributes.merge!(OpenTelemetry::Common::HTTP::ClientContext.attributes)
8888

8989
span = tracer.start_span(determine_span_name(attributes, verb), attributes: attributes, kind: :client, start_timestamp: start_time)

instrumentation/httpx/lib/opentelemetry/instrumentation/httpx/stable/plugin.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def initialize_span(request, start_time = ::Time.now)
8282
'server.port' => uri.port
8383
}
8484
attributes['url.query'] = uri.query unless uri.query.nil?
85-
attributes[OpenTelemetry::SemanticConventions::Trace::PEER_SERVICE] = config[:peer_service] if config[:peer_service]
85+
attributes['peer.service'] = config[:peer_service] if config[:peer_service]
8686
attributes.merge!(OpenTelemetry::Common::HTTP::ClientContext.attributes)
8787

8888
span = tracer.start_span(determine_span_name(attributes, verb), attributes: attributes, kind: :client, start_timestamp: start_time)

0 commit comments

Comments
 (0)