Skip to content

Check for the new direct invocation trace format and use that #194

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

Merged

Conversation

agocs
Copy link
Contributor

@agocs agocs commented Jun 21, 2021

What does this PR do?

Updates datadog-lambda-python so it can extract trace contexts stored in context.client_context.custom using the new propagation format, described in this doc: https://docs.google.com/document/d/1pruSeesAr2bAVMtz_rUlsiBZKFoFWdB4nSq5Vuym2l8/edit#heading=h.ptr8uhqw5ht

Motivation

Storing a map containing trace context in context.client_context.custom._datadog causes compatibility issues with Go and Java lambda functions. C.f. aws/aws-lambda-java-libs#212. We're updating the trace propagation format to fix this issue.

Testing Guidelines

Additional Notes

Types of Changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog
  • This PR passes the integration tests (ask a Datadog member to run the tests)

@agocs agocs requested a review from a team as a code owner June 21, 2021 16:00
@agocs agocs added the WIP label Jun 21, 2021
@agocs agocs removed the WIP label Jun 21, 2021
let traceData = null;

if (
custom._datadog &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe you could use .hasOwnProperty as well for _datadog ?


if (!traceData || typeof traceData !== "object") {
if (!custom || typeof custom !== "object") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe a test to validate this condition could be useful ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@maxday
Copy link
Contributor

maxday commented Jun 21, 2021

LGTM ! I left minor comments

@maxday maxday self-requested a review June 21, 2021 19:59
@agocs agocs merged commit b53b8c6 into main Jun 21, 2021
@agocs agocs deleted the chris.agocs/new_direct_invocation_trace_propogation_format branch June 21, 2021 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants