Skip to content
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

Set the default value of addExtension to true #233

Merged
merged 6 commits into from
Mar 3, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ To further configure your plugin, use the following custom parameters in your `s
| `apiKMSKey` | Datadog API Key encrypted using KMS. Use this parameter if you're storing your secrets with KMS, and if `flushMetricsToLogs` is `false` or `addExtension` is `true`. Defining `apiKMSKey` will add the Datadog API Key directly to your Lambda functions as an environment variable. |
| `captureLambdaPayload` | (Experimental) This optional setting configures Datadog ingestion for incoming and outgoing AWS Lambda payloads. Function request and response values are added as part of outgoing APM spans sent to Datadog, and require Datadog APM to be configured on your function. Obfuscation of fields in the Lambda payload is available via the `replace_tags` block within `apm_config` settings in [datadog.yaml.][12] Defaults to `false`. |
| `addLayers` | Whether to install the Datadog Lambda library as a layer. Defaults to `true`. Set to `false` when you plan to package the Datadog Lambda library to your function's deployment package on your own so that you can install a specific version of the Datadog Lambda library ([Python][4] or [Node.js][5]). |
| `addExtension` | Whether to install the Datadog Lambda Extension as a layer. Defaults to `false`. When enabled, it's required to set the environment variable `DATADOG_API_KEY`, or the configuration values `apiKMSKey` or `apiKeySecretArn`. Learn more about the [Datadog Lambda Extension Layer][8] in the documentation. **Note**: AWS only supports Lambda Extensions for [certain runtimes][9]. |
| `addExtension` | Whether to install the Datadog Lambda Extension as a layer. Defaults to `true`. When enabled, it's required to set the environment variable `DATADOG_API_KEY`, or the configuration values `apiKMSKey` or `apiKeySecretArn`. Learn more about the [Datadog Lambda Extension Layer][8] in the documentation. **Note**: AWS only supports Lambda Extensions for [certain runtimes][9]. |
| `logLevel` | The log level, set to `DEBUG` for extended logging. |
| `enableXrayTracing` | Set `true` to enable X-Ray tracing on the Lambda functions and API Gateway integrations. Defaults to `false`. |
| `enableDDTracing` | Enable Datadog tracing on the Lambda function. Note: This applies only to integrations using the Datadog Extension. Defaults to `true`. |
Expand Down
1 change: 1 addition & 0 deletions integration_tests/serverless-forwarder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ custom:
integrationTesting: true
logLevel: "info"
subscribeToExecutionLogs: true
addExtension: false
exclude:
- ExcludeThis
- Exclude-This
Expand Down
4 changes: 2 additions & 2 deletions src/env.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ describe("getConfig", () => {
enableXrayTracing: false,
enableDDTracing: true,
enableDDLogs: true,
addExtension: false,
addExtension: true,
enableTags: true,
injectLogContext: true,
exclude: [],
Expand Down Expand Up @@ -213,7 +213,7 @@ describe("getConfig", () => {
enableXrayTracing: false,
enableDDTracing: true,
enableDDLogs: true,
addExtension: false,
addExtension: true,
enableTags: true,
injectLogContext: true,
exclude: [],
Expand Down
2 changes: 1 addition & 1 deletion src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export const defaultConfiguration: Configuration = {
site: "datadoghq.com",
enableXrayTracing: false,
enableDDTracing: true,
addExtension: false,
addExtension: true,
enableTags: true,
injectLogContext: true,
exclude: [],
Expand Down
23 changes: 20 additions & 3 deletions src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ describe("ServerlessPlugin", () => {
runtime: "nodejs14.x",
},
},
custom: {
datadog: {
apiKey: 1234,
},
},
},
};

Expand All @@ -74,7 +79,10 @@ describe("ServerlessPlugin", () => {
functions: {
node1: {
handler: "my-func.ev",
layers: [expect.stringMatching(/arn\:aws\:lambda\:us\-east\-1\:.*\:layer\:.*/)],
layers: [
expect.stringMatching(/arn\:aws\:lambda\:us\-east\-1\:.*\:layer\:.*/),
"arn:aws:lambda:us-east-1:464622532012:layer:Datadog-Extension:16",
],
runtime: "nodejs14.x",
},
},
Expand Down Expand Up @@ -198,6 +206,7 @@ describe("ServerlessPlugin", () => {
custom: {
datadog: {
addLayers: false,
apiKey: 1234,
},
},
},
Expand All @@ -210,7 +219,7 @@ describe("ServerlessPlugin", () => {
functions: {
node1: {
handler: "my-func.ev",
layers: [],
layers: ["arn:aws:lambda:us-east-1:464622532012:layer:Datadog-Extension:16"],
runtime: "nodejs14.x",
},
},
Expand Down Expand Up @@ -242,6 +251,7 @@ describe("ServerlessPlugin", () => {
datadog: {
exclude: ["node1"],
addLayers: true,
apiKey: 1234,
},
},
},
Expand Down Expand Up @@ -285,6 +295,7 @@ describe("ServerlessPlugin", () => {
custom: {
datadog: {
enableXrayTracing: true,
apiKey: 1234,
},
},
},
Expand All @@ -297,7 +308,10 @@ describe("ServerlessPlugin", () => {
functions: {
node1: {
handler: "my-func.ev",
layers: [expect.stringMatching(/arn\:aws\:lambda\:us\-east\-1\:.*\:layer\:.*/)],
layers: [
expect.stringMatching(/arn\:aws\:lambda\:us\-east\-1\:.*\:layer\:.*/),
"arn:aws:lambda:us-east-1:464622532012:layer:Datadog-Extension:16",
],
runtime: "nodejs14.x",
},
},
Expand Down Expand Up @@ -667,6 +681,7 @@ describe("ServerlessPlugin", () => {
datadog: {
flushMetricsToLogs: false,
monitors: true,
apiKey: 1234,
},
},
},
Expand Down Expand Up @@ -718,6 +733,7 @@ describe("ServerlessPlugin", () => {
custom: {
datadog: {
forwarderArn: "some-arn",
addExtension: false,
},
},
},
Expand Down Expand Up @@ -754,6 +770,7 @@ describe("ServerlessPlugin", () => {
custom: {
datadog: {
forwarder: "some-arn",
addExtension: false,
},
},
},
Expand Down