From b0fed523a1f594cdc19324b5312db64bab59e77a Mon Sep 17 00:00:00 2001 From: JamieDanielson Date: Tue, 31 May 2022 17:05:52 -0400 Subject: [PATCH 01/10] fix(instrumentation-aws-sdk): dedupe prop fields Co-authored-by: Kent Quirk Co-authored-by: Purvi Kanal Co-authored-by: Mike Goldsmith --- .../opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts index 6d3ca17f76..b67e2cf112 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts @@ -67,9 +67,7 @@ export class SqsServiceExtension implements ServiceExtension { spanAttributes[SemanticAttributes.MESSAGING_OPERATION] = MessagingOperationValues.RECEIVE; - request.commandInput.MessageAttributeNames = ( - request.commandInput.MessageAttributeNames ?? [] - ).concat(propagation.fields()); + request.commandInput.MessageAttributeNames = Array.from(new Set([ ...(request.commandInput.MessageAttributeNames ?? []), ...propagation.fields()])); } break; From 7155304edd1aa6c5d8f64e88782e1ea7bf53d84f Mon Sep 17 00:00:00 2001 From: Mike Goldsmth Date: Wed, 1 Jun 2022 12:52:59 +0100 Subject: [PATCH 02/10] fix linting --- .../src/services/sqs.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts index b67e2cf112..1a54c12241 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts @@ -67,7 +67,12 @@ export class SqsServiceExtension implements ServiceExtension { spanAttributes[SemanticAttributes.MESSAGING_OPERATION] = MessagingOperationValues.RECEIVE; - request.commandInput.MessageAttributeNames = Array.from(new Set([ ...(request.commandInput.MessageAttributeNames ?? []), ...propagation.fields()])); + request.commandInput.MessageAttributeNames = Array.from( + new Set([ + ...(request.commandInput.MessageAttributeNames ?? []), + ...propagation.fields(), + ]) + ); } break; From 80e50df40eea159f35f3d1378de8356551848249 Mon Sep 17 00:00:00 2001 From: JamieDanielson Date: Fri, 3 Jun 2022 18:05:32 -0400 Subject: [PATCH 03/10] add test for message attributes Co-authored-by: Purvi Kanal --- .../test/sqs.test.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/test/sqs.test.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/test/sqs.test.ts index 901b4fca1d..a5ef8370f1 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/test/sqs.test.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/test/sqs.test.ts @@ -67,8 +67,17 @@ describe('SQS', () => { }); beforeEach(() => { + const customMessageAttribute = { + TestMessageAttribute: { + DataType: 'String', + StringValue: 'test value', + }, + }; + mockV2AwsSend(responseMockSuccess, { - Messages: [{ Body: 'msg 1 payload' }, { Body: 'msg 2 payload' }], + Messages: [ + { Body: 'msg 1 payload', MessageAttributes: customMessageAttribute }, + { Body: 'msg 2 payload', MessageAttributes: customMessageAttribute }], } as AWS.SQS.Types.ReceiveMessageResult); }); @@ -361,6 +370,10 @@ describe('SQS', () => { ); }); }); + + it('should have the custom added message attributes', async () => { + expect(receivedMessages[0].MessageAttributes?.TestMessageAttribute?.StringValue).toEqual('test value'); + }); }); describe('hooks', () => { From b747f84391a0de3cf10eeb0b96ffd474d1b53400 Mon Sep 17 00:00:00 2001 From: JamieDanielson Date: Fri, 3 Jun 2022 18:19:04 -0400 Subject: [PATCH 04/10] test both messages --- .../opentelemetry-instrumentation-aws-sdk/test/sqs.test.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/test/sqs.test.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/test/sqs.test.ts index a5ef8370f1..9563af1de9 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/test/sqs.test.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/test/sqs.test.ts @@ -372,7 +372,12 @@ describe('SQS', () => { }); it('should have the custom added message attributes', async () => { - expect(receivedMessages[0].MessageAttributes?.TestMessageAttribute?.StringValue).toEqual('test value'); + receivedMessages. + forEach(msg => { + expect(msg.MessageAttributes?.TestMessageAttribute?.StringValue).toEqual( + 'test value' + ); + }) }); }); From d7db9a3dfcbef687079a5b87e9444a7feb31610d Mon Sep 17 00:00:00 2001 From: Purvi Kanal Date: Mon, 6 Jun 2022 14:12:08 -0400 Subject: [PATCH 05/10] deduplicate message attribute names in seperate function and add unit tests Co-authored-by: Jamie Danielson --- .../src/services/MessageAttributes.ts | 6 ++++++ .../src/services/sqs.ts | 14 +++++++------ .../test/MessageAttributes.test.ts | 9 +++++++++ .../test/sqs.test.ts | 20 +------------------ 4 files changed, 24 insertions(+), 25 deletions(-) diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/MessageAttributes.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/MessageAttributes.ts index 45aa2b617f..182f250b4c 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/MessageAttributes.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/MessageAttributes.ts @@ -106,3 +106,9 @@ export const extractPropagationContext = ( } return undefined; }; + +export const deduplicateMessageAttributeNames = (messageAttributeNames: string[]) => { + return Array.from( + new Set(messageAttributeNames) + ); +}; diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts index 1a54c12241..58c0511b98 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts @@ -39,6 +39,7 @@ import { contextGetter, extractPropagationContext, injectPropagationContext, + deduplicateMessageAttributeNames } from './MessageAttributes'; export class SqsServiceExtension implements ServiceExtension { @@ -67,12 +68,13 @@ export class SqsServiceExtension implements ServiceExtension { spanAttributes[SemanticAttributes.MESSAGING_OPERATION] = MessagingOperationValues.RECEIVE; - request.commandInput.MessageAttributeNames = Array.from( - new Set([ - ...(request.commandInput.MessageAttributeNames ?? []), - ...propagation.fields(), - ]) - ); + const messageAttributeNames = request.commandInput.MessageAttributeNames ? + deduplicateMessageAttributeNames(request.commandInput.MessageAttributeNames) : []; + + request.commandInput.MessageAttributeNames = [ + ...messageAttributeNames, + ...propagation.fields() + ]; } break; diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/test/MessageAttributes.test.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/test/MessageAttributes.test.ts index 9cb8cfdde5..f164672adb 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/test/MessageAttributes.test.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/test/MessageAttributes.test.ts @@ -19,6 +19,7 @@ import { MAX_MESSAGE_ATTRIBUTES, contextSetter, injectPropagationContext, + deduplicateMessageAttributeNames } from '../src/services/MessageAttributes'; describe('MessageAttributes', () => { @@ -76,4 +77,12 @@ describe('MessageAttributes', () => { expect(Object.keys(contextAttributes).length).toBe(10); }); }); + + describe.only('deduplicateMessageAttributeNames', () => { + it('should remove duplicate message attribute names', () => { + const messageAttributeNames = ["name 1", "name 2", "name 1"]; + + expect(deduplicateMessageAttributeNames(messageAttributeNames)).toEqual(["name 1", "name 2"]); + }) + }); }); diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/test/sqs.test.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/test/sqs.test.ts index 9563af1de9..901b4fca1d 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/test/sqs.test.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/test/sqs.test.ts @@ -67,17 +67,8 @@ describe('SQS', () => { }); beforeEach(() => { - const customMessageAttribute = { - TestMessageAttribute: { - DataType: 'String', - StringValue: 'test value', - }, - }; - mockV2AwsSend(responseMockSuccess, { - Messages: [ - { Body: 'msg 1 payload', MessageAttributes: customMessageAttribute }, - { Body: 'msg 2 payload', MessageAttributes: customMessageAttribute }], + Messages: [{ Body: 'msg 1 payload' }, { Body: 'msg 2 payload' }], } as AWS.SQS.Types.ReceiveMessageResult); }); @@ -370,15 +361,6 @@ describe('SQS', () => { ); }); }); - - it('should have the custom added message attributes', async () => { - receivedMessages. - forEach(msg => { - expect(msg.MessageAttributes?.TestMessageAttribute?.StringValue).toEqual( - 'test value' - ); - }) - }); }); describe('hooks', () => { From c0b7e484572520b85b6cf1cad2098c3774515cf9 Mon Sep 17 00:00:00 2001 From: JamieDanielson Date: Mon, 6 Jun 2022 14:16:16 -0400 Subject: [PATCH 06/10] remove line to force ci checks --- .../test/MessageAttributes.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/test/MessageAttributes.test.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/test/MessageAttributes.test.ts index f164672adb..c5932b30bb 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/test/MessageAttributes.test.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/test/MessageAttributes.test.ts @@ -81,7 +81,6 @@ describe('MessageAttributes', () => { describe.only('deduplicateMessageAttributeNames', () => { it('should remove duplicate message attribute names', () => { const messageAttributeNames = ["name 1", "name 2", "name 1"]; - expect(deduplicateMessageAttributeNames(messageAttributeNames)).toEqual(["name 1", "name 2"]); }) }); From b75b319afabccc68965bfaa68e1ed596e595d3d7 Mon Sep 17 00:00:00 2001 From: JamieDanielson Date: Mon, 6 Jun 2022 15:19:00 -0400 Subject: [PATCH 07/10] appease linter Co-authored-by: Purvi Kanal --- .../src/services/MessageAttributes.ts | 8 ++++---- .../src/services/sqs.ts | 12 ++++++++---- .../test/MessageAttributes.test.ts | 13 ++++++++----- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/MessageAttributes.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/MessageAttributes.ts index 182f250b4c..22e2a4851d 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/MessageAttributes.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/MessageAttributes.ts @@ -107,8 +107,8 @@ export const extractPropagationContext = ( return undefined; }; -export const deduplicateMessageAttributeNames = (messageAttributeNames: string[]) => { - return Array.from( - new Set(messageAttributeNames) - ); +export const deduplicateMessageAttributeNames = ( + messageAttributeNames: string[] +) => { + return Array.from(new Set(messageAttributeNames)); }; diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts index 58c0511b98..f67492eca7 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts @@ -39,7 +39,7 @@ import { contextGetter, extractPropagationContext, injectPropagationContext, - deduplicateMessageAttributeNames + deduplicateMessageAttributeNames, } from './MessageAttributes'; export class SqsServiceExtension implements ServiceExtension { @@ -68,12 +68,16 @@ export class SqsServiceExtension implements ServiceExtension { spanAttributes[SemanticAttributes.MESSAGING_OPERATION] = MessagingOperationValues.RECEIVE; - const messageAttributeNames = request.commandInput.MessageAttributeNames ? - deduplicateMessageAttributeNames(request.commandInput.MessageAttributeNames) : []; + const messageAttributeNames = request.commandInput + .MessageAttributeNames + ? deduplicateMessageAttributeNames( + request.commandInput.MessageAttributeNames + ) + : []; request.commandInput.MessageAttributeNames = [ ...messageAttributeNames, - ...propagation.fields() + ...propagation.fields(), ]; } break; diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/test/MessageAttributes.test.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/test/MessageAttributes.test.ts index c5932b30bb..b44128a0cf 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/test/MessageAttributes.test.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/test/MessageAttributes.test.ts @@ -19,7 +19,7 @@ import { MAX_MESSAGE_ATTRIBUTES, contextSetter, injectPropagationContext, - deduplicateMessageAttributeNames + deduplicateMessageAttributeNames, } from '../src/services/MessageAttributes'; describe('MessageAttributes', () => { @@ -78,10 +78,13 @@ describe('MessageAttributes', () => { }); }); - describe.only('deduplicateMessageAttributeNames', () => { + describe('deduplicateMessageAttributeNames', () => { it('should remove duplicate message attribute names', () => { - const messageAttributeNames = ["name 1", "name 2", "name 1"]; - expect(deduplicateMessageAttributeNames(messageAttributeNames)).toEqual(["name 1", "name 2"]); - }) + const messageAttributeNames = ['name 1', 'name 2', 'name 1']; + expect(deduplicateMessageAttributeNames(messageAttributeNames)).toEqual([ + 'name 1', + 'name 2', + ]); + }); }); }); From abc9f566ee825589b7fbbd7f6e89d3d1d4999c69 Mon Sep 17 00:00:00 2001 From: JamieDanielson Date: Mon, 6 Jun 2022 15:38:06 -0400 Subject: [PATCH 08/10] appease linter --- .../opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts index f67492eca7..d1eb92b81d 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts @@ -71,8 +71,8 @@ export class SqsServiceExtension implements ServiceExtension { const messageAttributeNames = request.commandInput .MessageAttributeNames ? deduplicateMessageAttributeNames( - request.commandInput.MessageAttributeNames - ) + request.commandInput.MessageAttributeNames + ) : []; request.commandInput.MessageAttributeNames = [ From d50acc7873ca904c52d3cae737672a62e10e7da7 Mon Sep 17 00:00:00 2001 From: Purvi Kanal Date: Wed, 8 Jun 2022 12:12:45 -0400 Subject: [PATCH 09/10] move logic into dedupe function and add unit tests --- .../src/services/MessageAttributes.ts | 7 +++++-- .../src/services/sqs.ts | 16 +++++---------- .../test/MessageAttributes.test.ts | 20 ++++++++++++++----- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/MessageAttributes.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/MessageAttributes.ts index 22e2a4851d..2f68204b63 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/MessageAttributes.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/MessageAttributes.ts @@ -108,7 +108,10 @@ export const extractPropagationContext = ( }; export const deduplicateMessageAttributeNames = ( - messageAttributeNames: string[] + messageAttributeNames: string[] = [], + propagationFields: string[] ) => { - return Array.from(new Set(messageAttributeNames)); + return messageAttributeNames.length + ? Array.from(new Set([...messageAttributeNames, ...propagationFields])) + : propagationFields; }; diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts index d1eb92b81d..bf382e8d68 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts @@ -68,17 +68,11 @@ export class SqsServiceExtension implements ServiceExtension { spanAttributes[SemanticAttributes.MESSAGING_OPERATION] = MessagingOperationValues.RECEIVE; - const messageAttributeNames = request.commandInput - .MessageAttributeNames - ? deduplicateMessageAttributeNames( - request.commandInput.MessageAttributeNames - ) - : []; - - request.commandInput.MessageAttributeNames = [ - ...messageAttributeNames, - ...propagation.fields(), - ]; + request.commandInput.MessageAttributeNames = + deduplicateMessageAttributeNames( + request.commandInput.MessageAttributeNames, + propagation.fields() + ); } break; diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/test/MessageAttributes.test.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/test/MessageAttributes.test.ts index b44128a0cf..c74635c44e 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/test/MessageAttributes.test.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/test/MessageAttributes.test.ts @@ -79,12 +79,22 @@ describe('MessageAttributes', () => { }); describe('deduplicateMessageAttributeNames', () => { + const messageAttributeNames = ['name 1', 'name 2', 'name 1']; + const propagationFields = ['traceparent']; + it('should remove duplicate message attribute names', () => { - const messageAttributeNames = ['name 1', 'name 2', 'name 1']; - expect(deduplicateMessageAttributeNames(messageAttributeNames)).toEqual([ - 'name 1', - 'name 2', - ]); + expect( + deduplicateMessageAttributeNames( + messageAttributeNames, + propagationFields + ) + ).toEqual(['name 1', 'name 2', 'traceparent']); + }); + + it('should return propagation fields if no message attribute names are present', () => { + expect( + deduplicateMessageAttributeNames(undefined, propagationFields) + ).toEqual(['traceparent']); }); }); }); From 88cc73ee96d3ab15a2b28c08f533c8f05f712302 Mon Sep 17 00:00:00 2001 From: Purvi Kanal Date: Wed, 8 Jun 2022 15:44:44 -0400 Subject: [PATCH 10/10] rename helper function to be more descriptive --- .../src/services/MessageAttributes.ts | 2 +- .../src/services/sqs.ts | 4 ++-- .../test/MessageAttributes.test.ts | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/MessageAttributes.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/MessageAttributes.ts index 2f68204b63..86012e7368 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/MessageAttributes.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/MessageAttributes.ts @@ -107,7 +107,7 @@ export const extractPropagationContext = ( return undefined; }; -export const deduplicateMessageAttributeNames = ( +export const addPropagationFieldsToAttributeNames = ( messageAttributeNames: string[] = [], propagationFields: string[] ) => { diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts index bf382e8d68..f428d68cd3 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/sqs.ts @@ -39,7 +39,7 @@ import { contextGetter, extractPropagationContext, injectPropagationContext, - deduplicateMessageAttributeNames, + addPropagationFieldsToAttributeNames, } from './MessageAttributes'; export class SqsServiceExtension implements ServiceExtension { @@ -69,7 +69,7 @@ export class SqsServiceExtension implements ServiceExtension { MessagingOperationValues.RECEIVE; request.commandInput.MessageAttributeNames = - deduplicateMessageAttributeNames( + addPropagationFieldsToAttributeNames( request.commandInput.MessageAttributeNames, propagation.fields() ); diff --git a/plugins/node/opentelemetry-instrumentation-aws-sdk/test/MessageAttributes.test.ts b/plugins/node/opentelemetry-instrumentation-aws-sdk/test/MessageAttributes.test.ts index c74635c44e..77717b53c5 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-sdk/test/MessageAttributes.test.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-sdk/test/MessageAttributes.test.ts @@ -19,7 +19,7 @@ import { MAX_MESSAGE_ATTRIBUTES, contextSetter, injectPropagationContext, - deduplicateMessageAttributeNames, + addPropagationFieldsToAttributeNames, } from '../src/services/MessageAttributes'; describe('MessageAttributes', () => { @@ -78,22 +78,22 @@ describe('MessageAttributes', () => { }); }); - describe('deduplicateMessageAttributeNames', () => { + describe('addPropagationFieldsToAttributeNames', () => { const messageAttributeNames = ['name 1', 'name 2', 'name 1']; const propagationFields = ['traceparent']; - it('should remove duplicate message attribute names', () => { + it('should remove duplicate message attribute names and add propagation fields', () => { expect( - deduplicateMessageAttributeNames( + addPropagationFieldsToAttributeNames( messageAttributeNames, propagationFields ) ).toEqual(['name 1', 'name 2', 'traceparent']); }); - it('should return propagation fields if no message attribute names are present', () => { + it('should return propagation fields if no message attribute names are set', () => { expect( - deduplicateMessageAttributeNames(undefined, propagationFields) + addPropagationFieldsToAttributeNames(undefined, propagationFields) ).toEqual(['traceparent']); }); });