opentelemetry-instrumentation-net_http 0.29.1 → 0.29.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/opentelemetry/instrumentation/net/http/http_helper.rb +19 -0
- data/lib/opentelemetry/instrumentation/net/http/patches/dup/instrumentation.rb +3 -9
- data/lib/opentelemetry/instrumentation/net/http/patches/old/instrumentation.rb +1 -1
- data/lib/opentelemetry/instrumentation/net/http/patches/stable/instrumentation.rb +2 -8
- data/lib/opentelemetry/instrumentation/net/http/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 66e575e14595df6a6abf6646c1d641e2720b08a9c1a2eba53c8951d72411385a
|
|
4
|
+
data.tar.gz: 971d0de75ffd644e7143c0cf22768e3f5b775a923cd774462bf8aec125c5d335
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 741450ff34b7c839f8d8ba906ff1bb5d468f5c40c4294a78e8746d430f3d3c40f7448c776325e9f80bd980eba182ca4130dbbf334dbb095fc4caf95084ea1a95
|
|
7
|
+
data.tar.gz: a7c244f250393ce3370f5879b7befc8889a125c8c8e8b68a7cfa72321d21d00122d3989451061e566cf4add53c1432cfed4fa92376fd8ffa14c7d6b894d68aa8
|
data/CHANGELOG.md
CHANGED
|
@@ -14,6 +14,25 @@ module OpenTelemetry
|
|
|
14
14
|
# Lightweight struct to hold span creation attributes
|
|
15
15
|
SpanCreationAttributes = Struct.new(:span_name, :attributes)
|
|
16
16
|
|
|
17
|
+
# Returns the request path for strings and URI-like objects.
|
|
18
|
+
# @param path [String, #request_uri] The request path
|
|
19
|
+
# @return [String, nil] The normalized request path
|
|
20
|
+
def self.request_path(path)
|
|
21
|
+
path.respond_to?(:request_uri) ? path.request_uri : path
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Splits a request path into its path and query components.
|
|
25
|
+
# @param path [String, #request_uri] The request path
|
|
26
|
+
# @return [Array<String, String, nil>] The path and query components
|
|
27
|
+
def self.split_path_and_query(path)
|
|
28
|
+
path = request_path(path)
|
|
29
|
+
return [nil, nil] unless path
|
|
30
|
+
|
|
31
|
+
path_and_query = path.split('?')
|
|
32
|
+
|
|
33
|
+
[path_and_query[0], path_and_query[1]]
|
|
34
|
+
end
|
|
35
|
+
|
|
17
36
|
# Pre-computed mapping to avoid string allocations during normalization
|
|
18
37
|
METHOD_CACHE = {
|
|
19
38
|
'CONNECT' => 'CONNECT',
|
|
@@ -26,13 +26,13 @@ module OpenTelemetry
|
|
|
26
26
|
span_data = HttpHelper.span_attrs_for_dup(req.method)
|
|
27
27
|
|
|
28
28
|
attributes = { OpenTelemetry::SemanticConventions::Trace::HTTP_SCHEME => USE_SSL_TO_SCHEME[use_ssl?],
|
|
29
|
-
OpenTelemetry::SemanticConventions::Trace::HTTP_TARGET => req.path,
|
|
29
|
+
OpenTelemetry::SemanticConventions::Trace::HTTP_TARGET => HttpHelper.request_path(req.path),
|
|
30
30
|
OpenTelemetry::SemanticConventions::Trace::NET_PEER_NAME => @address,
|
|
31
31
|
OpenTelemetry::SemanticConventions::Trace::NET_PEER_PORT => @port, 'url.scheme' => USE_SSL_TO_SCHEME[use_ssl?],
|
|
32
32
|
'server.address' => @address,
|
|
33
33
|
'server.port' => @port }.compact
|
|
34
|
-
path, query = split_path_and_query(req.path)
|
|
35
|
-
attributes['url.path'] = path
|
|
34
|
+
path, query = HttpHelper.split_path_and_query(req.path)
|
|
35
|
+
attributes['url.path'] = path if path
|
|
36
36
|
attributes['url.query'] = query if query
|
|
37
37
|
|
|
38
38
|
attributes.merge!(span_data.attributes)
|
|
@@ -112,12 +112,6 @@ module OpenTelemetry
|
|
|
112
112
|
def untraced_context?
|
|
113
113
|
OpenTelemetry::Common::Utilities.untraced?
|
|
114
114
|
end
|
|
115
|
-
|
|
116
|
-
def split_path_and_query(path)
|
|
117
|
-
path_and_query = path.split('?')
|
|
118
|
-
|
|
119
|
-
[path_and_query[0], path_and_query[1]]
|
|
120
|
-
end
|
|
121
115
|
end
|
|
122
116
|
end
|
|
123
117
|
end
|
|
@@ -26,7 +26,7 @@ module OpenTelemetry
|
|
|
26
26
|
span_data = HttpHelper.span_attrs_for_old(req.method)
|
|
27
27
|
|
|
28
28
|
attributes = { OpenTelemetry::SemanticConventions::Trace::HTTP_SCHEME => USE_SSL_TO_SCHEME[use_ssl?],
|
|
29
|
-
OpenTelemetry::SemanticConventions::Trace::HTTP_TARGET => req.path,
|
|
29
|
+
OpenTelemetry::SemanticConventions::Trace::HTTP_TARGET => HttpHelper.request_path(req.path),
|
|
30
30
|
OpenTelemetry::SemanticConventions::Trace::NET_PEER_NAME => @address,
|
|
31
31
|
OpenTelemetry::SemanticConventions::Trace::NET_PEER_PORT => @port }.compact.merge!(span_data.attributes)
|
|
32
32
|
|
|
@@ -28,8 +28,8 @@ module OpenTelemetry
|
|
|
28
28
|
attributes = { 'url.scheme' => USE_SSL_TO_SCHEME[use_ssl?],
|
|
29
29
|
'server.address' => @address,
|
|
30
30
|
'server.port' => @port }.compact
|
|
31
|
-
path, query = split_path_and_query(req.path)
|
|
32
|
-
attributes['url.path'] = path
|
|
31
|
+
path, query = HttpHelper.split_path_and_query(req.path)
|
|
32
|
+
attributes['url.path'] = path if path
|
|
33
33
|
attributes['url.query'] = query if query
|
|
34
34
|
|
|
35
35
|
attributes.merge!(span_data.attributes)
|
|
@@ -106,12 +106,6 @@ module OpenTelemetry
|
|
|
106
106
|
def untraced_context?
|
|
107
107
|
OpenTelemetry::Common::Utilities.untraced?
|
|
108
108
|
end
|
|
109
|
-
|
|
110
|
-
def split_path_and_query(path)
|
|
111
|
-
path_and_query = path.split('?')
|
|
112
|
-
|
|
113
|
-
[path_and_query[0], path_and_query[1]]
|
|
114
|
-
end
|
|
115
109
|
end
|
|
116
110
|
end
|
|
117
111
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: opentelemetry-instrumentation-net_http
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.29.
|
|
4
|
+
version: 0.29.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- OpenTelemetry Authors
|
|
@@ -47,10 +47,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
|
|
|
47
47
|
licenses:
|
|
48
48
|
- Apache-2.0
|
|
49
49
|
metadata:
|
|
50
|
-
changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-net_http/0.29.
|
|
51
|
-
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/opentelemetry-instrumentation-net_http/v0.29.
|
|
50
|
+
changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-net_http/0.29.2/file/CHANGELOG.md
|
|
51
|
+
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/opentelemetry-instrumentation-net_http/v0.29.2/instrumentation/net_http
|
|
52
52
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
|
|
53
|
-
documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-net_http/0.29.
|
|
53
|
+
documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-net_http/0.29.2
|
|
54
54
|
rdoc_options: []
|
|
55
55
|
require_paths:
|
|
56
56
|
- lib
|