Skip to content

Commit

Permalink
feat: Use base64 encoded JSON and Binary type to avoid message being … (
Browse files Browse the repository at this point in the history
#1889)

* feat: Use base64 encoded JSON and Binary type to avoid message being dropped by filter policies

* feat: Use BinaryValue, not StringValue

* Feat: AWS automatically base64's the data for us, so we don't want to repeat it
  • Loading branch information
astuyve authored and rochdev committed Mar 3, 2022
1 parent b273258 commit 3610644
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/datadog-plugin-aws-sdk/src/services/sns.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ class Sns {
const ddInfo = {}
tracer.inject(span, 'text_map', ddInfo)
injectPath.MessageAttributes._datadog = {
DataType: 'String',
StringValue: JSON.stringify(ddInfo)
DataType: 'Binary',
BinaryValue: JSON.stringify(ddInfo) // BINARY types are automatically base64 encoded
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions packages/datadog-plugin-aws-sdk/test/sns.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ describe('Sns', () => {
Message: 'Here is my sns message',
MessageAttributes: {
'_datadog': {
'DataType': 'String',
'StringValue': '{"x-datadog-trace-id":"456853219676779160","x-datadog-parent-id":"456853219676779160","x-datadog-sampling-priority":"1"}'
'DataType': 'Binary',
'BinaryValue': '{"x-datadog-trace-id":"456853219676779160","x-datadog-parent-id":"456853219676779160","x-datadog-sampling-priority":"1"}'
}
},
'TopicArn': 'some ARN'
Expand Down Expand Up @@ -97,8 +97,8 @@ describe('Sns', () => {
Message: 'Here is my SNS message',
MessageAttributes: {
'_datadog': {
'DataType': 'String',
'StringValue': '{"x-datadog-trace-id":"456853219676779160","x-datadog-parent-id":"456853219676779160","x-datadog-sampling-priority":"1"}'
'DataType': 'Binary',
'BinaryValue': '{"x-datadog-trace-id":"456853219676779160","x-datadog-parent-id":"456853219676779160","x-datadog-sampling-priority":"1"}'
}
}
},
Expand Down

0 comments on commit 3610644

Please sign in to comment.