Repository navigation
Conversation
Pull request dashboard statusWaiting on maintainers · refreshed 2026-11-25 18:32 UTC Merge when ready. Status above doesn't look right?
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8927 +/- ##
============================================
- Coverage 90.55% 90.55% -0.01%
+ Complexity 11196 11194 -2
============================================
Files 1032 1032
Lines 30524 30526 +2
Branches 3999 3999
============================================
+ Hits 27642 27643 +1
+ Misses 1910 1909 -1
- Partials 972 974 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
jkwatson
left a comment
There was a problem hiding this comment.
Claude: automated review of this PR (AI-generated; please double-check).
Recommendation: Problems found: please look at the flagged points before merging.
Checked 8 points from the briefing: 5 verified, 3 flagged.
Verified
- ✅ Merging with user resources (see
sdk/common/src/main/java/io/opentelemetry/sdk/resources/ResourceBuilder.java:383-409,sdk/common/src/test/java/io/opentelemetry/sdk/resources/ResourceTest.java:885-902) - ✅ Constant relocation (see
sdk/common/src/main/java/io/opentelemetry/sdk/resources/Resource.java:43-64,sdk/common/src/main/java/io/opentelemetry/sdk/common/internal/SemConvConstants.java:31-42) - ✅ Test expectations on entity ordering (see
sdk/common/src/main/java/io/opentelemetry/sdk/resources/Resource.java:131,sdk/common/src/main/java/io/opentelemetry/sdk/resources/Resource.java:228) - ✅ Should the TODO to null the default schema URL be tracked in an issue, and what condition would let it be removed? (see
sdk/common/src/main/java/io/opentelemetry/sdk/resources/Resource.java:61-64,sdk/common/src/main/java/io/opentelemetry/sdk/resources/Resource.java:229-247) - ✅ Why did SdkSpanBuilderTest change imports (U17, U18) and are they only needed for the toString change? (see
sdk/trace/src/test/java/io/opentelemetry/sdk/trace/SdkSpanBuilderTest.java:38,sdk/trace/src/test/java/io/opentelemetry/sdk/trace/SdkSpanBuilderTest.java:48)
Flagged
- ❌ Schema URL nulling on DEFAULT (inline comment)
- ❓ Identity vs description split (inline comment)
- ❌ Do exporters (e.g. OTLP) now emit entity_refs for telemetry.sdk by default, and is that intended for every default resource? (inline comment)
| .build(); | ||
|
|
||
| private static final Resource DEFAULT = MANDATORY.merge(TELEMETRY_SDK); | ||
| // TODO(jack-berg): Explicitly null out schema url to avoid avoid assigning schemaUrl to default |
There was a problem hiding this comment.
Claude: possible problem: Schema URL nulling on DEFAULT
The nulling works on DEFAULT itself. The attributes and the telemetry.sdk entity stay intact, the resource schemaUrl is null, and the entity keeps 1.40.0. Resource.merge() also behaves as before, because it uses buildWithSchemaUrl and a null base takes the other side's URL. The nulling does not survive toBuilder().build(): ResourceBuilder derives 1.40.0 from the single entity. So the common Resource.getDefault().toBuilder()...build() pattern now yields a resource with schemaUrl 1.40.0, which was null before. If that resource is later merged with a resource that has a different schemaUrl, the result is null and an info log is written. The PR's own test asserts this behavior. The TODO says the goal is to avoid assigning a schemaUrl, so the reviewer should decide whether this is acceptable or whether toBuilder() should pin a null URL.
Evidence:
sdk/common/src/main/java/io/opentelemetry/sdk/resources/Resource.java:61-69DEFAULT is built with buildWithSchemaUrl(null), so the resource schemaUrl is null while the entity keeps 1.40.0.sdk/common/src/main/java/io/opentelemetry/sdk/resources/ResourceBuilder.java:283build() derives the schema URL from the entities when none is set explicitly, so a single 1.40.0 entity gives 1.40.0.sdk/common/src/main/java/io/opentelemetry/sdk/resources/Resource.java:270-278toBuilder() copies a schemaUrl only if it is non-null, so a null one gets re-derived on build().
There was a problem hiding this comment.
Is the request to preserve a null resource schema URL through toBuilder().build()? The comment describes the behavior but leaves the proposed change unclear.
There was a problem hiding this comment.
I think it's more of a "is this intended or not" question, rather than a suggestion of a fix.
There was a problem hiding this comment.
Removed the special nulling. It didn't survive rebuilding and made schema handling depend on the construction path. We already associate a schema url elsewhere we construct entity aware resources (e.g. ServiceInstanceIdResourceProvider and others) and I couldn't think of a good reason why the default reason would be different, especially given the fragility of whether or not its included post rebuilding. The default now carries 1.40.0 consistently. We accept normal schema-conflict behavior here: merging with another schema clears the resource-level URL but preserves attributes and entity schema URLs.
…y-java into default-resource-telemetry-entity
https://github.com/open-telemetry/semantic-conventions/blob/main/docs/registry/entities/telemetry.md#telemetry-sdk