11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/ddtrace/contrib/qless/qless_job.rb', line 11
def around_perform(job)
return super unless datadog_configuration && tracer
tracer.trace(Ext::SPAN_JOB, span_options) do |span|
span.resource = job.klass_name
span.span_type = Datadog::Ext::AppTypes::WORKER
span.set_tag(Ext::TAG_JOB_ID, job.jid)
span.set_tag(Ext::TAG_JOB_QUEUE, job.queue_name)
tag_job_tags = datadog_configuration[:tag_job_tags]
span.set_tag(Ext::TAG_JOB_TAGS, job.tags) if tag_job_tags
tag_job_data = datadog_configuration[:tag_job_data]
if tag_job_data && !job.data.empty?
job_data = job.data.with_indifferent_access
formatted_data = job_data.except(:tags).map do |key, value|
"#{key}:#{value}".underscore
end
span.set_tag(Ext::TAG_JOB_DATA, formatted_data)
end
if Contrib::Analytics.enabled?(datadog_configuration[:analytics_enabled])
Contrib::Analytics.set_sample_rate(span, datadog_configuration[:analytics_sample_rate])
end
Contrib::Analytics.set_measured(span)
super
end
end
|