Skip to content

Commit

Permalink
Added: event_sample_rate tag to Resque integration.
Browse files Browse the repository at this point in the history
  • Loading branch information
delner committed Jan 2, 2019
1 parent af3131e commit 053b49f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/ddtrace/contrib/resque/resque_job.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'ddtrace/ext/app_types'
require 'ddtrace/sync_writer'
require 'ddtrace/contrib/sampling'
require 'ddtrace/contrib/sidekiq/ext'
require 'resque'

Expand All @@ -14,6 +15,7 @@ def around_perform(*_)
tracer.trace(Ext::SPAN_JOB, span_options) do |span|
span.resource = name
span.span_type = Datadog::Ext::AppTypes::WORKER
Contrib::Sampling.set_event_sample_rate(span, datadog_configuration[:event_sample_rate])
yield
end
end
Expand Down
5 changes: 5 additions & 0 deletions spec/ddtrace/contrib/resque/instrumentation_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'spec_helper'
require 'ddtrace/contrib/sampling_examples'
require_relative 'job'

require 'ddtrace'
Expand Down Expand Up @@ -42,6 +43,8 @@
expect(span.service).to eq('resque')
expect(span.status).to_not eq(Datadog::Ext::Errors::STATUS)
end

it_behaves_like 'event sample rate'
end

context 'that fails' do
Expand Down Expand Up @@ -71,6 +74,8 @@
expect(span.status).to eq(Datadog::Ext::Errors::STATUS)
expect(span.get_tag(Datadog::Ext::Errors::TYPE)).to eq(error_class_name)
end

it_behaves_like 'event sample rate'
end
end

Expand Down

0 comments on commit 053b49f

Please sign in to comment.