Skip to content

Commit

Permalink
Make Resource.Merge consistent with Span.SetAttribute. (open-telemetr…
Browse files Browse the repository at this point in the history
  • Loading branch information
Oberon00 authored Jan 20, 2021
1 parent 83d1879 commit 37e7ff4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ Updates:
([#1322](https://github.com/open-telemetry/opentelemetry-specification/pull/1322))
- Require schemed endpoints for OTLP exporters
([1234](https://github.com/open-telemetry/opentelemetry-specification/pull/1234))
- Resource SDK: Reverse (suggested) order of Resource.Merge parameters, remove
special case for empty strings
([#1345](https://github.com/open-telemetry/opentelemetry-specification/pull/1345))

## v0.7.0 (11-18-2020)

Expand Down
2 changes: 1 addition & 1 deletion spec-compliance-matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ status of the feature is not known.
|----------------------------------------------|---|----|---|------|----|------|---|----|---|----|-----|
|Create from Attributes | + | + | + | + | + | + | | + | | + | + |
|Create empty | + | + | + | + | + | + | | + | | + | + |
|Merge | + | + | + | + | + | + | | + | | + | + |
|[Merge (v2)](specification/resource/sdk.md#merge) | | | | | | | | | | | |
|Retrieve attributes | + | + | + | + | + | + | | + | | + | + |
|[Default value](specification/resource/semantic_conventions/README.md#attributes-with-default-value) for service.name | | | | | | | | | | | |

Expand Down
18 changes: 6 additions & 12 deletions specification/resource/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,21 @@ Required parameters:

### Merge

The interface MUST provide a way for a primary resource and a
secondary resource to be merged into a new resource.
The interface MUST provide a way for an old resource and an
updating resource to be merged into a new resource.

Note: This is intended to be utilized for merging of resources whose attributes
come from different sources,
such as environment variables, or metadata extracted from the host or container.

The resulting resource MUST have all attributes that are on any of the two input resources.
Conflicts (i.e. a key for which attributes exist on both the primary and secondary resource)
MUST be handled as follows:

* If the value on the primary resource is an empty string, the result has the value of the secondary resource.
* Otherwise, the value of the primary resource is used.

Attribute key namespacing SHOULD be used to prevent collisions across different
resource detection steps.
If a key exists on both the old and updating resource, the value of the updating
resource MUST be picked (even if the updated value is empty).

Required parameters:

- the primary resource whose attributes take precedence.
- the secondary resource whose attributes will be merged in.
- the old resource
- the updating resource whose attributes take precedence

### The empty resource

Expand Down

0 comments on commit 37e7ff4

Please sign in to comment.