opentelemetry-instrumentation-faraday 0.24.6 → 0.24.8
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d77c32dd025abec6065c2178b3bb4f5b8b1e30f8346c144c90a69f842fe0e94
|
4
|
+
data.tar.gz: d2b7de74cb08ba24ea51979f8766b357255ce9154d71cb9fcf4cbc28d074bd06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: affd8957e6074906a6471b0341d66e5f0df2e7b646994ed4940939270509a41cc1287faa0171d0c00b95aa0c3908c574ce9d28b27ab16c124458d3ff78c037e2
|
7
|
+
data.tar.gz: d3cfa506f11913c13bc71ca202f124821399ac2066993d69b06a052a176a8475ac708f968449e4b42dfe59a7679f5796f68c752f268a7d9b33d99dca28f3c700
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Release History: opentelemetry-instrumentation-faraday
|
2
2
|
|
3
|
+
### v0.24.8 / 2024-12-17
|
4
|
+
|
5
|
+
* FIXED: Share Faraday Attrs with Adapter Spans
|
6
|
+
|
7
|
+
### v0.24.7 / 2024-11-26
|
8
|
+
|
9
|
+
* CHANGED: Performance Freeze all range objects #1222
|
10
|
+
|
3
11
|
### v0.24.6 / 2024-07-23
|
4
12
|
|
5
13
|
* DOCS: Add cspell to CI
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@ The OpenTelemetry Faraday Ruby gem is a community maintained instrumentation for
|
|
6
6
|
|
7
7
|
Install the gem using:
|
8
8
|
|
9
|
-
```
|
9
|
+
```console
|
10
10
|
gem install opentelemetry-instrumentation-faraday
|
11
11
|
```
|
12
12
|
|
@@ -38,7 +38,7 @@ Example usage of faraday can be seen in the `./example/faraday.rb` file [here](h
|
|
38
38
|
|
39
39
|
The `opentelemetry-instrumentation-faraday` gem source is [on github][repo-github], along with related gems including `opentelemetry-api` and `opentelemetry-sdk`.
|
40
40
|
|
41
|
-
The OpenTelemetry Ruby gems are maintained by the OpenTelemetry
|
41
|
+
The OpenTelemetry Ruby gems are maintained by the OpenTelemetry Ruby special interest group (SIG). You can get involved by joining us on our [GitHub Discussions][discussions-url], [Slack Channel][slack-channel] or attending our weekly meeting. See the [meeting calendar][community-meetings] for dates and times. For more information on this and other language SIGs, see the OpenTelemetry [community page][ruby-sig].
|
42
42
|
|
43
43
|
## License
|
44
44
|
|
@@ -50,4 +50,5 @@ Apache 2.0 license. See [LICENSE][license-github] for more information.
|
|
50
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
|
+
[slack-channel]: https://cloud-native.slack.com/archives/C01NWKKMKMY
|
53
54
|
[discussions-url]: https://github.com/open-telemetry/opentelemetry-ruby/discussions
|
@@ -9,7 +9,7 @@ module OpenTelemetry
|
|
9
9
|
module Faraday
|
10
10
|
module Middlewares
|
11
11
|
# TracerMiddleware propagates context and instruments Faraday requests
|
12
|
-
# by way of its
|
12
|
+
# by way of its middleware system
|
13
13
|
class TracerMiddleware < ::Faraday::Middleware
|
14
14
|
HTTP_METHODS_SYMBOL_TO_STRING = {
|
15
15
|
connect: 'CONNECT',
|
@@ -23,6 +23,9 @@ module OpenTelemetry
|
|
23
23
|
trace: 'TRACE'
|
24
24
|
}.freeze
|
25
25
|
|
26
|
+
# Constant for the HTTP status range
|
27
|
+
HTTP_STATUS_SUCCESS_RANGE = (100..399)
|
28
|
+
|
26
29
|
def call(env)
|
27
30
|
http_method = HTTP_METHODS_SYMBOL_TO_STRING[env.method]
|
28
31
|
config = Faraday::Instrumentation.instance.config
|
@@ -30,31 +33,34 @@ module OpenTelemetry
|
|
30
33
|
attributes = span_creation_attributes(
|
31
34
|
http_method: http_method, url: env.url, config: config
|
32
35
|
)
|
33
|
-
tracer.in_span(
|
34
|
-
"HTTP #{http_method}", attributes: attributes, kind: config.fetch(:span_kind)
|
35
|
-
) do |span|
|
36
|
-
OpenTelemetry.propagation.inject(env.request_headers)
|
37
36
|
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
OpenTelemetry::Common::HTTP::ClientContext.with_attributes(attributes) do |attrs, _|
|
38
|
+
tracer.in_span(
|
39
|
+
"HTTP #{http_method}", attributes: attrs, kind: config.fetch(:span_kind)
|
40
|
+
) do |span|
|
41
|
+
OpenTelemetry.propagation.inject(env.request_headers)
|
42
|
+
|
43
|
+
app.call(env).on_complete { |resp| trace_response(span, resp.status) }
|
44
|
+
rescue ::Faraday::Error => e
|
45
|
+
trace_response(span, e.response[:status]) if e.response
|
41
46
|
|
42
|
-
|
47
|
+
raise
|
48
|
+
end
|
43
49
|
end
|
44
50
|
end
|
45
51
|
|
46
52
|
private
|
47
53
|
|
48
54
|
def span_creation_attributes(http_method:, url:, config:)
|
49
|
-
|
55
|
+
attrs = {
|
50
56
|
'http.method' => http_method,
|
51
57
|
'http.url' => OpenTelemetry::Common::Utilities.cleanse_url(url.to_s),
|
52
58
|
'faraday.adapter.name' => app.class.name
|
53
59
|
}
|
54
|
-
|
55
|
-
|
60
|
+
attrs['net.peer.name'] = url.host if url.host
|
61
|
+
attrs['peer.service'] = config[:peer_service] if config[:peer_service]
|
56
62
|
|
57
|
-
|
63
|
+
attrs.merge!(
|
58
64
|
OpenTelemetry::Common::HTTP::ClientContext.attributes
|
59
65
|
)
|
60
66
|
end
|
@@ -68,7 +74,7 @@ module OpenTelemetry
|
|
68
74
|
|
69
75
|
def trace_response(span, status)
|
70
76
|
span.set_attribute('http.status_code', status)
|
71
|
-
span.status = OpenTelemetry::Trace::Status.error unless
|
77
|
+
span.status = OpenTelemetry::Trace::Status.error unless HTTP_STATUS_SUCCESS_RANGE.cover?(status.to_i)
|
72
78
|
end
|
73
79
|
end
|
74
80
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opentelemetry-instrumentation-faraday
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.24.
|
4
|
+
version: 0.24.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OpenTelemetry Authors
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opentelemetry-api
|
@@ -114,28 +114,28 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 1.
|
117
|
+
version: 1.69.1
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 1.
|
124
|
+
version: 1.69.1
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: rubocop-performance
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: 1.23.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.23.0
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: simplecov
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,14 +156,14 @@ dependencies:
|
|
156
156
|
requirements:
|
157
157
|
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
159
|
+
version: 3.24.0
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version:
|
166
|
+
version: 3.24.0
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: yard
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -201,11 +201,11 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
|
|
201
201
|
licenses:
|
202
202
|
- Apache-2.0
|
203
203
|
metadata:
|
204
|
-
changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-faraday/0.24.
|
204
|
+
changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-faraday/0.24.8/file/CHANGELOG.md
|
205
205
|
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/faraday
|
206
206
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
|
207
|
-
documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-faraday/0.24.
|
208
|
-
post_install_message:
|
207
|
+
documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-faraday/0.24.8
|
208
|
+
post_install_message:
|
209
209
|
rdoc_options: []
|
210
210
|
require_paths:
|
211
211
|
- lib
|
@@ -221,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
221
221
|
version: '0'
|
222
222
|
requirements: []
|
223
223
|
rubygems_version: 3.2.33
|
224
|
-
signing_key:
|
224
|
+
signing_key:
|
225
225
|
specification_version: 4
|
226
226
|
summary: Faraday instrumentation for the OpenTelemetry framework
|
227
227
|
test_files: []
|