Skip to content

Attach SdkResourceProvider in autoconfigure and declarative config - #9060

Open
rooks-ns wants to merge 1 commit into
open-telemetry:mainfrom
rooks-ns:feat/attach-sdk-resource-provider
Open

rooks-ns wants to merge 1 commit into
open-telemetry:mainfrom
rooks-ns:feat/attach-sdk-resource-provider

Conversation

@rooks-ns

Copy link
Copy Markdown
Contributor

Description

Implements follow-up 1 from #8865 by attaching SdkResourceProvider to SdkMeterProvider, SdkLoggerProvider, and SdkTracerProvider instead of a static Resource.

Changes

  • Declarative Config: Attaches the resolved SdkResourceProvider via Sdk*ProviderUtil.setSdkResourceProvider(...) across all signal builders.
  • Autoconfigure & Builders: Adds package-private setDefaultSdkResourceProvider to SdkTracerProviderBuilder, SdkMeterProviderBuilder, and SdkLoggerProviderBuilder. Autoconfigure supplies the baseline provider without tripping the strict IllegalStateException guard if a user customizer subsequently overrides or merges resources via .setResource(...) or .addResource(...).
  • Guard Integrity: Direct, explicit calls to setSdkResourceProvider continue to fail-fast against conflicting setResource/addResource invocations.
  • Tests: Added coverage for default provider delegation, customizer overrides, and cross-signal provider sharing.

@opentelemetry-pr-dashboard

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

Copy link
Copy Markdown

Pull request dashboard status

Waiting on reviewers · refreshed 2026-12-03 18:30 UTC

Review the latest changes.

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.
  • Should this be with the author? Comment /dashboard route:author to route it back.
  • Anything wrong — including the routing? Report it with what you expected; it helps us improve the dashboard.

@codecov

codecov Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.58879% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.52%. Comparing base (a92b644) to head (e5d48e7).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
...metry/sdk/logs/internal/SdkLoggerProviderUtil.java 75.00% 2 Missing ⚠️
...try/sdk/metrics/internal/SdkMeterProviderUtil.java 75.00% 2 Missing ⚠️
...etry/sdk/trace/internal/SdkTracerProviderUtil.java 75.00% 2 Missing ⚠️
...entelemetry/sdk/logs/SdkLoggerProviderBuilder.java 95.23% 0 Missing and 1 partial ⚠️
...telemetry/sdk/metrics/SdkMeterProviderBuilder.java 95.23% 0 Missing and 1 partial ⚠️
...ntelemetry/sdk/trace/SdkTracerProviderBuilder.java 95.23% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9060      +/-   ##
============================================
- Coverage     90.56%   90.52%   -0.04%     
- Complexity    11220    11265      +45     
============================================
  Files          1032     1040       +8     
  Lines         30599    30766     +167     
  Branches       4010     4021      +11     
============================================
+ Hits          27711    27851     +140     
- Misses         1913     1934      +21     
- Partials        975      981       +6     

☔ 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.

Update autoconfigure and declarative configuration to attach a shared
SdkResourceProvider to SdkTracerProvider, SdkMeterProvider, and
SdkLoggerProvider instead of a static Resource.

- In declarative config, use Sdk*ProviderUtil.setSdkResourceProvider to
  attach the provider built from the resolved resource model.
- In autoconfigure, introduce and use setDefaultSdkResourceProvider on the
  signal provider builders to set the baseline resource provider while
  allowing signal-specific customizers to override or merge resources via
  setResource or addResource without throwing IllegalStateException.
- Preserve fail-fast guards when setSdkResourceProvider and
  setResource/addResource are explicitly configured on the same builder.
- Add unit tests verifying default provider usage, customizer overrides,
  and cross-signal provider sharing.
@rooks-ns
rooks-ns force-pushed the feat/attach-sdk-resource-provider branch from a01ffca to e5d48e7 Compare December 3, 2026 17:31
@rooks-ns
rooks-ns marked this pull request as ready for review December 3, 2026 18:29
@rooks-ns
rooks-ns requested a review from a team as a code owner December 3, 2026 18:29

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.

1 participant