Skip to content

Commit f042dea

Browse files
committed
fix(confluent-kafka): Fix wrong partition and offset if
1 parent fbfc055 commit f042dea

File tree

1 file changed

+2
-2
lines changed
  • instrumentation/opentelemetry-instrumentation-confluent-kafka/src/opentelemetry/instrumentation/confluent_kafka

1 file changed

+2
-2
lines changed

Diff for: instrumentation/opentelemetry-instrumentation-confluent-kafka/src/opentelemetry/instrumentation/confluent_kafka/utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def _enrich_span(
9696
span.set_attribute(SpanAttributes.MESSAGING_SYSTEM, "kafka")
9797
span.set_attribute(SpanAttributes.MESSAGING_DESTINATION, topic)
9898

99-
if partition:
99+
if partition is not None:
100100
span.set_attribute(SpanAttributes.MESSAGING_KAFKA_PARTITION, partition)
101101

102102
span.set_attribute(
@@ -111,7 +111,7 @@ def _enrich_span(
111111

112112
# https://stackoverflow.com/questions/65935155/identify-and-find-specific-message-in-kafka-topic
113113
# A message within Kafka is uniquely defined by its topic name, topic partition and offset.
114-
if partition and offset and topic:
114+
if partition is not None and offset is not None and topic:
115115
span.set_attribute(
116116
SpanAttributes.MESSAGING_MESSAGE_ID,
117117
f"{topic}.{partition}.{offset}",

0 commit comments

Comments
 (0)