opentelemetry-js
opentelemetry-js copied to clipboard
[sdk-metrics] [sdk-trace] ensure resource is not auto-merged with default when it is provided to constructor
Description
Currently we always merge Resource.default() with the constructor-provided resource. However, the spec states that this should only happen when no resource is provided:
The SDK MUST provide access to a Resource with at least the attributes listed at Semantic Attributes with SDK-provided Default Value. This resource MUST be associated with a
TracerProviderorMeterProviderif another resource was not explicitly specified.
A later section states that:
Note: This means that it is possible to create and associate a resource that does not have all or any of the SDK-provided attributes present.
The goal of this issue is to change the resource handling trace and metrics SDKs to be spec-compliant.
This issue is considered done when:
- [ ]
Resource.default()is not auto-merged with the constructor-provided resource insdk-metrics - [ ]
Resource.default()is not auto-merged with the constructor-provided resource insdk-trace-base - [ ]
Resource.default()is not auto-merged with the constructor-provided resource insdk-trace-node - [ ]
Resource.default()is not auto-merged with the constructor-provided resource insdk-trace-web - [ ] TBD: if any other SDK packages are stable by the time we work on this, also align them with the specification.
NOTE: if this is not applicable for one of the packages listed above when this issue is being implemented, state why this is the case in a comment, and link that comment below the list item before ticking the checkbox. Otherwise link the PR.
Additional resources:
Links to non-spec-compliant sections:
- https://github.com/open-telemetry/opentelemetry-js/blob/47444f2a4c13a80f3328ffafc5b4c8db9e9a0886/packages/opentelemetry-sdk-trace-base/src/BasicTracerProvider.ts#L83
- https://github.com/open-telemetry/opentelemetry-js/blob/0f6518dd63bf86f3149437b2aaa56c880d45ef6d/packages/sdk-metrics/src/MeterProvider.ts#L49-L51
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.