Skip to content

Conversation

@Otanikotani
Copy link
Contributor

What does this PR do?

This PR is a continuation of #36.
In this PR added:

  • KinesisHeaderable - a similar class to SQSHeaderable, but for Kinesis Lambda Events.
  • DDLambda.getTraceContextJSONString - a method to get JSON of the current tracing info. This is needed when you want to pass the DD context through message queues. In our case, we need to it be able to append the tracing info to SQS and Kinesis messages. Usage example:
public void sendMessageToSQS(DDLambda ddl) {
   SendMessageRequest sendMessageRequest = new SendMessageRequest()
     .withQueueUrl("somewhere")
     .withMessageBody("foobar")
     .withMessageAttributes(Map.of(
       SQSHeaderable.DATADOG_ATTRIBUTE_NAME, new MessageAttributeValue().withStringValue(ddLambda.getTraceContextJSONString())
   ));
   sqs.sendMessage(sendMessageRequest);
}

Motivation

Improving usability of datadog-lambda-java

Testing Guidelines

I made unit tests. Please note that there is an added dependency to com.amazonaws:aws-java-sdk-kinesis:1.11.980 for tests. This is required to be able to build a Kinesis record in the test to make sure it is properly parsed.

Additional Notes

Please note, that there is a compileOnly dependency of com.amazonaws:aws-java-sdk-kinesis:1.11.980. This is required to be able to get Kinesis's record .getData().

Types of changes

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

Checklist

  • 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

Make SQSHeaderable.DATADOG_ATTRIBUTE_NAME public to be able to serialize DD tracing info when sending SQS messages
@Otanikotani Otanikotani requested a review from a team as a code owner March 23, 2021 17:56
@agocs
Copy link
Contributor

agocs commented Mar 26, 2021

Hey @Otanikotani , thank you for this contribution as well. I'll look through it a little more closely today.

@agocs
Copy link
Contributor

agocs commented Apr 19, 2021

OK, we're finally migrated from Bintray to Maven Central! I'll get this merged and deployed today.

@Otanikotani
Copy link
Contributor Author

@agocs thank you for letting us know!

On other note, is there a chance that the next release of datadog-lambda-java layer will also include the latest dd-tracer-java? There is a pesky issue (DataDog/dd-trace-java#2613) that we reported regarding the logs in dd-tracer-java. I see that the fix for it (DataDog/dd-trace-java#2616) was already merged. By the way, that was blazing fast, good work, Datadog! But anyhow, the fix is merged for a milestone 0.79.0, so we were wondering when can we update the versions of the layers to have this fix?

@agocs
Copy link
Contributor

agocs commented Apr 19, 2021

@Otanikotani Thanks for opening that issue against dd-trace-java, by the way. I just spoke with the APM-Java team, and they're targeting this week for 0.79.0. Once that's released, I'll create version 3 of the dd-trace-java Lambda Layer, which will contain the printwriter fix.

@agocs agocs merged commit 7f1c919 into DataDog:main Apr 19, 2021
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