Skip to content

Commit

Permalink
Adds 'span.kind' tag with value consumer for resque
Browse files Browse the repository at this point in the history
  • Loading branch information
zarirhamza committed Nov 22, 2022
1 parent 0195412 commit 7699a18
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/datadog/tracing/contrib/resque/resque_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ def around_perform0_ddtrace(*args)
span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_JOB)

span.set_tag(Tracing::Metadata::Ext::TAG_KIND, Tracing::Metadata::Ext::SpanKind::TAG_CONSUMER)

# Set analytics sample rate
if Contrib::Analytics.enabled?(datadog_configuration[:analytics_enabled])
Contrib::Analytics.set_sample_rate(span, datadog_configuration[:analytics_sample_rate])
Expand Down
2 changes: 2 additions & 0 deletions spec/datadog/tracing/contrib/resque/instrumentation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def perform_job(klass, *args)
expect(span).to_not have_error
expect(span.get_tag(Datadog::Tracing::Metadata::Ext::TAG_COMPONENT)).to eq('resque')
expect(span.get_tag(Datadog::Tracing::Metadata::Ext::TAG_OPERATION)).to eq('job')
expect(span.get_tag('span.kind')).to eq('consumer')
end

it_behaves_like 'analytics for integration' do
Expand Down Expand Up @@ -119,6 +120,7 @@ def perform_job(klass, *args)
expect(span).to have_error_type(error_class_name)
expect(span.get_tag(Datadog::Tracing::Metadata::Ext::TAG_COMPONENT)).to eq('resque')
expect(span.get_tag(Datadog::Tracing::Metadata::Ext::TAG_OPERATION)).to eq('job')
expect(span.get_tag('span.kind')).to eq('consumer')
end

context 'with custom error handler' do
Expand Down

0 comments on commit 7699a18

Please sign in to comment.