Skip to content

Commit

Permalink
squash: treat enqueue at like a publisher span
Browse files Browse the repository at this point in the history
  • Loading branch information
arielvalentin committed Sep 28, 2023
1 parent fad08bc commit 46423d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def to_otel_semconv_attributes(job)
'messaging.message_id' => job.job_id,
'rails.active_job.execution.counter' => job.executions + 1,
'rails.active_job.provider_job_id' => job.provider_job_id,
'rails.active_job.priority' => job.priority
'rails.active_job.priority' => job.priority,
'rails.active_job.scheduled_at' => job.scheduled_at
}

otel_attributes['net.transport'] = 'inproc' if test_adapters.include?(job.class.queue_adapter_name)
Expand Down Expand Up @@ -104,8 +105,10 @@ def initialize(...)
super
tracer = Instrumentation.instance.tracer
default_handler = DefaultHandler.new(tracer)
enqueue_handler = EnqueueHandler.new(tracer)
@handlers_by_pattern = {
'enqueue.active_job' => EnqueueHandler.new(tracer),
'enqueue.active_job' => enqueue_handler,
'enqueue_at.active_job' => enqueue_handler,
'perform.active_job' => PerformHandler.new(tracer)
}
@handlers_by_pattern.default = default_handler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,18 +157,15 @@
end
end

=begin
it 'is set correctly for jobs that do wait' do
job = TestJob.set(wait: 0.second).perform_later

# Only the sending span is a 'scheduled' thing
_(publish_span.attributes['messaging.active_job.scheduled_at']).must_equal(job.scheduled_at)
assert(publish_span.attributes['messaging.active_job.scheduled_at'])
_(publish_span.attributes['rails.active_job.scheduled_at']).must_equal(job.scheduled_at)

# The processing span isn't a 'scheduled' thing
_(process_span.attributes['messaging.active_job.scheduled_at']).must_be_nil
_(process_span.attributes['rails.active_job.scheduled_at']).must_be_nil
end
=end
end

describe 'messaging.system' do
Expand Down

0 comments on commit 46423d6

Please sign in to comment.