opentelemetry-instrumentation-sidekiq 0.14.0 → 0.19.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 +43 -11
- data/README.md +12 -3
- data/lib/opentelemetry/instrumentation/sidekiq.rb +1 -0
- data/lib/opentelemetry/instrumentation/sidekiq/instrumentation.rb +8 -0
- data/lib/opentelemetry/instrumentation/sidekiq/middlewares/client/tracer_middleware.rb +16 -20
- data/lib/opentelemetry/instrumentation/sidekiq/middlewares/server/tracer_middleware.rb +40 -25
- data/lib/opentelemetry/instrumentation/sidekiq/patches/launcher.rb +3 -1
- data/lib/opentelemetry/instrumentation/sidekiq/patches/poller.rb +3 -1
- data/lib/opentelemetry/instrumentation/sidekiq/patches/processor.rb +4 -2
- data/lib/opentelemetry/instrumentation/sidekiq/version.rb +1 -1
- metadata +25 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a07180b8cf8e274f010b270dcd31129902ba821387750a47b3d85273dbb7138a
|
4
|
+
data.tar.gz: 2c62278ba1b6f870e23d20a860b5d18c79b9f250007e8842ba456b77c3e03aec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb7ff5f33f16783fd12ac40067c407d4bdce82e5c44b0700351b06b945a285457ef42a5bf51343a4ab9a788e0b78180832bc50aee7c55c930e212133760b70aa
|
7
|
+
data.tar.gz: 52ea34f638e98a2597a6ad33833dc97fe6ddf60b6636f72a2ba95c10a7549684aac2aae2d59107f3bad71f94a8dd284cac2e42aed42486beedd11d025872c541
|
data/CHANGELOG.md
CHANGED
@@ -1,16 +1,48 @@
|
|
1
1
|
# Release History: opentelemetry-instrumentation-sidekiq
|
2
2
|
|
3
|
+
### v0.19.0 / 2021-06-23
|
4
|
+
|
5
|
+
* BREAKING CHANGE: Sidekiq propagation config
|
6
|
+
- Config option enable_job_class_span_names renamed to span_naming and now expects a symbol of value :job_class, or :queue
|
7
|
+
- The default behaviour is no longer to have one continuous trace for the enqueue and process spans, using links is the new default. To maintain the previous behaviour the config option propagation_style must be set to :child.
|
8
|
+
* BREAKING CHANGE: Total order constraint on span.status=
|
9
|
+
|
10
|
+
* FIXED: Sidekiq propagation config
|
11
|
+
* FIXED: Total order constraint on span.status=
|
12
|
+
|
13
|
+
### v0.18.0 / 2021-05-21
|
14
|
+
|
15
|
+
* ADDED: Updated API depedency for 1.0.0.rc1
|
16
|
+
* TEST: update test for redis instrumentation refactor [#760](https://github.com/open-telemetry/opentelemetry-ruby/pull/760)
|
17
|
+
* BREAKING CHANGE: Remove optional parent_context from in_span
|
18
|
+
|
19
|
+
* FIXED: Remove optional parent_context from in_span
|
20
|
+
* FIXED: Instrument Redis more thoroughly by patching Client#process.
|
21
|
+
|
22
|
+
### v0.17.0 / 2021-04-22
|
23
|
+
|
24
|
+
* ADDED: Accept config for sidekiq peer service attribute
|
25
|
+
|
26
|
+
### v0.16.0 / 2021-03-17
|
27
|
+
|
28
|
+
* FIXED: Example scripts now reference local common lib
|
29
|
+
* DOCS: Replace Gitter with GitHub Discussions
|
30
|
+
|
31
|
+
### v0.15.0 / 2021-02-18
|
32
|
+
|
33
|
+
* ADDED: Add instrumentation config validation
|
34
|
+
|
3
35
|
### v0.14.0 / 2021-02-03
|
4
36
|
|
5
|
-
* BREAKING CHANGE: Replace getter and setter callables and remove rack specific propagators
|
37
|
+
* BREAKING CHANGE: Replace getter and setter callables and remove rack specific propagators
|
6
38
|
|
7
|
-
* ADDED: Replace getter and setter callables and remove rack specific propagators
|
39
|
+
* ADDED: Replace getter and setter callables and remove rack specific propagators
|
8
40
|
|
9
41
|
### v0.13.0 / 2021-01-29
|
10
42
|
|
11
|
-
* ADDED: Instrument sidekiq background work
|
12
|
-
* FIXED: Adjust Sidekiq middlewares to match semantic conventions
|
13
|
-
* FIXED: Set minimum compatible version and use untraced helper
|
43
|
+
* ADDED: Instrument sidekiq background work
|
44
|
+
* FIXED: Adjust Sidekiq middlewares to match semantic conventions
|
45
|
+
* FIXED: Set minimum compatible version and use untraced helper
|
14
46
|
|
15
47
|
### v0.12.0 / 2020-12-24
|
16
48
|
|
@@ -18,7 +50,7 @@
|
|
18
50
|
|
19
51
|
### v0.11.0 / 2020-12-11
|
20
52
|
|
21
|
-
* FIXED: Copyright comments to not reference year
|
53
|
+
* FIXED: Copyright comments to not reference year
|
22
54
|
|
23
55
|
### v0.10.0 / 2020-12-03
|
24
56
|
|
@@ -26,9 +58,9 @@
|
|
26
58
|
|
27
59
|
### v0.9.0 / 2020-11-27
|
28
60
|
|
29
|
-
* BREAKING CHANGE: Add timeout for force_flush and shutdown
|
61
|
+
* BREAKING CHANGE: Add timeout for force_flush and shutdown
|
30
62
|
|
31
|
-
* ADDED: Add timeout for force_flush and shutdown
|
63
|
+
* ADDED: Add timeout for force_flush and shutdown
|
32
64
|
|
33
65
|
### v0.8.0 / 2020-10-27
|
34
66
|
|
@@ -36,9 +68,9 @@
|
|
36
68
|
|
37
69
|
### v0.7.0 / 2020-10-07
|
38
70
|
|
39
|
-
* DOCS: Adding README for Sidekiq instrumentation
|
40
|
-
* DOCS: Remove duplicate reference in Sidekiq README
|
41
|
-
* DOCS: Standardize toplevel docs structure and readme
|
71
|
+
* DOCS: Adding README for Sidekiq instrumentation
|
72
|
+
* DOCS: Remove duplicate reference in Sidekiq README
|
73
|
+
* DOCS: Standardize toplevel docs structure and readme
|
42
74
|
|
43
75
|
### v0.6.0 / 2020-09-10
|
44
76
|
|
data/README.md
CHANGED
@@ -33,11 +33,20 @@ end
|
|
33
33
|
|
34
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
|
+
## Development
|
37
|
+
|
38
|
+
You'll need Redis installed locally to run the test suite. Once you've
|
39
|
+
installed it, it will start and stop automatically when you run `rake`.
|
40
|
+
|
41
|
+
```
|
42
|
+
redis-server test/redis.conf
|
43
|
+
```
|
44
|
+
|
45
|
+
## How can I get involved?
|
37
46
|
|
38
47
|
The `opentelemetry-instrumentation-sidekiq` gem source is [on github][repo-github], along with related gems including `opentelemetry-api` and `opentelemetry-sdk`.
|
39
48
|
|
40
|
-
The OpenTelemetry Ruby gems are maintained by the OpenTelemetry-Ruby special interest group (SIG). You can get involved by joining us
|
49
|
+
The OpenTelemetry Ruby gems are maintained by the OpenTelemetry-Ruby special interest group (SIG). You can get involved by joining us in [GitHub Discussions][discussions-url] or attending our weekly meeting. See the [meeting calendar][community-meetings] for dates and times. For more information on this and other language SIGs, see the OpenTelemetry [community page][ruby-sig].
|
41
50
|
|
42
51
|
## License
|
43
52
|
|
@@ -49,4 +58,4 @@ The `opentelemetry-instrumentation-sidekiq` gem is distributed under the Apache
|
|
49
58
|
[license-github]: https://github.com/open-telemetry/opentelemetry-ruby/blob/main/LICENSE
|
50
59
|
[ruby-sig]: https://github.com/open-telemetry/community#ruby-sig
|
51
60
|
[community-meetings]: https://github.com/open-telemetry/community#community-meetings
|
52
|
-
[
|
61
|
+
[discussions-url]: https://github.com/open-telemetry/opentelemetry-ruby/discussions
|
@@ -27,6 +27,14 @@ module OpenTelemetry
|
|
27
27
|
gem_version >= MINIMUM_VERSION
|
28
28
|
end
|
29
29
|
|
30
|
+
option :span_naming, default: :queue, validate: ->(opt) { %I[job_class queue].include?(opt) }
|
31
|
+
option :propagation_style, default: :link, validate: ->(opt) { %i[link child none].include?(opt) }
|
32
|
+
option :trace_launcher_heartbeat, default: false, validate: :boolean
|
33
|
+
option :trace_poller_enqueue, default: false, validate: :boolean
|
34
|
+
option :trace_poller_wait, default: false, validate: :boolean
|
35
|
+
option :trace_processor_process_one, default: false, validate: :boolean
|
36
|
+
option :peer_service, default: nil, validate: :string
|
37
|
+
|
30
38
|
private
|
31
39
|
|
32
40
|
def gem_version
|
@@ -12,18 +12,22 @@ module OpenTelemetry
|
|
12
12
|
# TracerMiddleware propagates context and instruments Sidekiq client
|
13
13
|
# by way of its middleware system
|
14
14
|
class TracerMiddleware
|
15
|
-
def call(_worker_class, job, _queue, _redis_pool)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
15
|
+
def call(_worker_class, job, _queue, _redis_pool) # rubocop:disable Metrics/AbcSize
|
16
|
+
attributes = {
|
17
|
+
'messaging.system' => 'sidekiq',
|
18
|
+
'messaging.sidekiq.job_class' => job['wrapped']&.to_s || job['class'],
|
19
|
+
'messaging.message_id' => job['jid'],
|
20
|
+
'messaging.destination' => job['queue'],
|
21
|
+
'messaging.destination_kind' => 'queue'
|
22
|
+
}
|
23
|
+
attributes['peer.service'] = config[:peer_service] if config[:peer_service]
|
24
|
+
|
25
|
+
span_name = case config[:span_naming]
|
26
|
+
when :job_class then "#{job['wrapped']&.to_s || job['class']} send"
|
27
|
+
else "#{job['queue']} send"
|
28
|
+
end
|
29
|
+
|
30
|
+
tracer.in_span(span_name, attributes: attributes, kind: :producer) do |span|
|
27
31
|
OpenTelemetry.propagation.inject(job)
|
28
32
|
span.add_event('created_at', timestamp: job['created_at'])
|
29
33
|
yield
|
@@ -32,14 +36,6 @@ module OpenTelemetry
|
|
32
36
|
|
33
37
|
private
|
34
38
|
|
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
39
|
def config
|
44
40
|
Sidekiq::Instrumentation.instance.config
|
45
41
|
end
|
@@ -12,36 +12,51 @@ module OpenTelemetry
|
|
12
12
|
# TracerMiddleware propagates context and instruments Sidekiq requests
|
13
13
|
# by way of its middleware system
|
14
14
|
class TracerMiddleware
|
15
|
-
def call(_worker, msg, _queue)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
'messaging.destination_kind' => 'queue'
|
25
|
-
},
|
26
|
-
with_parent: parent_context,
|
27
|
-
kind: :consumer
|
28
|
-
) do |span|
|
29
|
-
span.add_event('created_at', timestamp: msg['created_at'])
|
30
|
-
span.add_event('enqueued_at', timestamp: msg['enqueued_at'])
|
31
|
-
yield
|
32
|
-
end
|
33
|
-
end
|
15
|
+
def call(_worker, msg, _queue) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
16
|
+
attributes = {
|
17
|
+
'messaging.system' => 'sidekiq',
|
18
|
+
'messaging.sidekiq.job_class' => msg['wrapped']&.to_s || msg['class'],
|
19
|
+
'messaging.message_id' => msg['jid'],
|
20
|
+
'messaging.destination' => msg['queue'],
|
21
|
+
'messaging.destination_kind' => 'queue'
|
22
|
+
}
|
23
|
+
attributes['peer.service'] = config[:peer_service] if config[:peer_service]
|
34
24
|
|
35
|
-
|
25
|
+
span_name = case config[:span_naming]
|
26
|
+
when :job_class then "#{msg['wrapped']&.to_s || msg['class']} process"
|
27
|
+
else "#{msg['queue']} process"
|
28
|
+
end
|
36
29
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
30
|
+
extracted_context = OpenTelemetry.propagation.extract(msg)
|
31
|
+
OpenTelemetry::Context.with_current(extracted_context) do
|
32
|
+
if config[:propagation_style] == :child
|
33
|
+
tracer.in_span(span_name, attributes: attributes, kind: :consumer) do |span|
|
34
|
+
span.add_event('created_at', timestamp: msg['created_at'])
|
35
|
+
span.add_event('enqueued_at', timestamp: msg['enqueued_at'])
|
36
|
+
yield
|
37
|
+
end
|
38
|
+
else
|
39
|
+
links = []
|
40
|
+
span_context = OpenTelemetry::Trace.current_span(extracted_context).context
|
41
|
+
links << OpenTelemetry::Trace::Link.new(span_context) if config[:propagation_style] == :link && span_context.valid?
|
42
|
+
span = tracer.start_root_span(span_name, attributes: attributes, links: links, kind: :consumer)
|
43
|
+
OpenTelemetry::Trace.with_span(span) do
|
44
|
+
span.add_event('created_at', timestamp: msg['created_at'])
|
45
|
+
span.add_event('enqueued_at', timestamp: msg['enqueued_at'])
|
46
|
+
yield
|
47
|
+
rescue Exception => e # rubocop:disable Lint/RescueException
|
48
|
+
span.record_exception(e)
|
49
|
+
span.status = OpenTelemetry::Trace::Status.error("Unhandled exception of type: #{e.class}")
|
50
|
+
raise e
|
51
|
+
ensure
|
52
|
+
span.finish
|
53
|
+
end
|
54
|
+
end
|
42
55
|
end
|
43
56
|
end
|
44
57
|
|
58
|
+
private
|
59
|
+
|
45
60
|
def config
|
46
61
|
Sidekiq::Instrumentation.instance.config
|
47
62
|
end
|
@@ -14,7 +14,9 @@ module OpenTelemetry
|
|
14
14
|
|
15
15
|
def ❤ # rubocop:disable Naming/MethodName
|
16
16
|
if config[:trace_launcher_heartbeat]
|
17
|
-
|
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
|
-
|
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
|
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
|
-
|
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
|
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.19.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-
|
11
|
+
date: 2021-06-24 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.
|
19
|
+
version: 1.0.0.rc2
|
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: 1.0.0.rc2
|
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.
|
33
|
+
version: 0.19.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.
|
40
|
+
version: 0.19.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.18.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.18.1
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: appraisal
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +100,14 @@ dependencies:
|
|
86
100
|
requirements:
|
87
101
|
- - "~>"
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
103
|
+
version: 1.0.0.rc1
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
110
|
+
version: 1.0.0.rc1
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: rubocop
|
99
113
|
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.
|
206
|
+
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-sidekiq/v0.19.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.
|
209
|
+
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-sidekiq/v0.19.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.
|
225
|
+
rubygems_version: 3.1.6
|
212
226
|
signing_key:
|
213
227
|
specification_version: 4
|
214
228
|
summary: Sidekiq instrumentation for the OpenTelemetry framework
|