opentelemetry-instrumentation-rack 0.24.1 → 0.24.3

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: 7787850f41a9a07243cd9d559c21c96cb78a07bf12dd86931d33c2aea2705505
4
- data.tar.gz: 5b792735d2e02eba260d3bff2b38a340fded3947b636ec9d745425990d1560f4
3
+ metadata.gz: 9e0a7aa95948770110e53fd9820a83803bce9d8676651749eae3444ee52e6dec
4
+ data.tar.gz: 79a47cec9234b839e5bb0443ae21ed20089b9b1cf118134c49765e91c6d58a53
5
5
  SHA512:
6
- metadata.gz: c99d1b1f48e3b8830c3ed1fa370200266f1adc31d9c2e4e92693eef3abf350112ad18340386757bb9227c60ccf3f8d7f2b1734d8eb03fd1846a91570e0255b1b
7
- data.tar.gz: 114f33c3a284358343022a578453cc66dacb81ad2652a257c74b178e65a538871f63c59c51e8ed5f1226b600422b35b5c020e0b69874f1f91013de1a7b67224b
6
+ metadata.gz: e419cc2c5588be14db50dec6bfd27713b869e5bfbb14d9c1650415e621474f5935f7176c92a90db77940111b3bc8ca4a992a77abb4b508e03f94dd2a9e9dbe9d
7
+ data.tar.gz: 2f633ddbb221b71857db4925b425c9cc9202431f3ba61e1d32f2cb9438274ceea778a7ce7be6f010d6cb3233ace9f752ad55bdbbf2c720e33fe155301165853f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Release History: opentelemetry-instrumentation-rack
2
2
 
3
+ ### v0.24.3 / 2024-05-08
4
+
5
+ * FIXED: Rack event baggage handling
6
+
7
+ ### v0.24.2 / 2024-04-30
8
+
9
+ * FIXED: Bundler conflict warnings
10
+
3
11
  ### v0.24.1 / 2024-04-05
4
12
 
5
13
  * DOCS: Fix typo where Rake is mentioned instead of Rack
@@ -42,7 +42,7 @@ module OpenTelemetry
42
42
  class EventHandler
43
43
  include ::Rack::Events::Abstract
44
44
 
45
- TOKENS_KEY = 'otel.context.tokens'
45
+ OTEL_TOKEN_AND_SPAN = 'otel.rack.token_and_span'
46
46
  GOOD_HTTP_STATUSES = (100..499)
47
47
 
48
48
  # Creates a server span for this current request using the incoming parent context
@@ -56,7 +56,9 @@ module OpenTelemetry
56
56
 
57
57
  parent_context = extract_remote_context(request)
58
58
  span = create_span(parent_context, request)
59
- request.env[TOKENS_KEY] = register_current_span(span)
59
+ span_ctx = OpenTelemetry::Trace.context_with_span(span, parent_context: parent_context)
60
+ rack_ctx = OpenTelemetry::Instrumentation::Rack.context_with_span(span, parent_context: span_ctx)
61
+ request.env[OTEL_TOKEN_AND_SPAN] = [OpenTelemetry::Context.attach(rack_ctx), span]
60
62
  rescue StandardError => e
61
63
  OpenTelemetry.handle_error(exception: e)
62
64
  end
@@ -108,7 +110,7 @@ module OpenTelemetry
108
110
  rescue StandardError => e
109
111
  OpenTelemetry.handle_error(exception: e)
110
112
  ensure
111
- detach_contexts(request)
113
+ detach_context(request)
112
114
  end
113
115
 
114
116
  private
@@ -191,11 +193,12 @@ module OpenTelemetry
191
193
  attributes
192
194
  end
193
195
 
194
- def detach_contexts(request)
195
- request.env[TOKENS_KEY]&.reverse_each do |token|
196
- OpenTelemetry::Context.detach(token)
197
- OpenTelemetry::Trace.current_span.finish
198
- end
196
+ def detach_context(request)
197
+ return nil unless request.env[OTEL_TOKEN_AND_SPAN]
198
+
199
+ token, span = request.env[OTEL_TOKEN_AND_SPAN]
200
+ span.finish
201
+ OpenTelemetry::Context.detach(token)
199
202
  rescue StandardError => e
200
203
  OpenTelemetry.handle_error(exception: e)
201
204
  end
@@ -244,15 +247,6 @@ module OpenTelemetry
244
247
  OpenTelemetry::Instrumentation::Rack::Instrumentation.instance.config
245
248
  end
246
249
 
247
- def register_current_span(span)
248
- ctx = OpenTelemetry::Trace.context_with_span(span)
249
- rack_ctx = OpenTelemetry::Instrumentation::Rack.context_with_span(span, parent_context: ctx)
250
-
251
- contexts = [ctx, rack_ctx]
252
- contexts.compact!
253
- contexts.map { |context| OpenTelemetry::Context.attach(context) }
254
- end
255
-
256
250
  def create_span(parent_context, request)
257
251
  span = tracer.start_span(
258
252
  create_request_span_name(request),
@@ -7,7 +7,7 @@
7
7
  module OpenTelemetry
8
8
  module Instrumentation
9
9
  module Rack
10
- VERSION = '0.24.1'
10
+ VERSION = '0.24.3'
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.24.1
4
+ version: 0.24.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenTelemetry Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-05 00:00:00.000000000 Z
11
+ date: 2024-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -136,34 +136,6 @@ dependencies:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0.3'
139
- - !ruby/object:Gem::Dependency
140
- name: rack
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- version: '0'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- version: '0'
153
- - !ruby/object:Gem::Dependency
154
- name: rack-test
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - ">="
158
- - !ruby/object:Gem::Version
159
- version: '0'
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - ">="
165
- - !ruby/object:Gem::Version
166
- version: '0'
167
139
  - !ruby/object:Gem::Dependency
168
140
  name: rake
169
141
  requirement: !ruby/object:Gem::Requirement
@@ -286,10 +258,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
286
258
  licenses:
287
259
  - Apache-2.0
288
260
  metadata:
289
- changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-rack/0.24.1/file/CHANGELOG.md
261
+ changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-rack/0.24.3/file/CHANGELOG.md
290
262
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/rack
291
263
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
292
- documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-rack/0.24.1
264
+ documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-rack/0.24.3
293
265
  post_install_message:
294
266
  rdoc_options: []
295
267
  require_paths: