Skip to content

Use per-instance IDs for SDK processors and metric readers - #9017

Open
goutamadwant wants to merge 2 commits into
open-telemetry:mainfrom
goutamadwant:fix-sdk-component-identity
Open

goutamadwant wants to merge 2 commits into
open-telemetry:mainfrom
goutamadwant:fix-sdk-component-identity

Conversation

@goutamadwant

Copy link
Copy Markdown

Fixes #9012.

Create a separate component ID for each simple or batch span processor, simple or batch log processor, and periodic metric reader. The static IDs caused multiple instances of the same component type to share an otel.component.name and collapse into one self-observability metric series. Periodic readers retain their instance ID when their meter provider is installed.

Regression tests create two instances of each component type and verify distinct names, stable identities, and separate measurements across repeated collections. Existing metric assertions continue to check the exact attribute sets while allowing instance-specific names.

Validation:

  • ./gradlew :sdk:trace:check :sdk:logs:check :sdk:metrics:check

@goutamadwant
goutamadwant requested a review from a team as a code owner November 7, 2026 18:56
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Waiting on maintainers · refreshed 2026-11-19 22:26 UTC

Merge when ready.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@codecov

codecov Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.46%. Comparing base (f67bf22) to head (4de7305).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #9017   +/-   ##
=========================================
  Coverage     90.45%   90.46%           
- Complexity    11181    11182    +1     
=========================================
  Files          1032     1032           
  Lines         30507    30504    -3     
  Branches       3992     3992           
=========================================
- Hits          27595    27594    -1     
  Misses         1935     1935           
+ Partials        977      975    -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@opentelemetry-pr-dashboard

This comment has been minimized.

@jack-berg jack-berg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve merge conflicts and consider the following test simplification

Comment on lines +81 to +82
List<String> previousNames = null;
for (int count = 1; count <= 2; count++) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional simplification: could we emit once and flush once, then assert the following instead of looping and tracking previousNames?

assertThat(metric.getLongSumData().getPoints())
    .hasSize(2)
    .allSatisfy(p -> assertThat(p.getValue()).isEqualTo(1))
    .extracting(p -> p.getAttributes().get(OTEL_COMPONENT_NAME))
    .doesNotContainNull()
    .doesNotHaveDuplicates();

This directly catches the static-ID regression: the old implementation produces one point with value 2. The log and reader tests could use the same single-collection approach.

@goutamadwant

Copy link
Copy Markdown
Author

I resolved the merge conflicts and pushed 4de7305. The processor and reader tests now use one collection to check for two distinct otel.component.name values with one event each, without depending on the numeric suffixes. All 13 focused SDK tests passed locally.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Span/log processors and PeriodicMetricReader use static ComponentId, causing all instances to share otel.component.name "<type>/0"

2 participants