opentelemetry-instrumentation-sidekiq 0.16.0 → 0.17.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: d779ad028fa986d96d8fedbb6581e7ad2063825be89ef787eea19619391ea146
4
- data.tar.gz: 6164415d7a74c9b0434bda0c62884ccd44bdd84cdc6ea0cf91f4f38d51631b30
3
+ metadata.gz: 16931c87c910aace5d938407321eb6fc832d36b7436c2f8ac4721da5532bccea
4
+ data.tar.gz: da9d93ce6c105f7dcbb12a165dd0bc5a8fb9f8b73b2ed0362c7636c8e7aba0f1
5
5
  SHA512:
6
- metadata.gz: 3591cffe3495f539bf38010579f91ee9b37489e5ea14b77d20dc0c173653c2eb25db14143ea47b2a0cd25e315296f67cad3d02469a91cb3eeefec0e969814c2a
7
- data.tar.gz: a4c8b87b71de42f7588fcf947c4b27671060ba9046879ee4ba4be193b2ef10ea65bfec9374df6744f8d01e8d000306517a6774d5ebfbaf14bda376a8d3762bb9
6
+ metadata.gz: f6d91a5b9d207640e9a50d5f9770831c7b8c61d28d29da75de83d3de40ed8054029f1538947afddda8001bfa1ccd02fd202f5fab015818aee5c92c56983b5a93
7
+ data.tar.gz: 1f9b9e0de5512199abf9ad29335e510920583bbb5ec37e7fba26e34a3f992d6b9758b260acd2ad01219a211168306a475776761a7d6d5d66994483b7c6c090a5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Release History: opentelemetry-instrumentation-sidekiq
2
2
 
3
+ ### v0.17.0 / 2021-04-22
4
+
5
+ * ADDED: Accept config for sidekiq peer service attribute
6
+
3
7
  ### v0.16.0 / 2021-03-17
4
8
 
5
9
  * FIXED: Example scripts now reference local common lib
@@ -5,6 +5,7 @@
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
7
7
  require 'opentelemetry'
8
+ require 'opentelemetry-instrumentation-base'
8
9
 
9
10
  module OpenTelemetry
10
11
  module Instrumentation
@@ -32,6 +32,7 @@ module OpenTelemetry
32
32
  option :trace_poller_enqueue, default: false, validate: :boolean
33
33
  option :trace_poller_wait, default: false, validate: :boolean
34
34
  option :trace_processor_process_one, default: false, validate: :boolean
35
+ option :peer_service, default: nil, validate: :string
35
36
 
36
37
  private
37
38
 
@@ -15,13 +15,7 @@ module OpenTelemetry
15
15
  def call(_worker_class, job, _queue, _redis_pool)
16
16
  tracer.in_span(
17
17
  span_name(job),
18
- attributes: {
19
- 'messaging.system' => 'sidekiq',
20
- 'messaging.sidekiq.job_class' => job['wrapped']&.to_s || job['class'],
21
- 'messaging.message_id' => job['jid'],
22
- 'messaging.destination' => job['queue'],
23
- 'messaging.destination_kind' => 'queue'
24
- },
18
+ attributes: build_attributes(job),
25
19
  kind: :producer
26
20
  ) do |span|
27
21
  OpenTelemetry.propagation.inject(job)
@@ -32,6 +26,18 @@ module OpenTelemetry
32
26
 
33
27
  private
34
28
 
29
+ def build_attributes(job)
30
+ attributes = {
31
+ 'messaging.system' => 'sidekiq',
32
+ 'messaging.sidekiq.job_class' => job['wrapped']&.to_s || job['class'],
33
+ 'messaging.message_id' => job['jid'],
34
+ 'messaging.destination' => job['queue'],
35
+ 'messaging.destination_kind' => 'queue'
36
+ }
37
+ attributes['peer.service'] = config[:peer_service] if config[:peer_service]
38
+ attributes
39
+ end
40
+
35
41
  def span_name(job)
36
42
  if config[:enable_job_class_span_names]
37
43
  "#{job['wrapped']&.to_s || job['class']} enqueue"
@@ -16,13 +16,7 @@ module OpenTelemetry
16
16
  parent_context = OpenTelemetry.propagation.extract(msg)
17
17
  tracer.in_span(
18
18
  span_name(msg),
19
- attributes: {
20
- 'messaging.system' => 'sidekiq',
21
- 'messaging.sidekiq.job_class' => msg['wrapped']&.to_s || msg['class'],
22
- 'messaging.message_id' => msg['jid'],
23
- 'messaging.destination' => msg['queue'],
24
- 'messaging.destination_kind' => 'queue'
25
- },
19
+ attributes: build_attributes(msg),
26
20
  with_parent: parent_context,
27
21
  kind: :consumer
28
22
  ) do |span|
@@ -34,6 +28,18 @@ module OpenTelemetry
34
28
 
35
29
  private
36
30
 
31
+ def build_attributes(msg)
32
+ attributes = {
33
+ 'messaging.system' => 'sidekiq',
34
+ 'messaging.sidekiq.job_class' => msg['wrapped']&.to_s || msg['class'],
35
+ 'messaging.message_id' => msg['jid'],
36
+ 'messaging.destination' => msg['queue'],
37
+ 'messaging.destination_kind' => 'queue'
38
+ }
39
+ attributes['peer.service'] = config[:peer_service] if config[:peer_service]
40
+ attributes
41
+ end
42
+
37
43
  def span_name(msg)
38
44
  if config[:enable_job_class_span_names]
39
45
  "#{msg['wrapped']&.to_s || msg['class']} process"
@@ -14,7 +14,9 @@ module OpenTelemetry
14
14
 
15
15
  def ❤ # rubocop:disable Naming/MethodName
16
16
  if config[:trace_launcher_heartbeat]
17
- tracer.in_span('Sidekiq::Launcher#heartbeat') { super }
17
+ attributes = {}
18
+ attributes['peer.service'] = config[:peer_service] if config[:peer_service]
19
+ tracer.in_span('Sidekiq::Launcher#heartbeat', attributes: attributes) { super }
18
20
  else
19
21
  OpenTelemetry::Common::Utilities.untraced { super }
20
22
  end
@@ -12,7 +12,9 @@ module OpenTelemetry
12
12
  module Poller
13
13
  def enqueue
14
14
  if config[:trace_poller_enqueue]
15
- tracer.in_span('Sidekiq::Scheduled::Poller#enqueue') { super }
15
+ attributes = {}
16
+ attributes['peer.service'] = config[:peer_service] if config[:peer_service]
17
+ tracer.in_span('Sidekiq::Scheduled::Poller#enqueue', attributes: attributes) { super }
16
18
  else
17
19
  OpenTelemetry::Common::Utilities.untraced { super }
18
20
  end
@@ -8,13 +8,15 @@ module OpenTelemetry
8
8
  module Instrumentation
9
9
  module Sidekiq
10
10
  module Patches
11
- # The Processor module contains the insturmentation for the process_one method
11
+ # The Processor module contains the instrumentation for the process_one method
12
12
  module Processor
13
13
  private
14
14
 
15
15
  def process_one
16
16
  if config[:trace_processor_process_one]
17
- tracer.in_span('Sidekiq::Processor#process_one') { super }
17
+ attributes = {}
18
+ attributes['peer.service'] = config[:peer_service] if config[:peer_service]
19
+ tracer.in_span('Sidekiq::Processor#process_one', attributes: attributes) { super }
18
20
  else
19
21
  OpenTelemetry::Common::Utilities.untraced { super }
20
22
  end
@@ -7,7 +7,7 @@
7
7
  module OpenTelemetry
8
8
  module Instrumentation
9
9
  module Sidekiq
10
- VERSION = '0.16.0'
10
+ VERSION = '0.17.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-sidekiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.17.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: 2021-03-22 00:00:00.000000000 Z
11
+ date: 2021-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -16,28 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.16.0
19
+ version: 0.17.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.16.0
26
+ version: 0.17.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: opentelemetry-common
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.16.0
33
+ version: 0.17.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.16.0
40
+ version: 0.17.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: opentelemetry-instrumentation-base
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.17.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.17.0
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: appraisal
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -189,10 +203,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
189
203
  licenses:
190
204
  - Apache-2.0
191
205
  metadata:
192
- changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-sidekiq/v0.16.0/file.CHANGELOG.html
206
+ changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-sidekiq/v0.17.0/file.CHANGELOG.html
193
207
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/instrumentation/sidekiq
194
208
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
195
- documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-sidekiq/v0.16.0
209
+ documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-sidekiq/v0.17.0
196
210
  post_install_message:
197
211
  rdoc_options: []
198
212
  require_paths:
@@ -208,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
208
222
  - !ruby/object:Gem::Version
209
223
  version: '0'
210
224
  requirements: []
211
- rubygems_version: 3.1.4
225
+ rubygems_version: 3.1.6
212
226
  signing_key:
213
227
  specification_version: 4
214
228
  summary: Sidekiq instrumentation for the OpenTelemetry framework