Module: Datadog::Contrib::ActiveJob::Event::ClassMethods
- Defined in:
- lib/ddtrace/contrib/active_job/event.rb
Overview
Class methods for ActiveJob events.
Instance Method Summary collapse
- #configuration ⇒ Object
- #set_common_tags(span, payload) ⇒ Object
- #span_options ⇒ Object
- #tracer ⇒ Object
Instance Method Details
#configuration ⇒ Object
25 26 27 |
# File 'lib/ddtrace/contrib/active_job/event.rb', line 25 def configuration Datadog.configuration[:active_job] end |
#set_common_tags(span, payload) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/ddtrace/contrib/active_job/event.rb', line 29 def (span, payload) adapter_name = if payload[:adapter].is_a?(Class) payload[:adapter].name else payload[:adapter].class.name end span.set_tag(Ext::TAG_ADAPTER, adapter_name) job = payload[:job] span.set_tag(Ext::TAG_JOB_ID, job.job_id) span.set_tag(Ext::TAG_JOB_QUEUE, job.queue_name) span.set_tag(Ext::TAG_JOB_PRIORITY, job.priority) if job.respond_to?(:priority) span.set_tag(Ext::TAG_JOB_EXECUTIONS, job.executions) if job.respond_to?(:executions) job_scheduled_at = if job.respond_to?(:scheduled_at) job.scheduled_at elsif job.respond_to?(:enqueued_at) job.enqueued_at end span.set_tag(Ext::TAG_JOB_SCHEDULED_AT, Time.at(job_scheduled_at)) if job_scheduled_at end |
#span_options ⇒ Object
17 18 19 |
# File 'lib/ddtrace/contrib/active_job/event.rb', line 17 def { service: configuration[:service_name] } end |
#tracer ⇒ Object
21 22 23 |
# File 'lib/ddtrace/contrib/active_job/event.rb', line 21 def tracer -> { configuration[:tracer] } end |