open-telemetry / open-telemetry/opentelemetry-java-instrumentation

Kafka instrumentation should record server attributes when possible

Open
#10,647 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

contribution welcome enhancement
Dominant language
Java
Stars
2.6k
Forks
1.2k
Avg merge
2d 18h
Merged PRs (30d)
228

Description

Is your feature request related to a problem? Please describe.

Existing Kafka instrumentation does not capture any server/network details.

So in case I have multiple kafka clusters in my application, I cannot differentiate between them.
I also don't know which node operation was done against.

I think kafka instrumentation should record cluster-id as a server.address or node host if it can retrieve them. Will bring it up in messaging semconv to decide which one.

Describe the solution you'd like

Kafka instrumentation should do the best effort collecting server.* attributes and if it's not possible should collect some network.* attributes.

Publish/consume spans should (as they already are) be created on the public api surface and cover duration of logical operation (with all retries).

In case multiple server.addresses (or network.peer.addresses) are available (e.g. tried one node and fell back to a different one), we want to report only the last node contacted on the logical operation.

Network-level kafka instrumentation is not covered by messaging semconv and there is no guidance on how/if to instrument it at this point.

Describe alternatives you've considered

No response

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Kafka instrumentation entry points where publish and consume spans are created, then review the messaging semantic-conventions discussion linked in the issue. Determine which server or network attributes are available across retries and define the expected last-node behavior; done requires an agreed convention and coverage for the logical operation spans.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
distributed-systems, observability
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.