lib/ddtrace/contrib/sidekiq/client_tracer.rb in ddtrace-0.19.1 vs lib/ddtrace/contrib/sidekiq/client_tracer.rb in ddtrace-0.20.0

- old
+ new

@@ -1,7 +1,7 @@ require 'ddtrace/contrib/sidekiq/tracing' -require 'ddtrace/contrib/sampling' +require 'ddtrace/contrib/analytics' module Datadog module Contrib module Sidekiq # Tracer is a Sidekiq client-side middleware which traces job enqueues/pushes @@ -19,10 +19,13 @@ def call(worker_class, job, queue, redis_pool) resource = job_resource(job) @tracer.trace(Ext::SPAN_PUSH, service: @sidekiq_service) do |span| span.resource = resource - Contrib::Sampling.set_event_sample_rate(span, configuration[:event_sample_rate]) + # Set analytics sample rate + if Contrib::Analytics.enabled?(configuration[:analytics_enabled]) + Contrib::Analytics.set_sample_rate(span, configuration[:analytics_sample_rate]) + end span.set_tag(Ext::TAG_JOB_ID, job['jid']) span.set_tag(Ext::TAG_JOB_QUEUE, job['queue']) span.set_tag(Ext::TAG_JOB_WRAPPER, job['class']) if job['wrapped'] yield