opentelemetry-instrumentation-net_http 0.20.0 → 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +3 -3
- data/lib/opentelemetry/instrumentation/net/http/instrumentation.rb +8 -0
- data/lib/opentelemetry/instrumentation/net/http/patches/instrumentation.rb +21 -1
- data/lib/opentelemetry/instrumentation/net/http/version.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25308137775787bda9a6fc713d1e398ef167f4143acba4a568fca9296d7ca8f7
|
4
|
+
data.tar.gz: 9a8e6b61bbd51e024bd16c30c9b6b74a526f2abb810533714b3ba2d57a2bdf74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9efc782cd36d09e4fe1003ea91118c9fdffbcb561b4ae3f6bcf2468c93b52da7514933c5dfd14fe4a5d606d6c1e32ae865babede951765728ebff920c9ce546d
|
7
|
+
data.tar.gz: e3bcfb6b9ccea89f55f9feba77e0867bff307edb8b5428f767be64d838c8a905188cd71734e491dfa2e1bef071e75bfaa46d0ae1743af6bb9e8805446ac6e2b4
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Release History: opentelemetry-instrumentation-net_http
|
2
2
|
|
3
|
+
### v0.21.0 / 2022-10-04
|
4
|
+
|
5
|
+
* ADDED: Add Net::HTTP :untraced_hosts option
|
6
|
+
* FIXED: Rename HTTP CONNECT for low level connection spans
|
7
|
+
|
3
8
|
### v0.20.0 / 2022-06-09
|
4
9
|
|
5
10
|
* Upgrading Base dependency version
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# OpenTelemetry Net::HTTP Instrumentation
|
2
2
|
|
3
|
-
The OpenTelemetry Net::HTTP Ruby gem is a community maintained instrumentation for [Net::HTTP][net-http-home].
|
3
|
+
The OpenTelemetry Net::HTTP Ruby gem is a community maintained instrumentation for [Net::HTTP][net-http-home].
|
4
4
|
|
5
5
|
## How do I get started?
|
6
6
|
|
@@ -32,7 +32,7 @@ end
|
|
32
32
|
|
33
33
|
## Example
|
34
34
|
|
35
|
-
An example of usage can be seen in [`example/net_http.rb`](https://github.com/open-telemetry/opentelemetry-ruby/blob/main/instrumentation/net_http/example/net_http.rb).
|
35
|
+
An example of usage can be seen in [`example/net_http.rb`](https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/instrumentation/net_http/example/net_http.rb).
|
36
36
|
|
37
37
|
## How can I get involved?
|
38
38
|
|
@@ -47,7 +47,7 @@ Apache 2.0 license. See [LICENSE][license-github] for more information.
|
|
47
47
|
[net-http-home]: https://docs.ruby-lang.org/en/2.0.0/Net/HTTP.html
|
48
48
|
[bundler-home]: https://bundler.io
|
49
49
|
[repo-github]: https://github.com/open-telemetry/opentelemetry-ruby
|
50
|
-
[license-github]: https://github.com/open-telemetry/opentelemetry-ruby/blob/main/LICENSE
|
50
|
+
[license-github]: https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/LICENSE
|
51
51
|
[ruby-sig]: https://github.com/open-telemetry/community#ruby-sig
|
52
52
|
[community-meetings]: https://github.com/open-telemetry/community#community-meetings
|
53
53
|
[discussions-url]: https://github.com/open-telemetry/opentelemetry-ruby/discussions
|
@@ -20,6 +20,14 @@ module OpenTelemetry
|
|
20
20
|
defined?(::Net::HTTP)
|
21
21
|
end
|
22
22
|
|
23
|
+
## Supported configuration keys for the install config hash:
|
24
|
+
#
|
25
|
+
# untraced_hosts: if a request's address matches any of the `String`
|
26
|
+
# or `Regexp` in this array, the instrumentation will not record a
|
27
|
+
# `kind = :client` representing the request and will not propagate
|
28
|
+
# context in the request.
|
29
|
+
option :untraced_hosts, default: [], validate: :array
|
30
|
+
|
23
31
|
private
|
24
32
|
|
25
33
|
def require_dependencies
|
@@ -18,6 +18,8 @@ module OpenTelemetry
|
|
18
18
|
# Do not trace recursive call for starting the connection
|
19
19
|
return super(req, body, &block) unless started?
|
20
20
|
|
21
|
+
return super(req, body, &block) if untraced?
|
22
|
+
|
21
23
|
attributes = {
|
22
24
|
OpenTelemetry::SemanticConventions::Trace::HTTP_METHOD => req.method,
|
23
25
|
OpenTelemetry::SemanticConventions::Trace::HTTP_SCHEME => USE_SSL_TO_SCHEME[use_ssl?],
|
@@ -41,6 +43,7 @@ module OpenTelemetry
|
|
41
43
|
|
42
44
|
private
|
43
45
|
|
46
|
+
# rubocop:disable Metrics/MethodLength
|
44
47
|
def connect
|
45
48
|
if proxy?
|
46
49
|
conn_address = proxy_address
|
@@ -55,10 +58,19 @@ module OpenTelemetry
|
|
55
58
|
OpenTelemetry::SemanticConventions::Trace::NET_PEER_PORT => conn_port
|
56
59
|
}.merge!(OpenTelemetry::Common::HTTP::ClientContext.attributes)
|
57
60
|
|
58
|
-
|
61
|
+
if use_ssl? && proxy?
|
62
|
+
span_name = 'HTTP CONNECT'
|
63
|
+
span_kind = :client
|
64
|
+
else
|
65
|
+
span_name = 'connect'
|
66
|
+
span_kind = :internal
|
67
|
+
end
|
68
|
+
|
69
|
+
tracer.in_span(span_name, attributes: attributes, kind: span_kind) do
|
59
70
|
super
|
60
71
|
end
|
61
72
|
end
|
73
|
+
# rubocop:enable Metrics/MethodLength
|
62
74
|
|
63
75
|
def annotate_span_with_response!(span, response)
|
64
76
|
return unless response&.code
|
@@ -72,6 +84,14 @@ module OpenTelemetry
|
|
72
84
|
def tracer
|
73
85
|
Net::HTTP::Instrumentation.instance.tracer
|
74
86
|
end
|
87
|
+
|
88
|
+
def untraced?
|
89
|
+
return true if Net::HTTP::Instrumentation.instance.config[:untraced_hosts]&.any? do |host|
|
90
|
+
host.is_a?(Regexp) ? host.match?(@address) : host == @address
|
91
|
+
end
|
92
|
+
|
93
|
+
false
|
94
|
+
end
|
75
95
|
end
|
76
96
|
end
|
77
97
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opentelemetry-instrumentation-net_http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.21.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: 2022-
|
11
|
+
date: 2022-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opentelemetry-api
|
@@ -128,14 +128,14 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: 1.3.0
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
138
|
+
version: 1.3.0
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: simplecov
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -209,14 +209,14 @@ files:
|
|
209
209
|
- lib/opentelemetry/instrumentation/net/http/instrumentation.rb
|
210
210
|
- lib/opentelemetry/instrumentation/net/http/patches/instrumentation.rb
|
211
211
|
- lib/opentelemetry/instrumentation/net/http/version.rb
|
212
|
-
homepage: https://github.com/open-telemetry/opentelemetry-
|
212
|
+
homepage: https://github.com/open-telemetry/opentelemetry-contrib
|
213
213
|
licenses:
|
214
214
|
- Apache-2.0
|
215
215
|
metadata:
|
216
|
-
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-net_http/v0.
|
217
|
-
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/instrumentation/net_http
|
218
|
-
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
|
219
|
-
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-net_http/v0.
|
216
|
+
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby-contrib/opentelemetry-instrumentation-net_http/v0.21.0/file.CHANGELOG.html
|
217
|
+
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/net_http
|
218
|
+
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
|
219
|
+
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby-contrib/opentelemetry-instrumentation-net_http/v0.21.0
|
220
220
|
post_install_message:
|
221
221
|
rdoc_options: []
|
222
222
|
require_paths:
|