open-telemetry / opentelemetry-js

OpenTelemetry JavaScript Client

Home Page:https://opentelemetry.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[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 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: