[sdk-*] remove mergeResourceWithDefaults
option and align resource merging behavior with spec
#5132
Labels
needs:code-contribution
This feature/bug is ready to implement
pkg:sdk-logs
pkg:sdk-metrics
pkg:sdk-node
pkg:sdk-trace-base
target:next-major-release
This PR targets the next major release (`next` branch)
type:feature
A feature with no sub-issues to address
Milestone
Description
Our previous implementation of resource merging in SDKs was not compliant with the specification, which states that:
Our implementation always merged the default resource, regardless of the user supplying their own so there was no way to set an empty resource explicitly. Since simply changing the behavior would've broken too many users that rely on the non-secification compliant behavior, we opted to add a flag (
mergeResourceWithDefaults
in #4617) that would allow users to opt-in to the specification compliant behavior instead.The goal of this issue is to remove the option from all SDKs (and sdk-node) AND align the behavior with the specification (meaning: only merging when the user does NOT provide a resource)
This issue is considered done when:
mergeResourceWithDefaults
has been removed in@opentelemetry/sdk-logs
and the behavior has been aligned with the specificationopentelemetry-js/experimental/packages/sdk-logs/src/LoggerProvider.ts
Lines 31 to 41 in 012dc9e
opentelemetry-js/experimental/packages/sdk-logs/src/types.ts
Line 36 in 8483b68
mergeResourceWithDefaults
has been removed in@opentelemetry/sdk-metrics
and the behavior has been aligned with the specificationopentelemetry-js/packages/sdk-metrics/src/MeterProvider.ts
Lines 50 to 60 in 012dc9e
opentelemetry-js/packages/sdk-metrics/src/MeterProvider.ts
Line 43 in 012dc9e
mergeResourceWithDefaults
has been removed in@opentelemetry/sdk-traces
and the behavior has been aligned with the specificationopentelemetry-js/packages/opentelemetry-sdk-trace-base/src/BasicTracerProvider.ts
Lines 84 to 86 in 012dc9e
opentelemetry-js/packages/opentelemetry-sdk-trace-base/src/config.ts
Line 57 in 012dc9e
opentelemetry-js/packages/opentelemetry-sdk-trace-base/src/types.ts
Line 41 in 8483b68
mergeResourceWithDefaults
has been removed in@opentelemetry/sdk-node
and the behavior has been aligned with the specificationopentelemetry-js/experimental/packages/opentelemetry-sdk-node/src/sdk.ts
Line 99 in 012dc9e
opentelemetry-js/experimental/packages/opentelemetry-sdk-node/src/types.ts
Line 43 in 012dc9e
Additional requirements
Additional context
service.instance.id
#4608 (comment) was the first time we noticed that the behvavior is not spec compliantThe text was updated successfully, but these errors were encountered: