Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: specification compliant resource collision precedence #1975

Merged
merged 6 commits into from
Mar 2, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@ To request automatic tracing support for a module not on this list, please [file

## Upgrade guidelines

### 0.17.0 to 0.18.0

[PR-1975](https://github.com/open-telemetry/opentelemetry-js/pull/1975)
- Breaking change - Update resource key collision precedence
srikanthccv marked this conversation as resolved.
Show resolved Hide resolved
srikanthccv marked this conversation as resolved.
Show resolved Hide resolved

### 0.16.0 to 0.17.0

[PR-1880](https://github.com/open-telemetry/opentelemetry-js/pull/1880) feat(diag-logger): introduce a new global level api.diag for internal diagnostic logging
Expand Down
6 changes: 3 additions & 3 deletions packages/opentelemetry-resources/src/Resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class Resource {

/**
* Returns a new, merged {@link Resource} by merging the current Resource
* with the other Resource. In case of a collision, current Resource takes
* with the other Resource. In case of a collision, other Resource takes
* precedence.
*
* @param other the Resource that will be merged with this.
Expand All @@ -66,8 +66,8 @@ export class Resource {
// SpanAttributes from resource overwrite attributes from other resource.
const mergedAttributes = Object.assign(
{},
other.attributes,
this.attributes
this.attributes,
other.attributes
);
return new Resource(mergedAttributes);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-resources/test/Resource.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('Resource', () => {

it('should return merged resource when collision in attributes', () => {
const expectedResource = new Resource({
'k8s.io/container/name': 'c1',
'k8s.io/container/name': 'c2',
'k8s.io/namespace/name': 'default',
'k8s.io/pod/name': 'pod-xyz-123',
'k8s.io/location': 'location1',
Expand Down