Skip to content

Commit

Permalink
squash: docs
Browse files Browse the repository at this point in the history
  • Loading branch information
arielvalentin committed Oct 10, 2023
1 parent 20c177e commit 0b1b9e8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ module ActiveJob
module Handlers
# Handles `enqueue.active_job` and `enqueue_at.active_job` to generate egress spans
class Enqueue < Default

# Overrides the `Default#start_span` method to create an ingress span
# Overrides the `Default#start_span` method to create an egress span
# and registers it with the current context
#
# @param name [String] of the Event
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@ module OpenTelemetry
module Instrumentation
module ActiveJob
module Handlers
# Handles perform.active_job
# Handles perform.active_job to geenrate ingress spans
class Perform < Default
# Overrides the `Default#start_span` method to create an ingress span
# and registers it with the current context
#
# @param name [String] of the Event
# @param id [String] of the event
# @param payload [Hash] containing job run information
# @return [Hash] with the span and generated context tokens
def start_span(name, _id, payload)
tokens = []
parent_context = OpenTelemetry.propagation.extract(payload.fetch(:job).__otel_headers)
Expand Down Expand Up @@ -50,6 +57,7 @@ def span_name_from(payload)
"#{otel_config[:span_naming] == :job_class ? payload.fetch(:job).class.name : payload.fetch(:job).queue_name} process"
end

# TODO: use dependency injection
def otel_config
ActiveJob::Instrumentation.instance.config
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def call(payload)
'messaging.message.id' => job.job_id,
'rails.active_job.execution.counter' => job.executions.to_i,
'rails.active_job.provider_job_id' => job.provider_job_id.to_s,
'rails.active_job.priority' => job.priority,
'rails.active_job.priority' => job.priority, # this can be problematic. Programs may use invalid attributes for priority.
'rails.active_job.scheduled_at' => job.scheduled_at&.to_f
}

Expand Down

0 comments on commit 0b1b9e8

Please sign in to comment.