opentelemetry-instrumentation-sidekiq 0.10.0 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -0
- data/LICENSE +1 -1
- data/README.md +2 -2
- data/lib/opentelemetry-instrumentation-sidekiq.rb +1 -1
- data/lib/opentelemetry/instrumentation.rb +1 -1
- data/lib/opentelemetry/instrumentation/sidekiq.rb +2 -1
- data/lib/opentelemetry/instrumentation/sidekiq/instrumentation.rb +32 -1
- data/lib/opentelemetry/instrumentation/sidekiq/middlewares/client/tracer_middleware.rb +19 -4
- data/lib/opentelemetry/instrumentation/sidekiq/middlewares/server/tracer_middleware.rb +19 -4
- data/lib/opentelemetry/instrumentation/sidekiq/patches/launcher.rb +34 -0
- data/lib/opentelemetry/instrumentation/sidekiq/patches/poller.rb +42 -0
- data/lib/opentelemetry/instrumentation/sidekiq/patches/processor.rb +34 -0
- data/lib/opentelemetry/instrumentation/sidekiq/version.rb +2 -2
- metadata +24 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b47b423da167e94b32a86eaa9cf407e1903b9b65592de432509f3dc16baf8352
|
4
|
+
data.tar.gz: f638e9ade781101950fecd483f0843be24888415f1b2bd017ff0519074e9533e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab5a6394031d48a5d0f5615036ba29ab6401c5daa69abdf54924a4ae495eaaff59d5f3ad1a900ae84d3c328ee15068b95042ac6272426f68226573d8a590de94
|
7
|
+
data.tar.gz: 9bb8b5615861fa1bfcef29d295c80c47db8fcb48bb425534cea7d305ac65a5bdba18076ab3197afe71900046a60131194e3459ac78d166ea0b1825073e930633
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,29 @@
|
|
1
1
|
# Release History: opentelemetry-instrumentation-sidekiq
|
2
2
|
|
3
|
+
### v0.15.0 / 2021-02-18
|
4
|
+
|
5
|
+
* ADDED: Add instrumentation config validation
|
6
|
+
|
7
|
+
### v0.14.0 / 2021-02-03
|
8
|
+
|
9
|
+
* BREAKING CHANGE: Replace getter and setter callables and remove rack specific propagators
|
10
|
+
|
11
|
+
* ADDED: Replace getter and setter callables and remove rack specific propagators
|
12
|
+
|
13
|
+
### v0.13.0 / 2021-01-29
|
14
|
+
|
15
|
+
* ADDED: Instrument sidekiq background work
|
16
|
+
* FIXED: Adjust Sidekiq middlewares to match semantic conventions
|
17
|
+
* FIXED: Set minimum compatible version and use untraced helper
|
18
|
+
|
19
|
+
### v0.12.0 / 2020-12-24
|
20
|
+
|
21
|
+
* (No significant changes)
|
22
|
+
|
23
|
+
### v0.11.0 / 2020-12-11
|
24
|
+
|
25
|
+
* FIXED: Copyright comments to not reference year
|
26
|
+
|
3
27
|
### v0.10.0 / 2020-12-03
|
4
28
|
|
5
29
|
* (No significant changes)
|
data/LICENSE
CHANGED
@@ -186,7 +186,7 @@
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
187
187
|
identification within third-party archives.
|
188
188
|
|
189
|
-
Copyright
|
189
|
+
Copyright The OpenTelemetry Authors
|
190
190
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
192
192
|
you may not use this file except in compliance with the License.
|
data/README.md
CHANGED
@@ -31,7 +31,7 @@ end
|
|
31
31
|
```
|
32
32
|
## Examples
|
33
33
|
|
34
|
-
Example usage can be seen in the `./example/sidekiq.rb` file [here](https://github.com/open-telemetry/opentelemetry-ruby/blob/
|
34
|
+
Example usage can be seen in the `./example/sidekiq.rb` file [here](https://github.com/open-telemetry/opentelemetry-ruby/blob/main/instrumentation/sidekiq/example/sidekiq.rb)
|
35
35
|
|
36
36
|
## How can I get invovled?
|
37
37
|
|
@@ -46,7 +46,7 @@ The `opentelemetry-instrumentation-sidekiq` gem is distributed under the Apache
|
|
46
46
|
[sidekiq-home]: https://github.com/mperham/sidekiq
|
47
47
|
[bundler-home]: https://bundler.io
|
48
48
|
[repo-github]: https://github.com/open-telemetry/opentelemetry-ruby
|
49
|
-
[license-github]: https://github.com/open-telemetry/opentelemetry-ruby/blob/
|
49
|
+
[license-github]: https://github.com/open-telemetry/opentelemetry-ruby/blob/main/LICENSE
|
50
50
|
[ruby-sig]: https://github.com/open-telemetry/community#ruby-sig
|
51
51
|
[community-meetings]: https://github.com/open-telemetry/community#community-meetings
|
52
52
|
[ruby-gitter]: https://gitter.im/open-telemetry/opentelemetry-ruby
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright
|
3
|
+
# Copyright The OpenTelemetry Authors
|
4
4
|
#
|
5
5
|
# SPDX-License-Identifier: Apache-2.0
|
6
6
|
|
@@ -16,3 +16,4 @@ end
|
|
16
16
|
|
17
17
|
require_relative './sidekiq/instrumentation'
|
18
18
|
require_relative './sidekiq/version'
|
19
|
+
require 'opentelemetry/common'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright
|
3
|
+
# Copyright The OpenTelemetry Authors
|
4
4
|
#
|
5
5
|
# SPDX-License-Identifier: Apache-2.0
|
6
6
|
|
@@ -10,21 +10,52 @@ module OpenTelemetry
|
|
10
10
|
# The Instrumentation class contains logic to detect and install the Sidekiq
|
11
11
|
# instrumentation
|
12
12
|
class Instrumentation < OpenTelemetry::Instrumentation::Base
|
13
|
+
MINIMUM_VERSION = Gem::Version.new('4.2.10')
|
14
|
+
|
13
15
|
install do |_config|
|
14
16
|
require_dependencies
|
15
17
|
add_client_middleware
|
16
18
|
add_server_middleware
|
19
|
+
patch_on_startup
|
17
20
|
end
|
18
21
|
|
19
22
|
present do
|
20
23
|
defined?(::Sidekiq)
|
21
24
|
end
|
22
25
|
|
26
|
+
compatible do
|
27
|
+
gem_version >= MINIMUM_VERSION
|
28
|
+
end
|
29
|
+
|
30
|
+
option :enable_job_class_span_names, default: false, validate: :boolean
|
31
|
+
option :trace_launcher_heartbeat, default: false, validate: :boolean
|
32
|
+
option :trace_poller_enqueue, default: false, validate: :boolean
|
33
|
+
option :trace_poller_wait, default: false, validate: :boolean
|
34
|
+
option :trace_processor_process_one, default: false, validate: :boolean
|
35
|
+
|
23
36
|
private
|
24
37
|
|
38
|
+
def gem_version
|
39
|
+
Gem.loaded_specs['sidekiq'].version
|
40
|
+
end
|
41
|
+
|
25
42
|
def require_dependencies
|
26
43
|
require_relative 'middlewares/client/tracer_middleware'
|
27
44
|
require_relative 'middlewares/server/tracer_middleware'
|
45
|
+
|
46
|
+
require_relative 'patches/processor'
|
47
|
+
require_relative 'patches/launcher'
|
48
|
+
require_relative 'patches/poller'
|
49
|
+
end
|
50
|
+
|
51
|
+
def patch_on_startup
|
52
|
+
::Sidekiq.configure_server do |config|
|
53
|
+
config.on(:startup) do
|
54
|
+
::Sidekiq::Processor.prepend(Patches::Processor)
|
55
|
+
::Sidekiq::Launcher.prepend(Patches::Launcher)
|
56
|
+
::Sidekiq::Scheduled::Poller.prepend(Patches::Poller)
|
57
|
+
end
|
58
|
+
end
|
28
59
|
end
|
29
60
|
|
30
61
|
def add_client_middleware
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright
|
3
|
+
# Copyright The OpenTelemetry Authors
|
4
4
|
#
|
5
5
|
# SPDX-License-Identifier: Apache-2.0
|
6
6
|
|
@@ -14,14 +14,17 @@ module OpenTelemetry
|
|
14
14
|
class TracerMiddleware
|
15
15
|
def call(_worker_class, job, _queue, _redis_pool)
|
16
16
|
tracer.in_span(
|
17
|
-
job
|
17
|
+
span_name(job),
|
18
18
|
attributes: {
|
19
|
+
'messaging.system' => 'sidekiq',
|
20
|
+
'messaging.sidekiq.job_class' => job['wrapped']&.to_s || job['class'],
|
19
21
|
'messaging.message_id' => job['jid'],
|
20
|
-
'messaging.destination' => job['queue']
|
22
|
+
'messaging.destination' => job['queue'],
|
23
|
+
'messaging.destination_kind' => 'queue'
|
21
24
|
},
|
22
25
|
kind: :producer
|
23
26
|
) do |span|
|
24
|
-
OpenTelemetry.propagation.
|
27
|
+
OpenTelemetry.propagation.inject(job)
|
25
28
|
span.add_event('created_at', timestamp: job['created_at'])
|
26
29
|
yield
|
27
30
|
end
|
@@ -29,6 +32,18 @@ module OpenTelemetry
|
|
29
32
|
|
30
33
|
private
|
31
34
|
|
35
|
+
def span_name(job)
|
36
|
+
if config[:enable_job_class_span_names]
|
37
|
+
"#{job['wrapped']&.to_s || job['class']} enqueue"
|
38
|
+
else
|
39
|
+
"#{job['queue']} send"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def config
|
44
|
+
Sidekiq::Instrumentation.instance.config
|
45
|
+
end
|
46
|
+
|
32
47
|
def tracer
|
33
48
|
Sidekiq::Instrumentation.instance.tracer
|
34
49
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright
|
3
|
+
# Copyright The OpenTelemetry Authors
|
4
4
|
#
|
5
5
|
# SPDX-License-Identifier: Apache-2.0
|
6
6
|
|
@@ -13,12 +13,15 @@ module OpenTelemetry
|
|
13
13
|
# by way of its middleware system
|
14
14
|
class TracerMiddleware
|
15
15
|
def call(_worker, msg, _queue)
|
16
|
-
parent_context = OpenTelemetry.propagation.
|
16
|
+
parent_context = OpenTelemetry.propagation.extract(msg)
|
17
17
|
tracer.in_span(
|
18
|
-
msg
|
18
|
+
span_name(msg),
|
19
19
|
attributes: {
|
20
|
+
'messaging.system' => 'sidekiq',
|
21
|
+
'messaging.sidekiq.job_class' => msg['wrapped']&.to_s || msg['class'],
|
20
22
|
'messaging.message_id' => msg['jid'],
|
21
|
-
'messaging.destination' => msg['queue']
|
23
|
+
'messaging.destination' => msg['queue'],
|
24
|
+
'messaging.destination_kind' => 'queue'
|
22
25
|
},
|
23
26
|
with_parent: parent_context,
|
24
27
|
kind: :consumer
|
@@ -31,6 +34,18 @@ module OpenTelemetry
|
|
31
34
|
|
32
35
|
private
|
33
36
|
|
37
|
+
def span_name(msg)
|
38
|
+
if config[:enable_job_class_span_names]
|
39
|
+
"#{msg['wrapped']&.to_s || msg['class']} process"
|
40
|
+
else
|
41
|
+
"#{msg['queue']} process"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def config
|
46
|
+
Sidekiq::Instrumentation.instance.config
|
47
|
+
end
|
48
|
+
|
34
49
|
def tracer
|
35
50
|
Sidekiq::Instrumentation.instance.tracer
|
36
51
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright The OpenTelemetry Authors
|
4
|
+
#
|
5
|
+
# SPDX-License-Identifier: Apache-2.0
|
6
|
+
|
7
|
+
module OpenTelemetry
|
8
|
+
module Instrumentation
|
9
|
+
module Sidekiq
|
10
|
+
module Patches
|
11
|
+
# The Launcher module contains the instrumentation for the Sidekiq heartbeat
|
12
|
+
module Launcher
|
13
|
+
private
|
14
|
+
|
15
|
+
def ❤ # rubocop:disable Naming/MethodName
|
16
|
+
if config[:trace_launcher_heartbeat]
|
17
|
+
tracer.in_span('Sidekiq::Launcher#heartbeat') { super }
|
18
|
+
else
|
19
|
+
OpenTelemetry::Common::Utilities.untraced { super }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def tracer
|
24
|
+
Sidekiq::Instrumentation.instance.tracer
|
25
|
+
end
|
26
|
+
|
27
|
+
def config
|
28
|
+
Sidekiq::Instrumentation.instance.config
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright The OpenTelemetry Authors
|
4
|
+
#
|
5
|
+
# SPDX-License-Identifier: Apache-2.0
|
6
|
+
|
7
|
+
module OpenTelemetry
|
8
|
+
module Instrumentation
|
9
|
+
module Sidekiq
|
10
|
+
module Patches
|
11
|
+
# The Poller module contains instrumentation for the enqueue and wait methods
|
12
|
+
module Poller
|
13
|
+
def enqueue
|
14
|
+
if config[:trace_poller_enqueue]
|
15
|
+
tracer.in_span('Sidekiq::Scheduled::Poller#enqueue') { super }
|
16
|
+
else
|
17
|
+
OpenTelemetry::Common::Utilities.untraced { super }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def wait
|
24
|
+
if config[:trace_poller_wait]
|
25
|
+
tracer.in_span('Sidekiq::Scheduled::Poller#wait') { super }
|
26
|
+
else
|
27
|
+
OpenTelemetry::Common::Utilities.untraced { super }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def tracer
|
32
|
+
Sidekiq::Instrumentation.instance.tracer
|
33
|
+
end
|
34
|
+
|
35
|
+
def config
|
36
|
+
Sidekiq::Instrumentation.instance.config
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright The OpenTelemetry Authors
|
4
|
+
#
|
5
|
+
# SPDX-License-Identifier: Apache-2.0
|
6
|
+
|
7
|
+
module OpenTelemetry
|
8
|
+
module Instrumentation
|
9
|
+
module Sidekiq
|
10
|
+
module Patches
|
11
|
+
# The Processor module contains the insturmentation for the process_one method
|
12
|
+
module Processor
|
13
|
+
private
|
14
|
+
|
15
|
+
def process_one
|
16
|
+
if config[:trace_processor_process_one]
|
17
|
+
tracer.in_span('Sidekiq::Processor#process_one') { super }
|
18
|
+
else
|
19
|
+
OpenTelemetry::Common::Utilities.untraced { super }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def tracer
|
24
|
+
Sidekiq::Instrumentation.instance.tracer
|
25
|
+
end
|
26
|
+
|
27
|
+
def config
|
28
|
+
Sidekiq::Instrumentation.instance.config
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright
|
3
|
+
# Copyright The OpenTelemetry Authors
|
4
4
|
#
|
5
5
|
# SPDX-License-Identifier: Apache-2.0
|
6
6
|
|
7
7
|
module OpenTelemetry
|
8
8
|
module Instrumentation
|
9
9
|
module Sidekiq
|
10
|
-
VERSION = '0.
|
10
|
+
VERSION = '0.15.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.
|
4
|
+
version: 0.15.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:
|
11
|
+
date: 2021-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opentelemetry-api
|
@@ -16,14 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.15.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.
|
26
|
+
version: 0.15.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: opentelemetry-common
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.15.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.15.0
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: appraisal
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -167,15 +181,18 @@ files:
|
|
167
181
|
- lib/opentelemetry/instrumentation/sidekiq/instrumentation.rb
|
168
182
|
- lib/opentelemetry/instrumentation/sidekiq/middlewares/client/tracer_middleware.rb
|
169
183
|
- lib/opentelemetry/instrumentation/sidekiq/middlewares/server/tracer_middleware.rb
|
184
|
+
- lib/opentelemetry/instrumentation/sidekiq/patches/launcher.rb
|
185
|
+
- lib/opentelemetry/instrumentation/sidekiq/patches/poller.rb
|
186
|
+
- lib/opentelemetry/instrumentation/sidekiq/patches/processor.rb
|
170
187
|
- lib/opentelemetry/instrumentation/sidekiq/version.rb
|
171
188
|
homepage: https://github.com/open-telemetry/opentelemetry-ruby
|
172
189
|
licenses:
|
173
190
|
- Apache-2.0
|
174
191
|
metadata:
|
175
|
-
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-sidekiq/v0.
|
176
|
-
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/
|
192
|
+
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-sidekiq/v0.15.0/file.CHANGELOG.html
|
193
|
+
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/instrumentation/sidekiq
|
177
194
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
|
178
|
-
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-sidekiq/v0.
|
195
|
+
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-sidekiq/v0.15.0
|
179
196
|
post_install_message:
|
180
197
|
rdoc_options: []
|
181
198
|
require_paths:
|