opentelemetry-instrumentation-active_job 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c2e9236d8c64df8e2ea878722f318bdaf1e01089bc3e74f88cf304de94adba0b
|
|
4
|
+
data.tar.gz: ba1166e899d9c8ed206f32ba124f96a7cf74e6262cab75a1061d5e7985c38a3b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c759ce3906d212b3fe8aa052ba9b31ce7fd7c096bafb5802b5c379db8b7fcfcb18dd0c0ed26dd559dc96dd93eb6ad99b26e97fa7b3a22af57000a104f86ec04d
|
|
7
|
+
data.tar.gz: 341e276950ce03997a2626f83e8264f4b2f4dd2fc5ce4f76c1f676688c2559cb803c1370a1208f3c263e7a518a6c9793fb4435004937c6385654adb7c1b224fd
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Release History: opentelemetry-instrumentation-active_job
|
|
2
2
|
|
|
3
|
+
## v0.13.0 / 2026-06-16
|
|
4
|
+
|
|
5
|
+
- ADDED: Add spans for Continuation (#2361)
|
|
6
|
+
- ADDED: Add step.active_job span handler for Continuation
|
|
7
|
+
|
|
3
8
|
## v0.12.0 / 2026-04-28
|
|
4
9
|
|
|
5
10
|
- BREAKING CHANGE: Min Rails 7.1 (enforced this time) (#2283)
|
data/README.md
CHANGED
|
@@ -69,6 +69,7 @@ See the table below for details of what [Rails Framework Hook Events](https://gu
|
|
|
69
69
|
| `perform.active_job` | :white_check_mark: | Creates an ingress span with kind `consumer` |
|
|
70
70
|
| `retry_stopped.active_job` | :white_check_mark: | Creates and `internal` span with an `exception` event |
|
|
71
71
|
| `discard.active_job` | :white_check_mark: | Creates and `internal` span with an `exception` event |
|
|
72
|
+
| `step.active_job` | :white_check_mark: | Creates an `internal` span |
|
|
72
73
|
|
|
73
74
|
## Semantic Conventions
|
|
74
75
|
|
|
@@ -88,6 +89,13 @@ Attributes that are specific to this instrumentation are recorded under `messagi
|
|
|
88
89
|
| `messaging.active_job.message.priority` | String | Present when set by the client from `ActiveJob#priority` |
|
|
89
90
|
| `messaging.active_job.message.provider_job_id` | String | Present if the underlying adapter has backend specific message ids |
|
|
90
91
|
|
|
92
|
+
For jobs including the `ActiveJob::Continuable` module, the following attributes are added to spans created for a `step`:
|
|
93
|
+
|
|
94
|
+
| `messaging.active_job.step.name` | String | Step name |
|
|
95
|
+
| `messaging.active_job.step.state` | String | Either `started` or `resumed` |
|
|
96
|
+
| `messaging.active_job.step.result` | String | Static value set to `interrupted` if the job was interrupted |
|
|
97
|
+
| `messaging.active_job.step.cursor` | String | The persisted value after calling `step.set!` or `step.advance!` |
|
|
98
|
+
|
|
91
99
|
## Differences between ActiveJob versions
|
|
92
100
|
|
|
93
101
|
### ActiveJob 6.1
|
|
@@ -0,0 +1,63 @@
|
|
|
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 ActiveJob
|
|
10
|
+
module Handlers
|
|
11
|
+
# Handles step.active_job to generate child spans for continuable job steps
|
|
12
|
+
class Step < Default
|
|
13
|
+
# Overrides the `Default#start_span` method to create a child span
|
|
14
|
+
# for a continuable job step
|
|
15
|
+
#
|
|
16
|
+
# @param name [String] of the Event
|
|
17
|
+
# @param id [String] of the event
|
|
18
|
+
# @param payload [Hash] containing job run information
|
|
19
|
+
# @return [Hash] with the span and generated context tokens
|
|
20
|
+
def start_span(name, _id, payload)
|
|
21
|
+
job = payload.fetch(:job)
|
|
22
|
+
job_name = job.class.name
|
|
23
|
+
step = payload.fetch(:step)
|
|
24
|
+
step_name = step.name.to_s
|
|
25
|
+
|
|
26
|
+
attributes = @mapper.call(payload).merge(
|
|
27
|
+
'messaging.active_job.step.name' => step_name,
|
|
28
|
+
'messaging.active_job.step.state' => step.resumed? ? 'resumed' : 'started'
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
span = tracer.start_span("#{step_name} #{job_name}", attributes: attributes)
|
|
32
|
+
token = OpenTelemetry::Context.attach(OpenTelemetry::Trace.context_with_span(span))
|
|
33
|
+
|
|
34
|
+
{ span: span, ctx_token: token }
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Overrides the `Default#finish` method to record step-specific
|
|
38
|
+
# attributes before closing the span
|
|
39
|
+
#
|
|
40
|
+
# @param _name [String] of the Event (unused)
|
|
41
|
+
# @param _id [String] of the event (unused)
|
|
42
|
+
# @param payload [Hash] containing job run information
|
|
43
|
+
def finish(_name, _id, payload)
|
|
44
|
+
otel = payload.delete(:__otel)
|
|
45
|
+
span = otel&.fetch(:span)
|
|
46
|
+
token = otel&.fetch(:ctx_token)
|
|
47
|
+
|
|
48
|
+
step = payload.fetch(:step)
|
|
49
|
+
span&.set_attribute('messaging.active_job.step.result', 'interrupted') if payload[:interrupted]
|
|
50
|
+
span&.set_attribute('messaging.active_job.step.cursor', step.cursor.to_s) if step.cursor
|
|
51
|
+
|
|
52
|
+
# Continuation::Interrupt is control flow, not a real error — skip recording it
|
|
53
|
+
on_exception(payload[:error] || payload[:exception_object], span) unless payload[:interrupted]
|
|
54
|
+
rescue StandardError => e
|
|
55
|
+
OpenTelemetry.handle_error(exception: e)
|
|
56
|
+
ensure
|
|
57
|
+
finish_span(span, token)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
@@ -8,6 +8,7 @@ require_relative 'mappers/attribute'
|
|
|
8
8
|
require_relative 'handlers/default'
|
|
9
9
|
require_relative 'handlers/enqueue'
|
|
10
10
|
require_relative 'handlers/perform'
|
|
11
|
+
require_relative 'handlers/step'
|
|
11
12
|
|
|
12
13
|
module OpenTelemetry
|
|
13
14
|
module Instrumentation
|
|
@@ -27,6 +28,7 @@ module OpenTelemetry
|
|
|
27
28
|
# - perform
|
|
28
29
|
# - retry_stopped
|
|
29
30
|
# - discard
|
|
31
|
+
# - step (Continuations, Rails 8.1+)
|
|
30
32
|
#
|
|
31
33
|
# Ingress and Egress spans (perform, enqueue, enqueue_at) use Messaging semantic conventions for naming the span,
|
|
32
34
|
# while internal spans keep their ActiveSupport event name.
|
|
@@ -48,6 +50,7 @@ module OpenTelemetry
|
|
|
48
50
|
default_handler = Handlers::Default.new(parent_span_provider, mapper, config)
|
|
49
51
|
enqueue_handler = Handlers::Enqueue.new(parent_span_provider, mapper, config)
|
|
50
52
|
perform_handler = Handlers::Perform.new(parent_span_provider, mapper, config)
|
|
53
|
+
step_handler = Handlers::Step.new(parent_span_provider, mapper, config)
|
|
51
54
|
|
|
52
55
|
handlers_by_pattern = {
|
|
53
56
|
'enqueue' => enqueue_handler,
|
|
@@ -55,7 +58,8 @@ module OpenTelemetry
|
|
|
55
58
|
'enqueue_retry' => default_handler,
|
|
56
59
|
'perform' => perform_handler,
|
|
57
60
|
'retry_stopped' => default_handler,
|
|
58
|
-
'discard' => default_handler
|
|
61
|
+
'discard' => default_handler,
|
|
62
|
+
'step' => step_handler
|
|
59
63
|
}
|
|
60
64
|
|
|
61
65
|
@subscriptions = handlers_by_pattern.map do |key, handler|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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.13.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- OpenTelemetry Authors
|
|
@@ -41,6 +41,7 @@ files:
|
|
|
41
41
|
- lib/opentelemetry/instrumentation/active_job/handlers/default.rb
|
|
42
42
|
- lib/opentelemetry/instrumentation/active_job/handlers/enqueue.rb
|
|
43
43
|
- lib/opentelemetry/instrumentation/active_job/handlers/perform.rb
|
|
44
|
+
- lib/opentelemetry/instrumentation/active_job/handlers/step.rb
|
|
44
45
|
- lib/opentelemetry/instrumentation/active_job/instrumentation.rb
|
|
45
46
|
- lib/opentelemetry/instrumentation/active_job/mappers/attribute.rb
|
|
46
47
|
- lib/opentelemetry/instrumentation/active_job/patches/base.rb
|
|
@@ -49,10 +50,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
|
|
|
49
50
|
licenses:
|
|
50
51
|
- Apache-2.0
|
|
51
52
|
metadata:
|
|
52
|
-
changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-active_job/0.
|
|
53
|
-
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/opentelemetry-instrumentation-active_job/v0.
|
|
53
|
+
changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-active_job/0.13.0/file/CHANGELOG.md
|
|
54
|
+
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/opentelemetry-instrumentation-active_job/v0.13.0/instrumentation/active_job
|
|
54
55
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
|
|
55
|
-
documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-active_job/0.
|
|
56
|
+
documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-active_job/0.13.0
|
|
56
57
|
rdoc_options: []
|
|
57
58
|
require_paths:
|
|
58
59
|
- lib
|
|
@@ -67,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
67
68
|
- !ruby/object:Gem::Version
|
|
68
69
|
version: '0'
|
|
69
70
|
requirements: []
|
|
70
|
-
rubygems_version: 4.0.
|
|
71
|
+
rubygems_version: 4.0.10
|
|
71
72
|
specification_version: 4
|
|
72
73
|
summary: ActiveJob instrumentation for the OpenTelemetry framework
|
|
73
74
|
test_files: []
|