opentelemetry-js icon indicating copy to clipboard operation
opentelemetry-js copied to clipboard

[sdk-metrics] [sdk-trace] ensure resource is not auto-merged with default when it is provided to constructor

Open pichlermarc opened this issue 1 year ago • 1 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 a TracerProvider or MeterProvider 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 in sdk-metrics
  • [ ] Resource.default() is not auto-merged with the constructor-provided resource in sdk-trace-base
  • [ ] Resource.default() is not auto-merged with the constructor-provided resource in sdk-trace-node
  • [ ] Resource.default() is not auto-merged with the constructor-provided resource in sdk-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

pichlermarc avatar May 03 '24 13:05 pichlermarc

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.

github-actions[bot] avatar Jul 08 '24 06:07 github-actions[bot]