Skip to content

Commit

Permalink
fix(bunny): rename 'send' operation to 'publish'
Browse files Browse the repository at this point in the history
  • Loading branch information
michal-kazmierczak committed Sep 5, 2023
1 parent 72a437e commit 80e7e87
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def self.with_send_span(channel, tracer, exchange, routing_key, &block)
attributes = basic_attributes(channel, channel.connection, exchange, routing_key)
destination = destination_name(exchange, routing_key)

tracer.in_span("#{destination} send", attributes: attributes, kind: :producer, &block)
tracer.in_span("#{destination} publish", attributes: attributes, kind: :producer, &block)
end

def self.with_process_span(channel, tracer, delivery_info, properties, &block)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,17 @@

_(spans.size >= 3).must_equal(true)

send_span = spans.find { |span| span.name == "#{topic}.ruby.news send" }
_(send_span).wont_be_nil
_(send_span.kind).must_equal(:producer)
_(send_span.attributes['messaging.system']).must_equal('rabbitmq')
_(send_span.attributes['messaging.destination']).must_equal(topic)
_(send_span.attributes['messaging.destination_kind']).must_equal('topic')
_(send_span.attributes['messaging.protocol']).must_equal('AMQP')
_(send_span.attributes['messaging.protocol_version']).must_equal('0.9.1')
_(send_span.attributes['messaging.rabbitmq.routing_key']).must_equal('ruby.news')
_(send_span.attributes['net.peer.name']).must_equal(host)
_(send_span.attributes['net.peer.port']).must_equal(port.to_i)
publish_span = spans.find { |span| span.name == "#{topic}.ruby.news publish" }
_(publish_span).wont_be_nil
_(publish_span.kind).must_equal(:producer)
_(publish_span.attributes['messaging.system']).must_equal('rabbitmq')
_(publish_span.attributes['messaging.destination']).must_equal(topic)
_(publish_span.attributes['messaging.destination_kind']).must_equal('topic')
_(publish_span.attributes['messaging.protocol']).must_equal('AMQP')
_(publish_span.attributes['messaging.protocol_version']).must_equal('0.9.1')
_(publish_span.attributes['messaging.rabbitmq.routing_key']).must_equal('ruby.news')
_(publish_span.attributes['net.peer.name']).must_equal(host)
_(publish_span.attributes['net.peer.port']).must_equal(port.to_i)

receive_span = spans.find { |span| span.name == "#{topic}.ruby.news receive" }
_(receive_span).wont_be_nil
Expand All @@ -78,7 +78,7 @@
_(process_span.trace_id).must_equal(receive_span.trace_id)

linked_span_context = process_span.links.first.span_context
_(linked_span_context.trace_id).must_equal(send_span.trace_id)
_(linked_span_context.span_id).must_equal(send_span.span_id)
_(linked_span_context.trace_id).must_equal(publish_span.trace_id)
_(linked_span_context.span_id).must_equal(publish_span.span_id)
end
end unless ENV['OMIT_SERVICES']
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@

_(spans.size >= 3).must_equal(true)

send_span = spans.find { |span| span.name == "#{topic}.ruby.news send" }
_(send_span).wont_be_nil
_(send_span.kind).must_equal(:producer)
publish_span = spans.find { |span| span.name == "#{topic}.ruby.news publish" }
_(publish_span).wont_be_nil
_(publish_span.kind).must_equal(:producer)

receive_span = spans.find { |span| span.name == "#{topic}.ruby.news receive" }
_(receive_span).wont_be_nil
Expand All @@ -68,7 +68,7 @@
_(process_span.trace_id).must_equal(receive_span.trace_id)

linked_span_context = process_span.links.first.span_context
_(linked_span_context.trace_id).must_equal(send_span.trace_id)
_(linked_span_context.span_id).must_equal(send_span.span_id)
_(linked_span_context.trace_id).must_equal(publish_span.trace_id)
_(linked_span_context.span_id).must_equal(publish_span.span_id)
end
end unless ENV['OMIT_SERVICES']
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@

queue.pop { |_delivery_info, _metadata, _payload| break }

send_span = spans.find { |span| span.name == ".#{queue_name} send" }
_(send_span).wont_be_nil
publish_span = spans.find { |span| span.name == ".#{queue_name} publish" }
_(publish_span).wont_be_nil

receive_span = spans.find { |span| span.name == ".#{queue_name} receive" }
_(receive_span).wont_be_nil
Expand All @@ -58,7 +58,7 @@
_(process_span.kind).must_equal(:consumer)

linked_span_context = process_span.links.first.span_context
_(linked_span_context.trace_id).must_equal(send_span.trace_id)
_(linked_span_context.trace_id).must_equal(publish_span.trace_id)
end

it 'traces messages returned' do
Expand Down

0 comments on commit 80e7e87

Please sign in to comment.