opentelemetry-instrumentation-active_job 0.7.0 → 0.7.2

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: beffc5272c390fbbd9ea98797106691f5e48d45b4f82cbd41c40856e051bab2b
4
- data.tar.gz: 98a1656bebf82443f7ba8a7fd6037f05c260ba41d2430fd8376e7ebe073ef113
3
+ metadata.gz: 807743f1d99ab374f13bfe585b5b08446e21385c00ce1e57ea11e03de587c8d3
4
+ data.tar.gz: 3e17adc59557e2a7bcfb19c1f2ae7039aedeba599cf91e127cf8a063296bcc46
5
5
  SHA512:
6
- metadata.gz: 49516a6e6edc52fc8c431d3ee99c707e61c4c5437fb3c3c4fe13658e544528a0299ba645e8f5d413dc6bb2297d0d2d5d792b1421ce639aa339ac3aaecc739207
7
- data.tar.gz: dc85ceb2997eccf9557fd22b25f90fe78892c0663b6d19ce80355d0b19721970b13a9ce861dc38b26e360eee484601dc7cc93d4c6dd45a842a7f3ef3d6286f5c
6
+ metadata.gz: 56d09fcfd8fef7d5d2b575a55cd8b2cdb952892f946726fac6636bf4b4453a48cb4d1704873c6753058bc88a16cd29fd0e7f8eee14c992bebaf9b544e7906d84
7
+ data.tar.gz: 9b158893c3b9c4fff339cba8d051fd69045d1547df43686cfac26c85f92314861b8fda09ade92464e5552c4f6fe815c1a4975a4e3c19069ff64cbd34a236fe9c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Release History: opentelemetry-instrumentation-active_job
2
2
 
3
+ ### v0.7.2 / 2024-07-02
4
+
5
+ * DOCS: Fix CHANGELOGs to reflect a past breaking change
6
+
7
+ ### v0.7.1 / 2023-11-23
8
+
9
+ * CHANGED: Applied Rubocop Performance Recommendations [#727](https://github.com/open-telemetry/opentelemetry-ruby-contrib/pull/727)
10
+
3
11
  ### v0.7.0 / 2023-11-22
4
12
 
5
13
  * BREAKING CHANGE: Drop Rails 6.0 EOL
@@ -16,7 +24,7 @@
16
24
 
17
25
  ### v0.6.0 / 2023-09-07
18
26
 
19
- * FIXED: Align messaging instrumentation operation names
27
+ * BREAKING CHANGE: Align messaging instrumentation operation names [#648](https://github.com/open-telemetry/opentelemetry-ruby-contrib/pull/648)
20
28
 
21
29
  ### v0.5.2 / 2023-08-03
22
30
 
@@ -41,9 +41,9 @@ module OpenTelemetry
41
41
  # @return [Hash] with the span and generated context tokens
42
42
  def start_span(name, _id, payload)
43
43
  span = tracer.start_span(name, attributes: @mapper.call(payload))
44
- tokens = [OpenTelemetry::Context.attach(OpenTelemetry::Trace.context_with_span(span))]
44
+ token = OpenTelemetry::Context.attach(OpenTelemetry::Trace.context_with_span(span))
45
45
 
46
- { span: span, ctx_tokens: tokens }
46
+ { span: span, ctx_token: token }
47
47
  end
48
48
 
49
49
  # Creates a span and registers it with the current context
@@ -55,20 +55,20 @@ module OpenTelemetry
55
55
  def finish(_name, _id, payload)
56
56
  otel = payload.delete(:__otel)
57
57
  span = otel&.fetch(:span)
58
- tokens = otel&.fetch(:ctx_tokens)
58
+ token = otel&.fetch(:ctx_token)
59
59
 
60
60
  on_exception((payload[:error] || payload[:exception_object]), span)
61
61
  rescue StandardError => e
62
62
  OpenTelemetry.handle_error(exception: e)
63
63
  ensure
64
- finish_span(span, tokens)
64
+ finish_span(span, token)
65
65
  end
66
66
 
67
67
  # Finishes the provided spans and also detaches the associated contexts
68
68
  #
69
69
  # @param span [OpenTelemetry::Trace::Span]
70
- # @param tokens [Array] to unregister
71
- def finish_span(span, tokens)
70
+ # @param token [Numeric] to unregister
71
+ def finish_span(span, token)
72
72
  # closes the span after all attributes have been finalized
73
73
  begin
74
74
  if span&.recording?
@@ -79,8 +79,7 @@ module OpenTelemetry
79
79
  OpenTelemetry.handle_error(exception: e)
80
80
  end
81
81
 
82
- # pops the context stack
83
- tokens&.reverse&.each do |token|
82
+ begin
84
83
  OpenTelemetry::Context.detach(token)
85
84
  rescue StandardError => e
86
85
  OpenTelemetry.handle_error(exception: e)
@@ -29,9 +29,8 @@ module OpenTelemetry
29
29
  def start_span(name, _id, payload)
30
30
  job = payload.fetch(:job)
31
31
  span = tracer.start_span(@span_name_formatter.call(job), kind: :producer, attributes: @mapper.call(payload))
32
- tokens = [OpenTelemetry::Context.attach(OpenTelemetry::Trace.context_with_span(span))]
33
32
  OpenTelemetry.propagation.inject(job.__otel_headers) # This must be transmitted over the wire
34
- { span: span, ctx_tokens: tokens }
33
+ { span: span, ctx_token: OpenTelemetry::Context.attach(OpenTelemetry::Trace.context_with_span(span)) }
35
34
  end
36
35
  end
37
36
  end
@@ -27,7 +27,6 @@ module OpenTelemetry
27
27
  # @param payload [Hash] containing job run information
28
28
  # @return [Hash] with the span and generated context tokens
29
29
  def start_span(name, _id, payload)
30
- tokens = []
31
30
  job = payload.fetch(:job)
32
31
  parent_context = OpenTelemetry.propagation.extract(job.__otel_headers)
33
32
 
@@ -36,7 +35,6 @@ module OpenTelemetry
36
35
  # TODO: Refactor into a propagation strategy
37
36
  propagation_style = @config[:propagation_style]
38
37
  if propagation_style == :child
39
- tokens << OpenTelemetry::Context.attach(parent_context)
40
38
  span = tracer.start_span(span_name, kind: :consumer, attributes: @mapper.call(payload))
41
39
  else
42
40
  span_context = OpenTelemetry::Trace.current_span(parent_context).context
@@ -44,9 +42,7 @@ module OpenTelemetry
44
42
  span = tracer.start_root_span(span_name, kind: :consumer, attributes: @mapper.call(payload), links: links)
45
43
  end
46
44
 
47
- tokens.concat(attach_consumer_context(span))
48
-
49
- { span: span, ctx_tokens: tokens }
45
+ { span: span, ctx_token: attach_consumer_context(span) }
50
46
  end
51
47
 
52
48
  # This method attaches a span to multiple contexts:
@@ -54,12 +50,12 @@ module OpenTelemetry
54
50
  # This is used later to enrich the ingress span in children, e.g. setting span status to error when a child event like `discard` terminates due to an error
55
51
  # 2. Registers the ingress span as the "active" span, which is the default behavior of the SDK.
56
52
  # @param span [OpenTelemetry::Trace::Span] the currently active span used to record the exception and set the status
57
- # @return [Array] Context tokens that must be detached when finished
53
+ # @return [Numeric] Context token that must be detached when finished
58
54
  def attach_consumer_context(span)
59
55
  consumer_context = OpenTelemetry::Trace.context_with_span(span)
60
56
  internal_context = OpenTelemetry::Instrumentation::ActiveJob.context_with_span(span, parent_context: consumer_context)
61
57
 
62
- [consumer_context, internal_context].map { |context| OpenTelemetry::Context.attach(context) }
58
+ OpenTelemetry::Context.attach(internal_context)
63
59
  end
64
60
  end
65
61
  end
@@ -68,7 +68,7 @@ module OpenTelemetry
68
68
  end
69
69
 
70
70
  def patch_activejob
71
- ::ActiveJob::Base.prepend(Patches::Base) unless ::ActiveJob::Base.ancestors.include?(Patches::Base)
71
+ ::ActiveJob::Base.prepend(Patches::Base) unless ::ActiveJob::Base <= Patches::Base
72
72
 
73
73
  Handlers.subscribe
74
74
  end
@@ -7,7 +7,7 @@
7
7
  module OpenTelemetry
8
8
  module Instrumentation
9
9
  module ActiveJob
10
- VERSION = '0.7.0'
10
+ VERSION = '0.7.2'
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-active_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.2
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-11-22 00:00:00.000000000 Z
11
+ date: 2024-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -142,14 +142,28 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 1.56.1
145
+ version: 1.64.0
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 1.56.1
152
+ version: 1.64.0
153
+ - !ruby/object:Gem::Dependency
154
+ name: rubocop-performance
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '1.20'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '1.20'
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: simplecov
155
169
  requirement: !ruby/object:Gem::Requirement
@@ -218,10 +232,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
218
232
  licenses:
219
233
  - Apache-2.0
220
234
  metadata:
221
- changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-active_job/0.7.0/file/CHANGELOG.md
235
+ changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-active_job/0.7.2/file/CHANGELOG.md
222
236
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/active_job
223
237
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
224
- documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-active_job/0.7.0
238
+ documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-active_job/0.7.2
225
239
  post_install_message:
226
240
  rdoc_options: []
227
241
  require_paths: