Add support for Solid Queue#1623
Open
lairtonmendes wants to merge 1 commit into
Open
Conversation
|
💚 CLA has been signed |
Author
Already signed |
lairtonmendes
commented
Jun 7, 2026
|
|
||
| def self.finalize(io) | ||
| proc { io.close } | ||
| proc do |
Author
There was a problem hiding this comment.
The finalizer registered via ObjectSpace.define_finalizer in proxy_pipe.rb calls io.close, which Ruby forbids inside a signal trap context (ThreadError). SolidQueue workers install persistent Signal.trap handlers; if GC runs while a trap is active (triggered by normal allocations mid-job), the finalizer fires in that context and Ruby
prints a warning. Fixed by rescuing ThreadError in the finalizer the fd is reclaimed by the OS on process exit, so skipping silently is safe
c9622e2 to
446ce28
Compare
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.
What does this pull request do?
Adds support for Solid Queue, the
Active Record–backed queue adapter that became the default in Rails 8.
The new spy instruments
SolidQueue::ClaimedExecution#performand produces one APM transaction per job:transaction.name= the job's class name (the wrapped ActiveJob)transaction.type=SolidQueue:queue= the queue the job was claimed fromElasticAPM.reportand mark the transactionoutcome=failureImplementation notes worth surfacing for review:
SolidQueue::ClaimedExecutionlives underapp/modelsand is autoloaded by the Rails engine via Zeitwerk, so the spies'Kernel.requirehook never fires. The prepend is installed insideRails.application.reloader.to_prepare, which both delays installation until the engine's autoload paths are in place and re-applies the patch after dev-mode reloads.Agent#detect_forking!, which runs on everystart_transaction/start_span/reportand rebuilds the agent's background threads in the forked child. No spy-side lifecycle hooks are needed.Gemfilegatesgem 'solid_queue'to Rails ≥ 7.1 so the older Rails matrix entries keep resolving.Why is it important?
Solid Queue is the default Active Job adapter in Rails 8 and is the queue shipped by
rails newfor every new Rails app from 8.0 onward. Without this instrumentation, jobs executed by solid_queue produce no APM transactions, leaving an entire class of work invisible in Kibana.Checklist
rubocopclean on the new files)spec/elastic_apm/spies/solid_queue_spec.rb, 6 examples covering success, failure, queue label, multi-perform, prepend, and graceful no-op when agent is not running)bundle exec rspec spec/elastic_apm/spies/→ 110 examples, 0 failures)docs/release-notes/index.mddocs/reference/supported-technologies.mdVerification
End-to-end smoke test against a Rails 8.1 app using
solid_queueas theActive Job adapter, with traces captured by a mock APM server:
Agent#detect_forking!.Related issues
N/A