opentelemetry-instrumentation-rack 0.24.2 → 0.24.4

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: 16d2ecb73620544cae656f0eb4915e8dc74292a5bd76a9be27e1a125e9c1966e
4
- data.tar.gz: 97af5d4b06a3fee698709bc64b06455147d31327673f59e1733d79980d85a256
3
+ metadata.gz: ce07b0f6a44bd97b178e213c298bb798de5db2f7e91496e38d3a8f8a75e18516
4
+ data.tar.gz: df6a2ed4bd011c2aa5fdc50ae986620670100d64f59501f16036ca9136b74944
5
5
  SHA512:
6
- metadata.gz: 237bae7518c29ca6f0b7db4f8814b1f2a49215a029915475d161e991acdba6253888eb934326a443c3e35d6a0557360a667edefd51e06d9748a35340fe61f042
7
- data.tar.gz: c08d5155f0ea009fc43717b77ae5fef6a5ef7e9d133a87edc2fa65b1c84ce0701785a7638d40c082ccda3f12b288b30fcacd786b8a6668a3962f8802f5c44c2a
6
+ metadata.gz: 8024e212d2088b35d2b91f95ed917cbaa061a05f90274d690d8ef74bbbb312acdbb8f08257fb3deed5106ebebb0ed67748c1ac3ad42b33550412d95c2ce632be
7
+ data.tar.gz: 4cc04477eb0f189dfe64e5110edf9926e0e8d6b67fa8b60c630f5ed12cce607282aef36f7ab48524c443f1de51b4077eba80b520775ea07883b9ed6e9a71b10b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Release History: opentelemetry-instrumentation-rack
2
2
 
3
+ ### v0.24.4 / 2024-05-09
4
+
5
+ * FIXED: Untrace entire request
6
+
7
+ ### v0.24.3 / 2024-05-08
8
+
9
+ * FIXED: Rack event baggage handling
10
+
3
11
  ### v0.24.2 / 2024-04-30
4
12
 
5
13
  * FIXED: Bundler conflict warnings
@@ -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
@@ -52,11 +52,16 @@ module OpenTelemetry
52
52
  # @param [Rack::Response] This is nil in practice
53
53
  # @return [void]
54
54
  def on_start(request, _)
55
- return if untraced_request?(request.env)
55
+ parent_context = if untraced_request?(request.env)
56
+ extract_remote_context(request, OpenTelemetry::Common::Utilities.untraced)
57
+ else
58
+ extract_remote_context(request)
59
+ end
56
60
 
57
- parent_context = extract_remote_context(request)
58
61
  span = create_span(parent_context, request)
59
- request.env[TOKENS_KEY] = register_current_span(span)
62
+ span_ctx = OpenTelemetry::Trace.context_with_span(span, parent_context: parent_context)
63
+ rack_ctx = OpenTelemetry::Instrumentation::Rack.context_with_span(span, parent_context: span_ctx)
64
+ request.env[OTEL_TOKEN_AND_SPAN] = [OpenTelemetry::Context.attach(rack_ctx), span]
60
65
  rescue StandardError => e
61
66
  OpenTelemetry.handle_error(exception: e)
62
67
  end
@@ -108,7 +113,7 @@ module OpenTelemetry
108
113
  rescue StandardError => e
109
114
  OpenTelemetry.handle_error(exception: e)
110
115
  ensure
111
- detach_contexts(request)
116
+ detach_context(request)
112
117
  end
113
118
 
114
119
  private
@@ -171,9 +176,10 @@ module OpenTelemetry
171
176
  end
172
177
  end
173
178
 
174
- def extract_remote_context(request)
179
+ def extract_remote_context(request, context = Context.current)
175
180
  OpenTelemetry.propagation.extract(
176
181
  request.env,
182
+ context: context,
177
183
  getter: OpenTelemetry::Common::Propagation.rack_env_getter
178
184
  )
179
185
  end
@@ -191,11 +197,12 @@ module OpenTelemetry
191
197
  attributes
192
198
  end
193
199
 
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
200
+ def detach_context(request)
201
+ return nil unless request.env[OTEL_TOKEN_AND_SPAN]
202
+
203
+ token, span = request.env[OTEL_TOKEN_AND_SPAN]
204
+ span.finish
205
+ OpenTelemetry::Context.detach(token)
199
206
  rescue StandardError => e
200
207
  OpenTelemetry.handle_error(exception: e)
201
208
  end
@@ -244,15 +251,6 @@ module OpenTelemetry
244
251
  OpenTelemetry::Instrumentation::Rack::Instrumentation.instance.config
245
252
  end
246
253
 
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
254
  def create_span(parent_context, request)
257
255
  span = tracer.start_span(
258
256
  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.2'
10
+ VERSION = '0.24.4'
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.2
4
+ version: 0.24.4
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-30 00:00:00.000000000 Z
11
+ date: 2024-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.20.0
33
+ version: 0.21.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.20.0
40
+ version: 0.21.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: opentelemetry-instrumentation-base
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -258,10 +258,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
258
258
  licenses:
259
259
  - Apache-2.0
260
260
  metadata:
261
- changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-rack/0.24.2/file/CHANGELOG.md
261
+ changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-rack/0.24.4/file/CHANGELOG.md
262
262
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/rack
263
263
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
264
- documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-rack/0.24.2
264
+ documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-rack/0.24.4
265
265
  post_install_message:
266
266
  rdoc_options: []
267
267
  require_paths: