opentelemetry-instrumentation-active_job 0.1.3 → 0.2.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 +15 -0
- data/lib/opentelemetry/instrumentation/active_job/instrumentation.rb +7 -3
- data/lib/opentelemetry/instrumentation/active_job/patches/active_job_callbacks.rb +36 -35
- data/lib/opentelemetry/instrumentation/active_job/patches/base.rb +1 -1
- data/lib/opentelemetry/instrumentation/active_job/version.rb +1 -1
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf28c56776d6925a23e7a0dd65162cc217c7e5fd4e591b471cd77912241d5f89
|
4
|
+
data.tar.gz: 728c70ce03a1d03f28242dabcee397ce7bd7186f05fd747cd2e3451f6fdc7ab4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35f01f133c73ff36562554d783b890c928f81e24256dbd4c9d91a4b024f4dff4e07e8a853b888d1542aa444f0505774d618b671462d598ab0e19f34169de4ae5
|
7
|
+
data.tar.gz: 9e23409ef225df507335da04b877bb9e82cb3d13569687577ca2f7e1d6e856f26278054740762d521a9e311228364d86a4b6351b740524424afe3c00fc0016d7
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
# Release History: opentelemetry-instrumentation-active_job
|
2
2
|
|
3
|
+
### v0.2.0 / 2022-05-02
|
4
|
+
|
5
|
+
* ADDED: Validate Using Enums
|
6
|
+
* ADDED: Make the context available in ActiveJob notifications
|
7
|
+
* FIXED: Fix deserialization of jobs that are missing metadata
|
8
|
+
* FIXED: RubyGems Fallback
|
9
|
+
|
10
|
+
### v0.1.5 / 2021-12-02
|
11
|
+
|
12
|
+
* (No significant changes)
|
13
|
+
|
14
|
+
### v0.1.4 / 2021-09-29
|
15
|
+
|
16
|
+
* (No significant changes)
|
17
|
+
|
3
18
|
### v0.1.3 / 2021-08-12
|
4
19
|
|
5
20
|
* (No significant changes)
|
@@ -21,7 +21,7 @@ module OpenTelemetry
|
|
21
21
|
end
|
22
22
|
|
23
23
|
compatible do
|
24
|
-
|
24
|
+
gem_version >= MINIMUM_VERSION
|
25
25
|
end
|
26
26
|
|
27
27
|
## Supported configuration keys for the install config hash:
|
@@ -52,12 +52,16 @@ module OpenTelemetry
|
|
52
52
|
# spans will always be children of the enqueueing spans. This is due to the way
|
53
53
|
# ActiveJob immediately executes jobs during the process of "enqueueing" jobs when
|
54
54
|
# using the `:inline` adapter.
|
55
|
-
option :propagation_style, default: :link, validate:
|
55
|
+
option :propagation_style, default: :link, validate: %i[link child none]
|
56
56
|
option :force_flush, default: false, validate: :boolean
|
57
|
-
option :span_naming, default: :queue, validate:
|
57
|
+
option :span_naming, default: :queue, validate: %i[job_class queue]
|
58
58
|
|
59
59
|
private
|
60
60
|
|
61
|
+
def gem_version
|
62
|
+
::ActiveJob.version
|
63
|
+
end
|
64
|
+
|
61
65
|
def require_dependencies
|
62
66
|
require_relative 'patches/base'
|
63
67
|
require_relative 'patches/active_job_callbacks'
|
@@ -10,8 +10,8 @@ module OpenTelemetry
|
|
10
10
|
module Patches
|
11
11
|
# Module to prepend to ActiveJob::Base for instrumentation.
|
12
12
|
module ActiveJobCallbacks
|
13
|
-
def self.prepended(base)
|
14
|
-
base.class_eval do
|
13
|
+
def self.prepended(base)
|
14
|
+
base.class_eval do
|
15
15
|
around_enqueue do |job, block|
|
16
16
|
span_kind = job.class.queue_adapter_name == 'inline' ? :client : :producer
|
17
17
|
span_name = "#{otel_config[:span_naming] == :job_class ? job.class : job.queue_name} send"
|
@@ -21,45 +21,46 @@ module OpenTelemetry
|
|
21
21
|
block.call
|
22
22
|
end
|
23
23
|
end
|
24
|
+
end
|
25
|
+
end
|
24
26
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
27
|
+
def perform_now # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
28
|
+
span_kind = self.class.queue_adapter_name == 'inline' ? :server : :consumer
|
29
|
+
span_name = "#{otel_config[:span_naming] == :job_class ? self.class : queue_name} process"
|
30
|
+
span_attributes = job_attributes(self).merge('messaging.operation' => 'process')
|
31
|
+
executions_count = (executions || 0) + 1 # because we run before the count is incremented in ActiveJob::Execution
|
29
32
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
33
|
+
extracted_context = OpenTelemetry.propagation.extract(metadata)
|
34
|
+
OpenTelemetry::Context.with_current(extracted_context) do
|
35
|
+
if otel_config[:propagation_style] == :child
|
36
|
+
otel_tracer.in_span(span_name, attributes: span_attributes, kind: span_kind) do |span|
|
37
|
+
span.set_attribute('messaging.active_job.executions', executions_count)
|
38
|
+
super
|
39
|
+
end
|
40
|
+
else
|
41
|
+
span_links = []
|
42
|
+
if otel_config[:propagation_style] == :link
|
43
|
+
span_context = OpenTelemetry::Trace.current_span(extracted_context).context
|
44
|
+
span_links << OpenTelemetry::Trace::Link.new(span_context) if span_context.valid?
|
45
|
+
end
|
43
46
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
end
|
55
|
-
end
|
47
|
+
root_span = otel_tracer.start_root_span(span_name, attributes: span_attributes, links: span_links, kind: span_kind)
|
48
|
+
OpenTelemetry::Trace.with_span(root_span) do |span|
|
49
|
+
span.set_attribute('messaging.active_job.executions', executions_count)
|
50
|
+
super
|
51
|
+
rescue Exception => e # rubocop:disable Lint/RescueException
|
52
|
+
span.record_exception(e)
|
53
|
+
span.status = OpenTelemetry::Trace::Status.error("Unhandled exception of type: #{e.class}")
|
54
|
+
raise e
|
55
|
+
ensure
|
56
|
+
root_span.finish
|
56
57
|
end
|
57
|
-
ensure
|
58
|
-
# We may be in a job system (eg: resque) that forks and kills worker processes often.
|
59
|
-
# We don't want to lose spans by not flushing any span processors, so we optionally force it here.
|
60
|
-
OpenTelemetry.tracer_provider.force_flush if otel_config[:force_flush]
|
61
58
|
end
|
62
59
|
end
|
60
|
+
ensure
|
61
|
+
# We may be in a job system (eg: resque) that forks and kills worker processes often.
|
62
|
+
# We don't want to lose spans by not flushing any span processors, so we optionally force it here.
|
63
|
+
OpenTelemetry.tracer_provider.force_flush if otel_config[:force_flush]
|
63
64
|
end
|
64
65
|
|
65
66
|
private
|
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.
|
4
|
+
version: 0.2.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: 2022-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opentelemetry-api
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.0
|
19
|
+
version: '1.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: 1.0
|
26
|
+
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: opentelemetry-instrumentation-base
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.20.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.20.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: activejob
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,16 +98,16 @@ dependencies:
|
|
98
98
|
name: opentelemetry-sdk
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
103
|
+
version: '1.0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
110
|
+
version: '1.0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: pry
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -228,10 +228,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
|
|
228
228
|
licenses:
|
229
229
|
- Apache-2.0
|
230
230
|
metadata:
|
231
|
-
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-active_job/v0.
|
231
|
+
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-active_job/v0.2.0/file.CHANGELOG.html
|
232
232
|
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/instrumentation/active_job
|
233
233
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
|
234
|
-
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-active_job/v0.
|
234
|
+
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-active_job/v0.2.0
|
235
235
|
post_install_message:
|
236
236
|
rdoc_options: []
|
237
237
|
require_paths:
|