Skip to content

Commit

Permalink
squash: Abandon all hope ye who perform_start
Browse files Browse the repository at this point in the history
  • Loading branch information
arielvalentin committed Sep 30, 2023
1 parent 97a3f5f commit 891fb32
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,11 @@ def initialize(...)
mapper = AttributeMapper.new
default_handler = DefaultHandler.new(tracer, mapper)
enqueue_handler = EnqueueHandler.new(tracer, mapper)
# Rails 7 uses `perform` as the ingress point to the job
# Rails 6 uses `perform_start` as the ingress point of the job
consumer_event = Gem::Requirement.create('< 7').satisfied_by?(::ActiveJob.version) ? 'perform_start.active_job' : 'perform.active_job'

@handlers_by_pattern = {
'enqueue.active_job' => enqueue_handler,
'enqueue_at.active_job' => enqueue_handler,
consumer_event => PerformHandler.new(tracer, mapper)
'perform.active_job' => PerformHandler.new(tracer, mapper)
}
@handlers_by_pattern.default = default_handler
end
Expand All @@ -122,7 +119,11 @@ def initialize(...)
def enqueue_at(...); end
def enqueue(...); end
def enqueue_retry(...); end
def perform_start(...); end
# This event causes much heartache as it is the first in a series of events that is triggered.
# It should not be the ingress span because it does not measure anything.
# https://github.com/rails/rails/blob/v6.1.7.6/activejob/lib/active_job/instrumentation.rb#L14
# https://github.com/rails/rails/blob/v7.0.8/activejob/lib/active_job/instrumentation.rb#L19
# def perform_start(...); end
def perform(...); end
def retry_stopped(...); end
def discard(...); end
Expand Down

0 comments on commit 891fb32

Please sign in to comment.