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

All attributes should be passed from span to operation listerners

Open
#9,822 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs triage
Dominant language
Java
Stars
2.6k
Forks
1.2k
Avg merge
2d 18h
Merged PRs (30d)
228

Description

Describe the bug

Currently we are passing only the span attributes which are extracted from AttributeExtractor to the operational listeners while we leave the attributes which are let us say added by the users additionally for their own tracking purposes.

Now since we have recently integrated the advice API, this allows views to override advice but then views api with the above issue can only be used to filter out existing attributes or only add attributes which are part of the attribute extractor but not the ones which are added by the user.

https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/23a6a3e2c017d531623ee22dbbe426e8bf160dd9/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/Instrumenter.java#L224C22-L237

We can check this part of the code which higlights the issue, because of this while a tracing signal has all the attributes but the metric signal is missing the reamining attributes and hence a user face limitations.

Steps to reproduce

We can add a custom attribute to a span and create a view which expose it, we will not get this attribute.

Expected behavior

We should pass all the span attributes to operation listeners

Actual behavior

We are only passing the attributes extracted by AttributesExtractor

Javaagent or library instrumentation version

1.31.0

Environment

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 in instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/Instrumenter.java at the linked lines and review how span attributes reach operation listeners. Reproduce the case with a custom span attribute and a view that exposes it. Done means operation listeners receive all span attributes, including user-added ones, rather than only extracted attributes.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.