Skip to content

Commit

Permalink
Add mandatory tags for rabbitmq integrations
Browse files Browse the repository at this point in the history
  • Loading branch information
rarguelloF committed Feb 10, 2023
1 parent e078c25 commit be48ed8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/datadog/tracing/contrib/sneakers/ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module Ext
TAG_COMPONENT = 'sneakers'
TAG_OPERATION_JOB = 'job'
TAG_MESSAGING_SYSTEM = 'rabbitmq'
TAG_RABBITMQ_ROUTING_KEY = 'messaging.rabbitmq.routing_key'
end
end
end
Expand Down
1 change: 1 addition & 0 deletions lib/datadog/tracing/contrib/sneakers/tracer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def call(deserialized_msg, delivery_info, metadata, handler)

request_span.resource = @app.to_proc.binding.eval('self.class').to_s
request_span.set_tag(Ext::TAG_JOB_ROUTING_KEY, delivery_info.routing_key)
request_span.set_tag(Ext::TAG_RABBITMQ_ROUTING_KEY, delivery_info.routing_key)
request_span.set_tag(Ext::TAG_JOB_QUEUE, delivery_info.consumer.queue.name)

request_span.set_tag(Ext::TAG_JOB_BODY, deserialized_msg) if configuration[:tag_body]
Expand Down
1 change: 1 addition & 0 deletions spec/datadog/tracing/contrib/sneakers/tracer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def work_with_params(_msg, _delivery_info, _metadata)
expect(span.get_tag(Datadog::Tracing::Metadata::Ext::TAG_OPERATION)).to eq('job')
expect(span.get_tag('span.kind')).to eq('consumer')
expect(span.get_tag('messaging.system')).to eq('rabbitmq')
expect(span.get_tag('messaging.rabbitmq.routing_key')).to eq('something')
end

context 'when the tag_body is true' do
Expand Down

0 comments on commit be48ed8

Please sign in to comment.