opentelemetry-instrumentation-sidekiq 0.18.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 +10 -0
- data/lib/opentelemetry/instrumentation/sidekiq/instrumentation.rb +2 -1
- data/lib/opentelemetry/instrumentation/sidekiq/middlewares/client/tracer_middleware.rb +12 -22
- data/lib/opentelemetry/instrumentation/sidekiq/middlewares/server/tracer_middleware.rb +33 -25
- data/lib/opentelemetry/instrumentation/sidekiq/version.rb +1 -1
- metadata +10 -10
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,5 +1,15 @@
|
|
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
|
+
|
3
13
|
### v0.18.0 / 2021-05-21
|
4
14
|
|
5
15
|
* ADDED: Updated API depedency for 1.0.0.rc1
|
@@ -27,7 +27,8 @@ module OpenTelemetry
|
|
27
27
|
gem_version >= MINIMUM_VERSION
|
28
28
|
end
|
29
29
|
|
30
|
-
option :
|
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) }
|
31
32
|
option :trace_launcher_heartbeat, default: false, validate: :boolean
|
32
33
|
option :trace_poller_enqueue, default: false, validate: :boolean
|
33
34
|
option :trace_poller_wait, default: false, validate: :boolean
|
@@ -12,21 +12,7 @@ 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
|
-
tracer.in_span(
|
17
|
-
span_name(job),
|
18
|
-
attributes: build_attributes(job),
|
19
|
-
kind: :producer
|
20
|
-
) do |span|
|
21
|
-
OpenTelemetry.propagation.inject(job)
|
22
|
-
span.add_event('created_at', timestamp: job['created_at'])
|
23
|
-
yield
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def build_attributes(job)
|
15
|
+
def call(_worker_class, job, _queue, _redis_pool) # rubocop:disable Metrics/AbcSize
|
30
16
|
attributes = {
|
31
17
|
'messaging.system' => 'sidekiq',
|
32
18
|
'messaging.sidekiq.job_class' => job['wrapped']&.to_s || job['class'],
|
@@ -35,17 +21,21 @@ module OpenTelemetry
|
|
35
21
|
'messaging.destination_kind' => 'queue'
|
36
22
|
}
|
37
23
|
attributes['peer.service'] = config[:peer_service] if config[:peer_service]
|
38
|
-
attributes
|
39
|
-
end
|
40
24
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
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|
|
31
|
+
OpenTelemetry.propagation.inject(job)
|
32
|
+
span.add_event('created_at', timestamp: job['created_at'])
|
33
|
+
yield
|
46
34
|
end
|
47
35
|
end
|
48
36
|
|
37
|
+
private
|
38
|
+
|
49
39
|
def config
|
50
40
|
Sidekiq::Instrumentation.instance.config
|
51
41
|
end
|
@@ -12,24 +12,7 @@ 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
|
-
extracted_context = OpenTelemetry.propagation.extract(msg)
|
17
|
-
OpenTelemetry::Context.with_current(extracted_context) do
|
18
|
-
tracer.in_span(
|
19
|
-
span_name(msg),
|
20
|
-
attributes: build_attributes(msg),
|
21
|
-
kind: :consumer
|
22
|
-
) do |span|
|
23
|
-
span.add_event('created_at', timestamp: msg['created_at'])
|
24
|
-
span.add_event('enqueued_at', timestamp: msg['enqueued_at'])
|
25
|
-
yield
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
private
|
31
|
-
|
32
|
-
def build_attributes(msg)
|
15
|
+
def call(_worker, msg, _queue) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
33
16
|
attributes = {
|
34
17
|
'messaging.system' => 'sidekiq',
|
35
18
|
'messaging.sidekiq.job_class' => msg['wrapped']&.to_s || msg['class'],
|
@@ -38,17 +21,42 @@ module OpenTelemetry
|
|
38
21
|
'messaging.destination_kind' => 'queue'
|
39
22
|
}
|
40
23
|
attributes['peer.service'] = config[:peer_service] if config[:peer_service]
|
41
|
-
attributes
|
42
|
-
end
|
43
24
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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
|
29
|
+
|
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
|
49
55
|
end
|
50
56
|
end
|
51
57
|
|
58
|
+
private
|
59
|
+
|
52
60
|
def config
|
53
61
|
Sidekiq::Instrumentation.instance.config
|
54
62
|
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,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.0.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: 1.0.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
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: opentelemetry-instrumentation-base
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.18.
|
47
|
+
version: 0.18.1
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.18.
|
54
|
+
version: 0.18.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: appraisal
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -203,10 +203,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
|
|
203
203
|
licenses:
|
204
204
|
- Apache-2.0
|
205
205
|
metadata:
|
206
|
-
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
|
207
207
|
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/instrumentation/sidekiq
|
208
208
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
|
209
|
-
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
|
210
210
|
post_install_message:
|
211
211
|
rdoc_options: []
|
212
212
|
require_paths:
|