Skip to content

Commit

Permalink
Only set the partition on a span if it's been set (#1101)
Browse files Browse the repository at this point in the history
  • Loading branch information
kenfinnigan authored Mar 15, 2021
1 parent 0cbd15f commit d468743
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,9 @@ private void createOutgoingTrace(Message<?> message, String topic, int partition
Scope scope = span.makeCurrent();

// Set Span attributes
span.setAttribute("partition", partition);
if (partition != -1) {
span.setAttribute(SemanticAttributes.MESSAGING_KAFKA_PARTITION, partition);
}
span.setAttribute(SemanticAttributes.MESSAGING_SYSTEM, "kafka");
span.setAttribute(SemanticAttributes.MESSAGING_DESTINATION, topic);
span.setAttribute(SemanticAttributes.MESSAGING_DESTINATION_KIND, "topic");
Expand Down

0 comments on commit d468743

Please sign in to comment.