pulsar
pulsar copied to clipboard
[fix][client] Fix incorrect topic in OTel spans for multi-topic consumers
Fixes #25895
Motivation
OTel consumer spans for multi-topic consumers used the internal dummy consumer topic, so traces could show span names and destination attributes like MultiTopicsConsumer-* instead of the actual message topic.
Modifications
Use the message topic when setting the consumer span destination, and keep the consumer topic only as a fallback for messages or callbacks that do not carry a topic.
Verifications
./gradlew :pulsar-client-original:compileJava./gradlew :pulsar-broker:test --tests org.apache.pulsar.broker.service.OpenTelemetryTracingIntegrationTest.testMultiTopicConsumerTracing