Skip to content

Commit 5f7fc25

Browse files
committed
fix: refactor attributes merge
1 parent 18559cf commit 5f7fc25

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,13 @@ def request(req, body = nil, &)
3333
'url.scheme' => USE_SSL_TO_SCHEME[use_ssl?],
3434
'server.address' => @address,
3535
'server.port' => @port
36-
}.merge!(OpenTelemetry::Common::HTTP::ClientContext.attributes)
37-
36+
}
3837
path, query = split_path_and_query(req.path)
39-
attributes['url.path'] = path unless attributes.key?('url.path')
38+
attributes['url.path'] = path
4039
attributes['url.query'] = query if query
4140

41+
attributes.merge!(OpenTelemetry::Common::HTTP::ClientContext.attributes)
42+
4243
tracer.in_span(
4344
req.method,
4445
attributes: attributes,

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ def request(req, body = nil, &)
2828
'url.scheme' => USE_SSL_TO_SCHEME[use_ssl?],
2929
'server.address' => @address,
3030
'server.port' => @port
31-
}.merge!(OpenTelemetry::Common::HTTP::ClientContext.attributes)
32-
31+
}
3332
path, query = split_path_and_query(req.path)
34-
attributes['url.path'] = path unless attributes.key?('url.path')
33+
attributes['url.path'] = path
3534
attributes['url.query'] = query if query
3635

36+
attributes.merge!(OpenTelemetry::Common::HTTP::ClientContext.attributes)
37+
3738
tracer.in_span(
3839
req.method.to_s,
3940
attributes: attributes,

0 commit comments

Comments
 (0)