opentelemetry-instrumentation-ethon 0.26.0 → 0.27.0
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/README.md +2 -2
- data/lib/opentelemetry/instrumentation/ethon/http_helper.rb +77 -29
- data/lib/opentelemetry/instrumentation/ethon/patches/dup/easy.rb +3 -9
- data/lib/opentelemetry/instrumentation/ethon/patches/old/easy.rb +3 -7
- data/lib/opentelemetry/instrumentation/ethon/patches/stable/easy.rb +3 -8
- data/lib/opentelemetry/instrumentation/ethon/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: a10aefb2b3c503be55bf54ddc3c2d0fe69d0d143106d03abc659f45a5426c878
|
|
4
|
+
data.tar.gz: 1b4307016331351fe8f8be7320a6636dece386695b6ecfcc82b8903f05ce92df
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e5fb931f0f11d03e200f57dbfad551afc304acd35e12cd86a28493f81c371db33fe9366f21e2a053a9564cdf664b0db838ff0f4b5a3c10ef5fecd1cedd871a04
|
|
7
|
+
data.tar.gz: db64e4a70ad09bb043d01c95d7642d096e134e03baf8334d3fd40d90e31d8f6389b844df56259d305d2f573f47b228ad9e5164c3db6b7cfde6147041b6c173d4
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -44,7 +44,7 @@ The OpenTelemetry Ruby gems are maintained by the OpenTelemetry Ruby special int
|
|
|
44
44
|
|
|
45
45
|
The `opentelemetry-instrumentation-all` gem is distributed under the Apache 2.0 license. See [LICENSE][license-github] for more information.
|
|
46
46
|
|
|
47
|
-
[ethon-home]:https://github.com/typhoeus/ethon
|
|
47
|
+
[ethon-home]: https://github.com/typhoeus/ethon
|
|
48
48
|
[bundler-home]: https://bundler.io
|
|
49
49
|
[repo-github]: https://github.com/open-telemetry/opentelemetry-ruby
|
|
50
50
|
[license-github]: https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/LICENSE
|
|
@@ -67,4 +67,4 @@ When setting the value for `OTEL_SEMCONV_STABILITY_OPT_IN`, you can specify whic
|
|
|
67
67
|
|
|
68
68
|
During the transition from old to stable conventions, Ethon instrumentation code comes in three patch versions: `dup`, `old`, and `stable`. These versions are identical except for the attributes they send. Any changes to Ethon instrumentation should consider all three patches.
|
|
69
69
|
|
|
70
|
-
For additional information on migration, please refer to our [documentation](https://opentelemetry.io/docs/specs/semconv/non-normative/http-migration/).
|
|
70
|
+
For additional information on migration, please refer to our [documentation](https://opentelemetry.io/docs/specs/semconv/non-normative/http-migration/).
|
|
@@ -11,7 +11,7 @@ module OpenTelemetry
|
|
|
11
11
|
# @api private
|
|
12
12
|
module HttpHelper
|
|
13
13
|
# Lightweight struct to hold span creation attributes
|
|
14
|
-
SpanCreationAttributes = Struct.new(:span_name, :
|
|
14
|
+
SpanCreationAttributes = Struct.new(:span_name, :attributes, keyword_init: true)
|
|
15
15
|
|
|
16
16
|
# Pre-computed mapping to avoid string allocations during normalization
|
|
17
17
|
METHOD_CACHE = {
|
|
@@ -44,41 +44,89 @@ module OpenTelemetry
|
|
|
44
44
|
:trace => 'TRACE'
|
|
45
45
|
}.freeze
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
'HEAD' => 'HTTP HEAD',
|
|
53
|
-
'OPTIONS' => 'HTTP OPTIONS',
|
|
54
|
-
'PATCH' => 'HTTP PATCH',
|
|
55
|
-
'POST' => 'HTTP POST',
|
|
56
|
-
'PUT' => 'HTTP PUT',
|
|
57
|
-
'TRACE' => 'HTTP TRACE'
|
|
58
|
-
}.freeze
|
|
47
|
+
private_constant :METHOD_CACHE
|
|
48
|
+
|
|
49
|
+
OLD_SPAN_NAMES_BY_METHOD = METHOD_CACHE.values.uniq.each_with_object({}) do |method, hash|
|
|
50
|
+
hash[method] = "HTTP #{method}"
|
|
51
|
+
end.freeze
|
|
59
52
|
|
|
60
|
-
private_constant :
|
|
53
|
+
private_constant :OLD_SPAN_NAMES_BY_METHOD
|
|
61
54
|
|
|
62
|
-
# Prepares
|
|
55
|
+
# Prepares span data using old semantic conventions
|
|
63
56
|
# @param method [String, Symbol] The HTTP method
|
|
64
|
-
# @
|
|
65
|
-
|
|
66
|
-
|
|
57
|
+
# @return [SpanCreationAttributes] struct containing span_name and attributes hash
|
|
58
|
+
def self.span_attrs_for_old(method)
|
|
59
|
+
client_context_attrs = OpenTelemetry::Common::HTTP::ClientContext.attributes
|
|
67
60
|
normalized = METHOD_CACHE[method]
|
|
61
|
+
attributes = client_context_attrs.dup
|
|
62
|
+
|
|
63
|
+
# Determine base span name and method value
|
|
64
|
+
if normalized
|
|
65
|
+
span_name = OLD_SPAN_NAMES_BY_METHOD[normalized]
|
|
66
|
+
method_value = normalized
|
|
67
|
+
else
|
|
68
|
+
span_name = 'HTTP'
|
|
69
|
+
method_value = '_OTHER'
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
attributes['http.method'] ||= method_value
|
|
73
|
+
|
|
74
|
+
SpanCreationAttributes.new(span_name: span_name, attributes: attributes)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Prepares span data using stable semantic conventions
|
|
78
|
+
# @param method [String, Symbol] The HTTP method
|
|
79
|
+
# @return [SpanCreationAttributes] struct containing span_name and attributes hash
|
|
80
|
+
def self.span_attrs_for_stable(method)
|
|
81
|
+
client_context_attrs = OpenTelemetry::Common::HTTP::ClientContext.attributes
|
|
82
|
+
url_template = client_context_attrs['url.template']
|
|
83
|
+
normalized = METHOD_CACHE[method]
|
|
84
|
+
attributes = client_context_attrs.dup
|
|
85
|
+
|
|
86
|
+
# Determine base span name and method value
|
|
68
87
|
if normalized
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
normalized_method: normalized,
|
|
73
|
-
original_method: nil
|
|
74
|
-
)
|
|
88
|
+
base_name = normalized
|
|
89
|
+
method_value = normalized
|
|
90
|
+
original = nil
|
|
75
91
|
else
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
original_method: method.to_s
|
|
80
|
-
)
|
|
92
|
+
base_name = 'HTTP'
|
|
93
|
+
method_value = '_OTHER'
|
|
94
|
+
original = method.to_s
|
|
81
95
|
end
|
|
96
|
+
|
|
97
|
+
span_name = url_template ? "#{base_name} #{url_template}" : base_name
|
|
98
|
+
attributes['http.request.method'] ||= method_value
|
|
99
|
+
attributes['http.request.method_original'] ||= original if original
|
|
100
|
+
|
|
101
|
+
SpanCreationAttributes.new(span_name: span_name, attributes: attributes)
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Prepares span data using both old and stable semantic conventions
|
|
105
|
+
# @param method [String, Symbol] The HTTP method
|
|
106
|
+
# @return [SpanCreationAttributes] struct containing span_name and attributes hash
|
|
107
|
+
def self.span_attrs_for_dup(method)
|
|
108
|
+
client_context_attrs = OpenTelemetry::Common::HTTP::ClientContext.attributes
|
|
109
|
+
url_template = client_context_attrs['url.template']
|
|
110
|
+
normalized = METHOD_CACHE[method]
|
|
111
|
+
attributes = client_context_attrs.dup
|
|
112
|
+
|
|
113
|
+
# Determine base span name and method value
|
|
114
|
+
if normalized
|
|
115
|
+
base_name = normalized
|
|
116
|
+
method_value = normalized
|
|
117
|
+
original = nil
|
|
118
|
+
else
|
|
119
|
+
base_name = 'HTTP'
|
|
120
|
+
method_value = '_OTHER'
|
|
121
|
+
original = method.to_s
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
span_name = url_template ? "#{base_name} #{url_template}" : base_name
|
|
125
|
+
attributes['http.method'] ||= method_value
|
|
126
|
+
attributes['http.request.method'] ||= method_value
|
|
127
|
+
attributes['http.request.method_original'] ||= original if original
|
|
128
|
+
|
|
129
|
+
SpanCreationAttributes.new(span_name: span_name, attributes: attributes)
|
|
82
130
|
end
|
|
83
131
|
end
|
|
84
132
|
end
|
|
@@ -68,7 +68,7 @@ module OpenTelemetry
|
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
def otel_before_request
|
|
71
|
-
span_data = HttpHelper.
|
|
71
|
+
span_data = HttpHelper.span_attrs_for_dup(@otel_method)
|
|
72
72
|
|
|
73
73
|
@otel_span = tracer.start_span(
|
|
74
74
|
span_data.span_name,
|
|
@@ -90,11 +90,7 @@ module OpenTelemetry
|
|
|
90
90
|
private
|
|
91
91
|
|
|
92
92
|
def span_creation_attributes(span_data)
|
|
93
|
-
instrumentation_attrs = {
|
|
94
|
-
'http.method' => span_data.normalized_method,
|
|
95
|
-
'http.request.method' => span_data.normalized_method
|
|
96
|
-
}
|
|
97
|
-
instrumentation_attrs['http.request.method_original'] = span_data.original_method if span_data.original_method
|
|
93
|
+
instrumentation_attrs = {}
|
|
98
94
|
|
|
99
95
|
uri = _otel_cleanse_uri(url)
|
|
100
96
|
if uri
|
|
@@ -106,9 +102,7 @@ module OpenTelemetry
|
|
|
106
102
|
|
|
107
103
|
config = Ethon::Instrumentation.instance.config
|
|
108
104
|
instrumentation_attrs['peer.service'] = config[:peer_service] if config[:peer_service]
|
|
109
|
-
instrumentation_attrs.merge!(
|
|
110
|
-
OpenTelemetry::Common::HTTP::ClientContext.attributes
|
|
111
|
-
)
|
|
105
|
+
instrumentation_attrs.merge!(span_data.attributes)
|
|
112
106
|
end
|
|
113
107
|
|
|
114
108
|
# Returns a URL string with userinfo removed.
|
|
@@ -67,7 +67,7 @@ module OpenTelemetry
|
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
def otel_before_request
|
|
70
|
-
span_data = HttpHelper.
|
|
70
|
+
span_data = HttpHelper.span_attrs_for_old(@otel_method)
|
|
71
71
|
|
|
72
72
|
@otel_span = tracer.start_span(
|
|
73
73
|
span_data.span_name,
|
|
@@ -89,9 +89,7 @@ module OpenTelemetry
|
|
|
89
89
|
private
|
|
90
90
|
|
|
91
91
|
def span_creation_attributes(span_data)
|
|
92
|
-
instrumentation_attrs = {
|
|
93
|
-
'http.method' => span_data.normalized_method
|
|
94
|
-
}
|
|
92
|
+
instrumentation_attrs = {}
|
|
95
93
|
|
|
96
94
|
uri = _otel_cleanse_uri(url)
|
|
97
95
|
if uri
|
|
@@ -101,9 +99,7 @@ module OpenTelemetry
|
|
|
101
99
|
|
|
102
100
|
config = Ethon::Instrumentation.instance.config
|
|
103
101
|
instrumentation_attrs['peer.service'] = config[:peer_service] if config[:peer_service]
|
|
104
|
-
instrumentation_attrs.merge!(
|
|
105
|
-
OpenTelemetry::Common::HTTP::ClientContext.attributes
|
|
106
|
-
)
|
|
102
|
+
instrumentation_attrs.merge!(span_data.attributes)
|
|
107
103
|
end
|
|
108
104
|
|
|
109
105
|
# Returns a URL string with userinfo removed.
|
|
@@ -67,7 +67,7 @@ module OpenTelemetry
|
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
def otel_before_request
|
|
70
|
-
span_data = HttpHelper.
|
|
70
|
+
span_data = HttpHelper.span_attrs_for_stable(@otel_method)
|
|
71
71
|
|
|
72
72
|
@otel_span = tracer.start_span(
|
|
73
73
|
span_data.span_name,
|
|
@@ -89,10 +89,7 @@ module OpenTelemetry
|
|
|
89
89
|
private
|
|
90
90
|
|
|
91
91
|
def span_creation_attributes(span_data)
|
|
92
|
-
instrumentation_attrs = {
|
|
93
|
-
'http.request.method' => span_data.normalized_method
|
|
94
|
-
}
|
|
95
|
-
instrumentation_attrs['http.request.method_original'] = span_data.original_method if span_data.original_method
|
|
92
|
+
instrumentation_attrs = {}
|
|
96
93
|
|
|
97
94
|
uri = _otel_cleanse_uri(url)
|
|
98
95
|
if uri
|
|
@@ -102,9 +99,7 @@ module OpenTelemetry
|
|
|
102
99
|
|
|
103
100
|
config = Ethon::Instrumentation.instance.config
|
|
104
101
|
instrumentation_attrs['peer.service'] = config[:peer_service] if config[:peer_service]
|
|
105
|
-
instrumentation_attrs.merge!(
|
|
106
|
-
OpenTelemetry::Common::HTTP::ClientContext.attributes
|
|
107
|
-
)
|
|
102
|
+
instrumentation_attrs.merge!(span_data.attributes)
|
|
108
103
|
end
|
|
109
104
|
|
|
110
105
|
# Returns a URL string with userinfo removed.
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: opentelemetry-instrumentation-ethon
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.27.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- OpenTelemetry Authors
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-01-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: opentelemetry-instrumentation-base
|
|
@@ -49,10 +49,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
|
|
|
49
49
|
licenses:
|
|
50
50
|
- Apache-2.0
|
|
51
51
|
metadata:
|
|
52
|
-
changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-ethon/0.
|
|
52
|
+
changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-ethon/0.27.0/file/CHANGELOG.md
|
|
53
53
|
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/ethon
|
|
54
54
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
|
|
55
|
-
documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-ethon/0.
|
|
55
|
+
documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-ethon/0.27.0
|
|
56
56
|
post_install_message:
|
|
57
57
|
rdoc_options: []
|
|
58
58
|
require_paths:
|