Skip to content

[Bug] OTel consumer spans use incorrect topic for multi-topic consumers #25895

@void-ptr974

Description

@void-ptr974

Search before reporting

  • I searched in the issues and found nothing similar.

Read release policy

  • I understand that unsupported versions don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker.

User environment

  • Pulsar Java client with OpenTelemetry tracing enabled.
  • Observed from the current master branch code path.
  • This issue is not tied to a specific broker OS or deployment environment.

Issue Description

When OpenTelemetry tracing is enabled, consumer spans for multi-topic consumers can use the internal consumer topic name instead of the actual topic of the consumed message.

For example, the span name and messaging.destination.name can contain:

MultiTopicsConsumer-*

instead of the real Pulsar topic or partition topic that the message came from.

This makes traces misleading because users cannot see the actual message source topic from the consumer span.

Error messages

No error messages or stack traces are emitted. The issue is incorrect OpenTelemetry span metadata.

Reproducing the issue

  1. Enable OpenTelemetry tracing in the Pulsar Java client.
  2. Create a consumer subscribed to multiple topics.
  3. Receive and acknowledge a message.
  4. Inspect the exported consumer span.

Actual result:

span name = process MultiTopicsConsumer-*
messaging.destination.name = MultiTopicsConsumer-*

Expected result:

span name = process <actual-message-topic>
messaging.destination.name = <actual-message-topic>

Additional information

A fix is proposed in #25894.

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions