From ee502a852405d29338782bedcf59cd206e6a6dfd Mon Sep 17 00:00:00 2001 From: Srikanth Chekuri Date: Sun, 28 Feb 2021 20:07:19 +0530 Subject: [PATCH 1/4] fix: update resource collision precedence --- packages/opentelemetry-resources/src/Resource.ts | 6 +++--- packages/opentelemetry-resources/test/Resource.test.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/opentelemetry-resources/src/Resource.ts b/packages/opentelemetry-resources/src/Resource.ts index a459cfd590..b80d6614b0 100644 --- a/packages/opentelemetry-resources/src/Resource.ts +++ b/packages/opentelemetry-resources/src/Resource.ts @@ -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. @@ -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); } diff --git a/packages/opentelemetry-resources/test/Resource.test.ts b/packages/opentelemetry-resources/test/Resource.test.ts index 3203148fc4..4e5962895c 100644 --- a/packages/opentelemetry-resources/test/Resource.test.ts +++ b/packages/opentelemetry-resources/test/Resource.test.ts @@ -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', From 392df17929e466f4d739eaf3d5276cd7fe432e0e Mon Sep 17 00:00:00 2001 From: Srikanth Chekuri Date: Mon, 1 Mar 2021 21:09:52 +0530 Subject: [PATCH 2/4] chore: add upgrade guidelines entry --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 806d707859..034ba136cf 100644 --- a/README.md +++ b/README.md @@ -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 + ### 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 From 43a637d23b22140ab37a661447580e0366763105 Mon Sep 17 00:00:00 2001 From: Srikanth Chekuri Date: Mon, 1 Mar 2021 22:26:12 +0530 Subject: [PATCH 3/4] Update README.md Co-authored-by: Daniel Dyla --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 034ba136cf..2c389e7f60 100644 --- a/README.md +++ b/README.md @@ -248,6 +248,7 @@ To request automatic tracing support for a module not on this list, please [file ### 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 ### 0.16.0 to 0.17.0 From 356e5e230063467345b9f56866f138f427829656 Mon Sep 17 00:00:00 2001 From: Srikanth Chekuri Date: Tue, 2 Mar 2021 08:24:17 +0530 Subject: [PATCH 4/4] Update README.md Co-authored-by: Bartlomiej Obecny --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2d35588a68..1cdfd7ca0e 100644 --- a/README.md +++ b/README.md @@ -249,7 +249,7 @@ To request automatic tracing support for a module not on this list, please [file [PR-1975](https://github.com/open-telemetry/opentelemetry-js/pull/1975) -- Breaking change - Update resource key collision precedence +- Breaking change - The resulting resource MUST have all attributes that are on any of the two input resources. If a key exists on both the old and updating resource, the value of the updating resource MUST be picked - previously it was opposite. ### 0.16.0 to 0.17.0