opentelemetry-instrumentation-active_job 0.7.3 → 0.7.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: 6596ca74536a5ebd8fbff3e7529c419eaf1ae8338228916d6392c9f437f5874a
4
- data.tar.gz: 9cb094923456136ea279f8f12dfb9b21973d71478c95ea3f29f4af0ddc2cd925
3
+ metadata.gz: 1891d4bd1469e53cf227e6dd45ce33af844c7d993fbde60564d25189f00ae614
4
+ data.tar.gz: 847dca4d8748a754c1afb83260dbad467a3b9efc2d9a758297441551ad659c68
5
5
  SHA512:
6
- metadata.gz: a3f8de8a994f503e226b18afe81a5dac2df0d98d0eb915b8c164777c50332836f29278b6af595ad7f93afb3c1d3436257034bf6e150914cdc572dbe76f31f6cc
7
- data.tar.gz: 189ec1ed576d3c7320bf3b633088934ed8aa1aec8c4f5530459e573f87e8fc63a829a329498082919ce5827ef05de092a0720f830887747a697ed5cc71c9f534
6
+ metadata.gz: b2523337eb8e3bb71900cc056e1976c63bb80f9ba19155167bccf153a83db4964e29b373dc96805ed8594dbf367acb3dd459307ef940794e0ff4194335f66652
7
+ data.tar.gz: 17ccc797815874557a36b8a20af8caa26ce918f5ba6f007b0131fe3fa3c2c537f7d25459ec6b49b55b29b4370587505d04ad82f98f5ed0a844e918d1c326dcec
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Release History: opentelemetry-instrumentation-active_job
2
2
 
3
+ ### v0.7.4 / 2024-07-30
4
+
5
+ * FIXED: Honour dynamic changes in configuration
6
+
3
7
  ### v0.7.3 / 2024-07-22
4
8
 
5
9
  * FIXED: ActiveJob::Handlers.unsubscribe
@@ -10,15 +10,6 @@ module OpenTelemetry
10
10
  module Handlers
11
11
  # Handles `enqueue.active_job` and `enqueue_at.active_job` to generate egress spans
12
12
  class Enqueue < Default
13
- def initialize(...)
14
- super
15
- @span_name_formatter = if @config[:span_naming] == :job_class
16
- ->(job) { "#{job.class.name} publish" }
17
- else
18
- ->(job) { "#{job.queue_name} publish" }
19
- end
20
- end
21
-
22
13
  # Overrides the `Default#start_span` method to create an egress span
23
14
  # and registers it with the current context
24
15
  #
@@ -28,10 +19,22 @@ module OpenTelemetry
28
19
  # @return [Hash] with the span and generated context tokens
29
20
  def start_span(name, _id, payload)
30
21
  job = payload.fetch(:job)
31
- span = tracer.start_span(@span_name_formatter.call(job), kind: :producer, attributes: @mapper.call(payload))
22
+ span = tracer.start_span(span_name(job), kind: :producer, attributes: @mapper.call(payload))
32
23
  OpenTelemetry.propagation.inject(job.__otel_headers) # This must be transmitted over the wire
33
24
  { span: span, ctx_token: OpenTelemetry::Context.attach(OpenTelemetry::Trace.context_with_span(span)) }
34
25
  end
26
+
27
+ private
28
+
29
+ def span_name(job)
30
+ prefix = if @config[:span_naming] == :job_class
31
+ job.class.name
32
+ else
33
+ job.queue_name
34
+ end
35
+
36
+ "#{prefix} publish"
37
+ end
35
38
  end
36
39
  end
37
40
  end
@@ -10,15 +10,6 @@ module OpenTelemetry
10
10
  module Handlers
11
11
  # Handles perform.active_job to generate ingress spans
12
12
  class Perform < Default
13
- def initialize(...)
14
- super
15
- @span_name_formatter = if @config[:span_naming] == :job_class
16
- ->(job) { "#{job.class.name} process" }
17
- else
18
- ->(job) { "#{job.queue_name} process" }
19
- end
20
- end
21
-
22
13
  # Overrides the `Default#start_span` method to create an ingress span
23
14
  # and registers it with the current context
24
15
  #
@@ -30,7 +21,7 @@ module OpenTelemetry
30
21
  job = payload.fetch(:job)
31
22
  parent_context = OpenTelemetry.propagation.extract(job.__otel_headers)
32
23
 
33
- span_name = @span_name_formatter.call(job)
24
+ span_name = span_name(job)
34
25
 
35
26
  # TODO: Refactor into a propagation strategy
36
27
  propagation_style = @config[:propagation_style]
@@ -57,6 +48,18 @@ module OpenTelemetry
57
48
 
58
49
  OpenTelemetry::Context.attach(internal_context)
59
50
  end
51
+
52
+ private
53
+
54
+ def span_name(job)
55
+ prefix = if @config[:span_naming] == :job_class
56
+ job.class.name
57
+ else
58
+ job.queue_name
59
+ end
60
+
61
+ "#{prefix} process"
62
+ end
60
63
  end
61
64
  end
62
65
  end
@@ -7,7 +7,7 @@
7
7
  module OpenTelemetry
8
8
  module Instrumentation
9
9
  module ActiveJob
10
- VERSION = '0.7.3'
10
+ VERSION = '0.7.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-active_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.7.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-07-22 00:00:00.000000000 Z
11
+ date: 2024-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -232,10 +232,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
232
232
  licenses:
233
233
  - Apache-2.0
234
234
  metadata:
235
- changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-active_job/0.7.3/file/CHANGELOG.md
235
+ changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-active_job/0.7.4/file/CHANGELOG.md
236
236
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/active_job
237
237
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
238
- documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-active_job/0.7.3
238
+ documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-active_job/0.7.4
239
239
  post_install_message:
240
240
  rdoc_options: []
241
241
  require_paths: