[sdk-metrics] [sdk-trace] ensure resource is not auto-merged with default when it is provided to constructor
pichlermarc opened this issue · comments
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 aTracerProvider
orMeterProvider
if 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:
opentelemetry-js/packages/sdk-metrics/src/MeterProvider.ts
Lines 49 to 51 in 0f6518d