Skip to content

Commit

Permalink
fix(rdkafka): 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 38758d4 commit c3e6893
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def produce(topic:, payload: nil, key: nil, partition: nil, partition_key: nil,

headers ||= {}

tracer.in_span("#{topic} send", attributes: attributes, kind: :producer) do
tracer.in_span("#{topic} publish", attributes: attributes, kind: :producer) do
OpenTelemetry.propagation.inject(headers)
super
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@

process_spans = spans.select { |s| s.name == "#{topic_name} process" }

# First pair for send and process spans
# First pair for publish and process spans
first_process_span = process_spans[0]
_(first_process_span.name).must_equal("#{topic_name} process")
_(first_process_span.kind).must_equal(:consumer)
Expand All @@ -82,23 +82,23 @@
first_process_span_link = first_process_span.links[0]
linked_span_context = first_process_span_link.span_context

linked_send_span = spans.find { |s| s.span_id == linked_span_context.span_id }
_(linked_send_span.name).must_equal("#{topic_name} send")
_(linked_send_span.trace_id).must_equal(first_process_span.trace_id)
_(linked_send_span.trace_id).must_equal(linked_span_context.trace_id)
linked_publish_span = spans.find { |s| s.span_id == linked_span_context.span_id }
_(linked_publish_span.name).must_equal("#{topic_name} publish")
_(linked_publish_span.trace_id).must_equal(first_process_span.trace_id)
_(linked_publish_span.trace_id).must_equal(linked_span_context.trace_id)

# Second pair of send and process spans
# Second pair of publish and process spans
second_process_span = process_spans[1]
_(second_process_span.name).must_equal("#{topic_name} process")
_(second_process_span.kind).must_equal(:consumer)

second_process_span_link = second_process_span.links[0]
linked_span_context = second_process_span_link.span_context

linked_send_span = spans.find { |s| s.span_id == linked_span_context.span_id }
_(linked_send_span.name).must_equal("#{topic_name} send")
_(linked_send_span.trace_id).must_equal(second_process_span.trace_id)
_(linked_send_span.trace_id).must_equal(linked_span_context.trace_id)
linked_publish_span = spans.find { |s| s.span_id == linked_span_context.span_id }
_(linked_publish_span.name).must_equal("#{topic_name} publish")
_(linked_publish_span.trace_id).must_equal(second_process_span.trace_id)
_(linked_publish_span.trace_id).must_equal(linked_span_context.trace_id)

event = second_process_span.events.first
_(event.name).must_equal('exception')
Expand Down Expand Up @@ -148,7 +148,7 @@
_(spans.size).must_equal(4)
process_spans = spans.select { |s| s.name == "#{topic_name} process" }

# First pair for send and process spans
# First pair for publish and process spans
first_process_span = process_spans[0]
_(first_process_span.attributes).wont_include('messaging.kafka.message_key')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

delivery_handles.each(&:wait)

_(spans.first.name).must_equal("#{topic_name} send")
_(spans.first.name).must_equal("#{topic_name} publish")
_(spans.first.kind).must_equal(:producer)

_(spans.first.attributes['messaging.system']).must_equal('kafka')
Expand Down

0 comments on commit c3e6893

Please sign in to comment.