Repository navigation
feat(rails): run ActiveJob reporting through job extensions - #3130
Conversation
75aefea to
243c2a0
Compare
e9dd3a1 to
bb053a7
Compare
bb053a7 to
2fdd2a7
Compare
2fdd2a7 to
0921325
Compare
0921325 to
0411b4d
Compare
0411b4d to
ff06d8b
Compare
ff06d8b to
db6e8f6
Compare
c50b6dd to
f9b1dda
Compare
f9b1dda to
35d5037
Compare
c2a7302 to
c675cb8
Compare
c675cb8 to
fe10802
Compare
7731c01 to
8429ff3
Compare
9ede876 to
65c56c8
Compare
65c56c8 to
7678e20
Compare
7678e20 to
4878f63
Compare
4878f63 to
c5e0f5f
Compare
c5e0f5f to
c45c2e8
Compare
A job extension whose inject_trace_headers returned nil or a non-Hash replaced the serialized payload, so the _sentry merge raised and the rescue handed that value to the queue adapter, failing the enqueue. Use the hook's result only when it is a Hash and fall back to the original payload on any failure.
messaging_data called publish_messaging_data, the reverse of the base extension, so a subclass whose publish_messaging_data built on messaging_data recursed until the stack overflowed. Both hooks now build on a private helper and report the same attributes as before.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f9f85c7. Configure here.
|
|
||
| def self.prepended(base) | ||
| base.attr_accessor :_sentry | ||
| base.attr_reader :_sentry_job_data |
There was a problem hiding this comment.
Public job helper exposes SDK internals
Low Severity
Prepending ActiveJobExtensions now adds a public _sentry_job_data reader on every ActiveJob class. That helper becomes part of the app's job API even though it only exists so the extension can read the serialized payload. SDK state on a job ancestor needs to stay private rather than a public accessor.
Additional Locations (1)
Triggered by learned rule: Prepend patches must keep original visibility
Reviewed by Cursor Bugbot for commit f9f85c7. Configure here.
| end | ||
|
|
||
| begin | ||
| Sentry.with_child_span(op: "queue.publish", description: job.class.name) do |span| |
There was a problem hiding this comment.
Unused reporter capture_exception left behind
Low Severity
SentryReporter.capture_exception now only forwards to the job extension and has no remaining callers. Perform and retry paths both invoke extension.capture_exception directly, so this method is dead code left from the refactor.
Reviewed by Cursor Bugbot for commit f9f85c7. Configure here.


The ActiveJob integration now runs on the job extension API from #3129. Backends subclass
Sentry::Rails::ActiveJobExtensionand register it for their queue adapter:Jobs on an adapter without a registered extension use
ActiveJobExtensionitself. Every job keeps theactive_jobcontext, thequeuetag and ActiveJob's error data. An extension'serror_datais added on top of that.Other changes:
Sentry::Rails.active_job_owns_adapter?(adapter)tells backend gems whether sentry-rails reports jobs for a queue adapter.queue.publishspan returnsfalsefromrecord_publish_span?.messaging.message.body.sizewhen sampled.Closes #3119