From c3e68932f8b0656fbff5dbc1dd3ecc5fb8374522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ka=C5=BAmierczak?= Date: Tue, 5 Sep 2023 08:29:36 +0200 Subject: [PATCH] fix(rdkafka): rename 'send' operation to 'publish' --- .../rdkafka/patches/producer.rb | 2 +- .../rdkafka/patches/consumer_test.rb | 22 +++++++++---------- .../rdkafka/patches/producer_test.rb | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/instrumentation/rdkafka/lib/opentelemetry/instrumentation/rdkafka/patches/producer.rb b/instrumentation/rdkafka/lib/opentelemetry/instrumentation/rdkafka/patches/producer.rb index 7b234b70e..3515f9ca5 100644 --- a/instrumentation/rdkafka/lib/opentelemetry/instrumentation/rdkafka/patches/producer.rb +++ b/instrumentation/rdkafka/lib/opentelemetry/instrumentation/rdkafka/patches/producer.rb @@ -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 diff --git a/instrumentation/rdkafka/test/opentelemetry/instrumentation/rdkafka/patches/consumer_test.rb b/instrumentation/rdkafka/test/opentelemetry/instrumentation/rdkafka/patches/consumer_test.rb index 3ddcaf2f9..bfd2f9da7 100644 --- a/instrumentation/rdkafka/test/opentelemetry/instrumentation/rdkafka/patches/consumer_test.rb +++ b/instrumentation/rdkafka/test/opentelemetry/instrumentation/rdkafka/patches/consumer_test.rb @@ -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) @@ -82,12 +82,12 @@ 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) @@ -95,10 +95,10 @@ 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') @@ -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') diff --git a/instrumentation/rdkafka/test/opentelemetry/instrumentation/rdkafka/patches/producer_test.rb b/instrumentation/rdkafka/test/opentelemetry/instrumentation/rdkafka/patches/producer_test.rb index 983d8b157..06e40de58 100644 --- a/instrumentation/rdkafka/test/opentelemetry/instrumentation/rdkafka/patches/producer_test.rb +++ b/instrumentation/rdkafka/test/opentelemetry/instrumentation/rdkafka/patches/producer_test.rb @@ -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')