feat(active_job): add spans and events for Continuation#2361
Open
bdewater-thatch wants to merge 5 commits into
Open
feat(active_job): add spans and events for Continuation#2361bdewater-thatch wants to merge 5 commits into
bdewater-thatch wants to merge 5 commits into
Conversation
Add tracing support for Rails 8.1 Active Job Continuation steps. Each step in a continuable job gets its own child span under the perform span, with attributes for step name, cursor, resumed, and interrupted state.
Record a span event on the perform (ingress) span when a continuable job resumes from a previous execution, with attributes for resumption count, description, and completed steps.
…tion Record a span event on the perform span when a previously completed step is skipped during a resumed continuable job execution, including the step name as an attribute.
Record a span event on the current span when a continuable job is interrupted, with attributes for the interrupt reason, description, and completed steps.
fa429f2 to
d8fa1a6
Compare
|
|
||
| attributes = { | ||
| 'messaging.active_job.continuation.reason' => payload[:reason].to_s, | ||
| 'messaging.active_job.continuation.description' => payload[:description] |
Contributor
There was a problem hiding this comment.
Suggested change
| 'messaging.active_job.continuation.description' => payload[:description] | |
| 'rails.active_job.continuation.description' => payload[:description] |
|
|
||
| attributes = @mapper.call(payload).merge( | ||
| 'messaging.active_job.step.name' => step_name, | ||
| 'messaging.active_job.step.resumed' => step.resumed? |
Contributor
There was a problem hiding this comment.
Suggested change
| 'messaging.active_job.step.resumed' => step.resumed? | |
| 'rails.active_job.step.resumed' => step.resumed? |
Perhaps even
Suggested change
| 'messaging.active_job.step.resumed' => step.resumed? | |
| 'rails.active_job.step.state' => step.resumed? 'resumed' : 'started' |
Ideally we would either use rails.active_job.continuation.resumptions so that it can be connected or drop the attribute and use just the event. I think the first option would be better.
Contributor
Author
There was a problem hiding this comment.
Not entirely following this one - are you suggesting to keep state and add resumptions, or replace the former by the latter? Resumptions are counted at the job level, not the step level.
thompson-tomo
approved these changes
May 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rails 8.1 added Active Job Continuation for interruptible and resumable jobs. This PR adds instrumentation for the events emitted when the
stepDSL is used: https://edgeguides.rubyonrails.org/active_support_instrumentation.html#active-job