-
Notifications
You must be signed in to change notification settings - Fork 46
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
Cover string/b64 msg attribute trace extraction #211
Conversation
TODO: Update ddtrace version in pyproject.toml and poetry lock file once DataDog/dd-trace-py#3404 is merged and released. |
…eption if message attributes are not string or binary
…aDog/datadog-lambda-python into ar/sns-trace-context-from-b64-binary
…ttribute, and try to get BinaryValue vs binaryValue depending on how casing off comes in
waiting on DataDog/dd-trace-py#3404 |
…#3404) Making sure msg attributes are encoded by the tracer (by changing the Type) allows our lambda library to decode the message attribute and create inferred spans for sns and sqs. Checkout this dd-lambda-python [PR](DataDog/datadog-lambda-python#211) for more context. ## Checklist - [ ] Added to the correct milestone. - [ ] Tests provided or description of manual testing performed is included in the code or PR. - [ ] Library documentation is updated. - [ ] [Corp site](https://github.com/DataDog/documentation/) documentation is updated (link to the PR).
…#3404) Making sure msg attributes are encoded by the tracer (by changing the Type) allows our lambda library to decode the message attribute and create inferred spans for sns and sqs. Checkout this dd-lambda-python [PR](DataDog/datadog-lambda-python#211) for more context. ## Checklist - [ ] Added to the correct milestone. - [ ] Tests provided or description of manual testing performed is included in the code or PR. - [ ] Library documentation is updated. - [ ] [Corp site](https://github.com/DataDog/documentation/) documentation is updated (link to the PR). (cherry picked from commit bd8e176)
…#3404) Making sure msg attributes are encoded by the tracer (by changing the Type) allows our lambda library to decode the message attribute and create inferred spans for sns and sqs. Checkout this dd-lambda-python [PR](DataDog/datadog-lambda-python#211) for more context. ## Checklist - [ ] Added to the correct milestone. - [ ] Tests provided or description of manual testing performed is included in the code or PR. - [ ] Library documentation is updated. - [ ] [Corp site](https://github.com/DataDog/documentation/) documentation is updated (link to the PR). (cherry picked from commit bd8e176)
…#3404) Making sure msg attributes are encoded by the tracer (by changing the Type) allows our lambda library to decode the message attribute and create inferred spans for sns and sqs. Checkout this dd-lambda-python [PR](DataDog/datadog-lambda-python#211) for more context. ## Checklist - [ ] Added to the correct milestone. - [ ] Tests provided or description of manual testing performed is included in the code or PR. - [ ] Library documentation is updated. - [ ] [Corp site](https://github.com/DataDog/documentation/) documentation is updated (link to the PR). (cherry picked from commit bd8e176)
…#3404) Making sure msg attributes are encoded by the tracer (by changing the Type) allows our lambda library to decode the message attribute and create inferred spans for sns and sqs. Checkout this dd-lambda-python [PR](DataDog/datadog-lambda-python#211) for more context. ## Checklist - [ ] Added to the correct milestone. - [ ] Tests provided or description of manual testing performed is included in the code or PR. - [ ] Library documentation is updated. - [ ] [Corp site](https://github.com/DataDog/documentation/) documentation is updated (link to the PR). (cherry picked from commit bd8e176)
…#3404) Making sure msg attributes are encoded by the tracer (by changing the Type) allows our lambda library to decode the message attribute and create inferred spans for sns and sqs. Checkout this dd-lambda-python [PR](DataDog/datadog-lambda-python#211) for more context. ## Checklist - [ ] Added to the correct milestone. - [ ] Tests provided or description of manual testing performed is included in the code or PR. - [ ] Library documentation is updated. - [ ] [Corp site](https://github.com/DataDog/documentation/) documentation is updated (link to the PR). (cherry picked from commit bd8e176)
…aDog/datadog-lambda-python into ar/sns-trace-context-from-b64-binary
datadog_lambda/tracing.py
Outdated
dd_payload.get("Value", r"{}"), | ||
) | ||
else: | ||
raise Exception( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this error caught anywhere? Why raise here when we previously didn't?
If for some reason the _datadog
attribute isn't string or binary, we don't want to throw an error and halt the customer function execution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I now see why we wouldn't want to stop the execution if its not a string or binary. I opted for making this exception a logger.warn as I think it would still be useful for the customer to know that their message attribute type is not supported by our library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I think that's a good call
What does this PR do?
Ports Datadog/datadog-lambda-js#269 to Python Lambda Library and Tracer.
Motivation
FixesDatadog/serverless-plugin-datadog#232 for Python lambda library and tracer. Message attributes sent as json strings break filter policies and make it so messages don't make it to subscribers with a filter policy.
Testing Guidelines
Linking my local versions of the tracer and lambda library to my sample app I had a lambda function that published to an SNS topic that has an SQS subscription with a filter policy. After b64 encoding only SQS messageAttribute trace data in ddtrace-py the trace context is successfully passed through subscribers with a filter policy. I left SNS messageAttributes as strings. Check out my DD TRACE PY PR.
Publisher Lambda->SNS->SQS-> Receiver Lambda (dd link)
I also manually tested
Publisher Lambda->SNS-> Receiver Lambda dd link
Publisher Lambda->SQS-> Receiver Lambda dd link
Additional Notes
Types of Changes
Check all that apply