opentelemetry-instrumentation-rack 0.23.4 → 0.24.0

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: 980a25e800842fabeb9f244dd99c6adec79247c38804038a429ccae176be334d
4
- data.tar.gz: 1db80b2226fbaa9240b4080376192bc74b929fdcde865963b4a272f66a33c399
3
+ metadata.gz: d11de07129115be6b9af9347c3893327ea18c58b959fe761c86f1eabc94402eb
4
+ data.tar.gz: 27cf79e4ab1bdd60c76a90824da839948deab41ee9d9cc8eb5b4d151cb1abc2e
5
5
  SHA512:
6
- metadata.gz: b46b78d3ce13c4f36981f8d8b890f91a3720d5041931e8d30e9d558586a156d41ccda9d292a2fe5fbfb8f6728a32b6b3120bcd498dbd7abca21d03fd9b9d7b14
7
- data.tar.gz: 5cfdea9ffcf0c0b019e4806ae4cf8d524e45d1caef0c5d6b8ba1068857206fe2b81a2219843757cae255da2067223b05b9acec59ff8acaa6b10c3aeace1c0d18
6
+ metadata.gz: 3c6330ea8a52a55c20e7b62cb6864c784993b7b3a8209ad41812904992d003e8c38d6f9c62096d3cf25c343fea0abf722c5cf978ccc2a826cefbbb4fabd208a5
7
+ data.tar.gz: 87f30078bd1ee4a8c595048754210ecf82d65f7a2d2eb3738f82138a3631faa3dc8108de9beb0ae8840a1fbf7f546fd112a8c03b435bef078315f79e0d6a82f2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Release History: opentelemetry-instrumentation-rack
2
2
 
3
+ ### v0.24.0 / 2024-01-06
4
+
5
+ * BREAKING CHANGE: Use Rack Events By Default
6
+
7
+ * ADDED: Use Rack Events By Default
8
+ * FIXED: Backport Rack proxy event to middleware
9
+
10
+ ### v0.23.5 / 2023-11-23
11
+
12
+ * CHANGED: Applied Rubocop Performance Recommendations [#727](https://github.com/open-telemetry/opentelemetry-ruby-contrib/pull/727)
13
+
3
14
  ### v0.23.4 / 2023-08-03
4
15
 
5
16
  * FIXED: Remove inline linter rules
data/README.md CHANGED
@@ -12,6 +12,19 @@ gem install opentelemetry-instrumentation-rack
12
12
 
13
13
  Or, if you use [bundler][bundler-home], include `opentelemetry-instrumentation-rack` in your `Gemfile`.
14
14
 
15
+ ### Version Compatibility
16
+
17
+ Older versions of Rack are not supported by the latest version of this instrumentation. If you are using an older version of Rack and need an earlier version of this instrumentation, then consider installing and pinning the compatible gem version, e.g.:
18
+
19
+ ```console
20
+ gem opentelemetry-instrumentation-rack, "<version>"
21
+ ```
22
+
23
+ | Rack Version | Instrumentation Version |
24
+ | ------------ | ----------------------- |
25
+ | `< 2.0` | `= 0.22.1` |
26
+ | `>= 2.0` | `~> 0.23` |
27
+
15
28
  ## Usage
16
29
 
17
30
  To use the instrumentation, call `use` with the name of the instrumentation:
@@ -29,6 +42,23 @@ OpenTelemetry::SDK.configure do |c|
29
42
  c.use_all
30
43
  end
31
44
  ```
45
+
46
+ ## Rack Middleware vs Rack Events
47
+
48
+ Since `v0.24.0`, this instrumentation uses `Rake::Events` as opposed to `Middleware` to support Requests that use Buffered Response Bodies.
49
+
50
+ If your application does not support `Rack::Events`, you may disable it by setting `use_rack_events: false`, e.g.
51
+
52
+ ```ruby
53
+ OpenTelemetry::SDK.configure do |c|
54
+ c.use 'OpenTelemetry::Instrumentation::Rack', use_rack_events: false
55
+ end
56
+ ```
57
+
58
+ This will switch to using `Rack::Middleware` by default in dependent instrumentations.
59
+
60
+ See [#342](https://github.com/open-telemetry/opentelemetry-ruby-contrib/pull/342) for more details.
61
+
32
62
  ## Controlling span name cardinality
33
63
 
34
64
  By default we will set the rack span name to match the format "HTTP #{method}" (ie. HTTP GET). There are different ways to control span names with this instrumentation.
@@ -28,8 +28,8 @@ module OpenTelemetry
28
28
  option :url_quantization, default: nil, validate: :callable
29
29
  option :untraced_requests, default: nil, validate: :callable
30
30
  option :response_propagators, default: [], validate: :array
31
- # This option is only valid for applicaitons using Rack 2.0 or greater
32
- option :use_rack_events, default: false, validate: :boolean
31
+ # This option is only valid for applications using Rack 2.0 or greater
32
+ option :use_rack_events, default: true, validate: :boolean
33
33
 
34
34
  # Temporary Helper for Sinatra and ActionPack middleware to use during installation
35
35
  #
@@ -90,7 +90,7 @@ module OpenTelemetry
90
90
  return unless span.recording?
91
91
 
92
92
  span.record_exception(error)
93
- span.status = OpenTelemetry::Trace::Status.error
93
+ span.status = OpenTelemetry::Trace::Status.error(error.class.name)
94
94
  rescue StandardError => e
95
95
  OpenTelemetry.handle_error(exception: e)
96
96
  end
@@ -77,6 +77,8 @@ module OpenTelemetry
77
77
  tracer.in_span(request_span_name,
78
78
  attributes: request_span_attributes(env: env),
79
79
  kind: request_span_kind) do |request_span|
80
+ request_start_time = OpenTelemetry::Instrumentation::Rack::Util::QueueTime.get_request_start(env)
81
+ request_span.add_event('http.proxy.request.started', timestamp: request_start_time) unless request_start_time.nil?
80
82
  OpenTelemetry::Instrumentation::Rack.with_span(request_span) do
81
83
  @app.call(env).tap do |status, headers, response|
82
84
  set_attributes_after_request(request_span, status, headers, response)
@@ -150,7 +152,7 @@ module OpenTelemetry
150
152
  end
151
153
 
152
154
  def set_attributes_after_request(span, status, headers, _response)
153
- span.status = OpenTelemetry::Trace::Status.error unless (100..499).include?(status.to_i)
155
+ span.status = OpenTelemetry::Trace::Status.error unless (100..499).cover?(status.to_i)
154
156
  span.set_attribute('http.status_code', status)
155
157
 
156
158
  # NOTE: if data is available, it would be good to do this:
@@ -7,7 +7,7 @@
7
7
  module OpenTelemetry
8
8
  module Instrumentation
9
9
  module Rack
10
- VERSION = '0.23.4'
10
+ VERSION = '0.24.0'
11
11
  end
12
12
  end
13
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentelemetry-instrumentation-rack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.4
4
+ version: 0.24.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: 2023-08-03 00:00:00.000000000 Z
11
+ date: 2024-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 2.2.0
61
+ version: '2.5'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 2.2.0
68
+ version: '2.5'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -198,70 +198,70 @@ dependencies:
198
198
  requirements:
199
199
  - - "~>"
200
200
  - !ruby/object:Gem::Version
201
- version: 1.55.1
201
+ version: 1.59.0
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
- version: 1.55.1
208
+ version: 1.59.0
209
209
  - !ruby/object:Gem::Dependency
210
- name: simplecov
210
+ name: rubocop-performance
211
211
  requirement: !ruby/object:Gem::Requirement
212
212
  requirements:
213
213
  - - "~>"
214
214
  - !ruby/object:Gem::Version
215
- version: 0.17.1
215
+ version: 1.19.1
216
216
  type: :development
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
220
  - - "~>"
221
221
  - !ruby/object:Gem::Version
222
- version: 0.17.1
222
+ version: 1.19.1
223
223
  - !ruby/object:Gem::Dependency
224
- name: webmock
224
+ name: simplecov
225
225
  requirement: !ruby/object:Gem::Requirement
226
226
  requirements:
227
227
  - - "~>"
228
228
  - !ruby/object:Gem::Version
229
- version: 3.7.6
229
+ version: 0.17.1
230
230
  type: :development
231
231
  prerelease: false
232
232
  version_requirements: !ruby/object:Gem::Requirement
233
233
  requirements:
234
234
  - - "~>"
235
235
  - !ruby/object:Gem::Version
236
- version: 3.7.6
236
+ version: 0.17.1
237
237
  - !ruby/object:Gem::Dependency
238
- name: yard
238
+ name: webmock
239
239
  requirement: !ruby/object:Gem::Requirement
240
240
  requirements:
241
241
  - - "~>"
242
242
  - !ruby/object:Gem::Version
243
- version: '0.9'
243
+ version: '3.19'
244
244
  type: :development
245
245
  prerelease: false
246
246
  version_requirements: !ruby/object:Gem::Requirement
247
247
  requirements:
248
248
  - - "~>"
249
249
  - !ruby/object:Gem::Version
250
- version: '0.9'
250
+ version: '3.19'
251
251
  - !ruby/object:Gem::Dependency
252
- name: yard-doctest
252
+ name: yard
253
253
  requirement: !ruby/object:Gem::Requirement
254
254
  requirements:
255
255
  - - "~>"
256
256
  - !ruby/object:Gem::Version
257
- version: 0.1.6
257
+ version: '0.9'
258
258
  type: :development
259
259
  prerelease: false
260
260
  version_requirements: !ruby/object:Gem::Requirement
261
261
  requirements:
262
262
  - - "~>"
263
263
  - !ruby/object:Gem::Version
264
- version: 0.1.6
264
+ version: '0.9'
265
265
  description: Rack instrumentation for the OpenTelemetry framework
266
266
  email:
267
267
  - cncf-opentelemetry-contributors@lists.cncf.io
@@ -286,10 +286,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
286
286
  licenses:
287
287
  - Apache-2.0
288
288
  metadata:
289
- changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-rack/0.23.4/file/CHANGELOG.md
289
+ changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-rack/0.24.0/file/CHANGELOG.md
290
290
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/rack
291
291
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
292
- documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-rack/0.23.4
292
+ documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-rack/0.24.0
293
293
  post_install_message:
294
294
  rdoc_options: []
295
295
  require_paths: