Skip to content

Conversation

@agocs
Copy link
Contributor

@agocs agocs commented Jan 8, 2021

What does this PR do?

This PR adds a script that publishes dd-trace-java as a lambda layer. That will enable customers to add dd-trace-java to their lambdas as a java agent. Additionally, it also sets useful values inside the tracer to make sure the traces get back to Datadog.

Motivation

Testing Guidelines

All manual

Additional Notes

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

@agocs agocs requested a review from a team as a code owner January 8, 2021 21:25

set -e

LAYER_NAMES=("Datadog-Python27" "Datadog-Python36" "Datadog-Python37" "Datadog-Python38")
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these the correct layer names?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 deleted the unused line

@nhinsch
Copy link
Contributor

nhinsch commented Jan 8, 2021

  1. I would definitely add a step to sign the layer before publishing. You can copy most of the code from one of the other repos. I can help you out if you have any questions. Then I would update the documentation/README with instructions for how to use this layer with code signing (it'll be the same as the other layers).

  2. I would create separate scripts intended for publishing the layer to production and to sandbox that invoke the general publish and signing scripts with specific parameters, like we do for the other layers:

  • For sandbox, we should only publish to sa-east-1. For production, we should publish to all available regions.
  • The signing script also needs to know which account we want to use to sign the layer.
  1. Finally, can we also bring over the "add new region" script that we have in the other layers as well?

@agocs agocs changed the title Add scripts to publish Java layer versions Add scripts to publish Java tracer layer. Also add code to set the correct tags in traces Jan 29, 2021
@agocs
Copy link
Contributor Author

agocs commented Jan 29, 2021

Added code signing and test-layer-publishing. I'm going to defer on add new regions for now, in the interest of wanting to release this version so that @Hesperide can start testing again


if [ ${#LAYERS_MISSING_REGIONS[@]} -gt 0 ]; then
echo "WARNING: Following regions missing layers: ${LAYERS_MISSING_REGIONS[@]}"
echo "Please run ./add_new_region.sh <new_region> to add layers to the missing regions"
Copy link
Contributor

Choose a reason for hiding this comment

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

You mentioned that you weren't going to add the add_new_region script yet, so I would take this out for now

# Copyright 2019 Datadog, Inc.

# Lists most recent layers ARNs across regions to STDOUT
# Optionals args: [layer-name] [region]
Copy link
Contributor

Choose a reason for hiding this comment

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

Optionals -> optional

Also, is layer-name really an arg? It looks like it's hardcoded as dd-trace-java

Copy link
Contributor

@nhinsch nhinsch left a comment

Choose a reason for hiding this comment

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

lgtm, just a couple of suggestions

@nhinsch
Copy link
Contributor

nhinsch commented Jan 31, 2021

I would also reiterate my suggestion of bringing over the add new region script. It's probably not too hard since it's already written, and I suspect we'll need it soon enough, so we might as well get it out of the way now. But everything here looks good.


if [ -z "$2" ]
then
echo "Usage: ./sign_layers (staging|prod) layer_file.zip"
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be (sandbox|prod)

aws s3api delete-object --bucket $S3_BUCKET_NAME --key $S3_SIGNED_ZIP_KEY

echo
echo "Successfully signed all layers!"
Copy link
Contributor

Choose a reason for hiding this comment

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

all layers -> the layer (for this repo)

}
Span span = GlobalTracer.get().activeSpan();
if (span != null) {
span.setTag("request_id", requestId);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the other libraries add function_version and resource_names tags as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

@agocs agocs merged commit 639633b into main Feb 1, 2021
@agocs agocs deleted the chris.agocs/deploy_java_tracer_layer branch February 1, 2021 15:27
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.

3 participants