serverless-plugin-datadog
Advanced tools
Comparing version 2.18.0 to 2.19.0
{ | ||
"name": "serverless-plugin-datadog", | ||
"version": "2.18.0", | ||
"version": "2.19.0", | ||
"description": "Serverless plugin to automatically instrument python and node functions with datadog tracing", | ||
@@ -5,0 +5,0 @@ "main": "dist/src/index.js", |
@@ -15,2 +15,3 @@ import Service from "serverless/classes/Service"; | ||
forwarder?: string; | ||
integrationTesting?: boolean; | ||
enableTags: boolean; | ||
@@ -17,0 +18,0 @@ injectLogContext: boolean; |
@@ -30,2 +30,3 @@ "use strict"; | ||
exclude: [], | ||
integrationTesting: false, | ||
}; | ||
@@ -50,3 +51,3 @@ function setEnvConfiguration(config, service) { | ||
} | ||
if (environment[logForwardingEnvVar] === undefined) { | ||
if (environment[logForwardingEnvVar] === undefined && config.addExtension === false) { | ||
environment[logForwardingEnvVar] = config.flushMetricsToLogs; | ||
@@ -53,0 +54,0 @@ } |
@@ -7,3 +7,3 @@ import Service from "serverless/classes/Service"; | ||
} | ||
export declare function addCloudWatchForwarderSubscriptions(service: Service, aws: Aws, functionArn: CloudFormationObjectArn | string): Promise<string[]>; | ||
export declare function addCloudWatchForwarderSubscriptions(service: Service, aws: Aws, functionArn: CloudFormationObjectArn | string, integrationTesting: boolean | undefined): Promise<string[]>; | ||
export declare function canSubscribeLogGroup(aws: Aws, logGroupName: string, expectedSubName: string): Promise<boolean>; | ||
@@ -10,0 +10,0 @@ export declare function describeSubscriptionFilters(aws: Aws, logGroupName: string): Promise<{ |
@@ -41,3 +41,3 @@ "use strict"; | ||
} | ||
function addCloudWatchForwarderSubscriptions(service, aws, functionArn) { | ||
function addCloudWatchForwarderSubscriptions(service, aws, functionArn, integrationTesting) { | ||
var _a; | ||
@@ -53,2 +53,5 @@ return __awaiter(this, void 0, void 0, function* () { | ||
} | ||
else if (integrationTesting === true) { | ||
errors.push("Skipping forwarder ARN validation because 'integrationTesting' is set to true"); | ||
} | ||
else { | ||
@@ -55,0 +58,0 @@ yield validateForwarderArn(aws, functionArn); |
@@ -147,3 +147,3 @@ "use strict"; | ||
const aws = this.serverless.getProvider("aws"); | ||
const errors = yield forwarder_1.addCloudWatchForwarderSubscriptions(this.serverless.service, aws, datadogForwarderArn); | ||
const errors = yield forwarder_1.addCloudWatchForwarderSubscriptions(this.serverless.service, aws, datadogForwarderArn, config.integrationTesting); | ||
for (const error of errors) { | ||
@@ -162,3 +162,8 @@ this.serverless.cli.log(error); | ||
wrapper_1.redirectHandlers(handlers, config.addLayers); | ||
output_1.addOutputLinks(this.serverless, config.site); | ||
if (config.integrationTesting === false) { | ||
output_1.addOutputLinks(this.serverless, config.site); | ||
} | ||
else { | ||
this.serverless.cli.log("Skipped adding output links because 'integrationTesting' is set true"); | ||
} | ||
}); | ||
@@ -248,5 +253,2 @@ } | ||
} | ||
if (config.flushMetricsToLogs) { | ||
throw new Error("`addExtension` and `flushMetricsToLogs` should not be set to true at the same time. `flushMetricsToLogs` is true by default."); | ||
} | ||
if (config.apiKey === undefined && config.apiKMSKey === undefined) { | ||
@@ -253,0 +255,0 @@ throw new Error("When `addExtension` is true, `apiKey` or `apiKMSKey` must also be set."); |
{ | ||
"name": "serverless-plugin-datadog", | ||
"version": "2.18.0", | ||
"version": "2.19.0", | ||
"description": "Serverless plugin to automatically instrument python and node functions with datadog tracing", | ||
@@ -5,0 +5,0 @@ "main": "dist/src/index.js", |
@@ -27,3 +27,3 @@ # Datadog Serverless Plugin | ||
|----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| `flushMetricsToLogs` | Send custom metrics by using logs with the Datadog Forwarder Lambda function (recommended). Defaults to `true`. If you disable this parameter, it's required to set `apiKey` (or `apiKMSKey` if encrypted). Do not set `addExtension` to `true` when using `flushMetricsToLogs`. | | ||
| `flushMetricsToLogs` | Send custom metrics by using logs with the Datadog Forwarder Lambda function (recommended). Defaults to `true`. If you disable this parameter, it's required to set `apiKey` (or `apiKMSKey` if encrypted). `flushMetricsToLogs` is ignored when `addExtension` is true. | | ||
| `site` | Set which Datadog site to send data, this is only used when `flushMetricsToLogs` is `false` or `addExtension` is `true`. Possible values are `datadoghq.com`, `datadoghq.eu`, `us3.datadoghq.com` and `ddog-gov.com`. The default is `datadoghq.com`. | | ||
@@ -33,7 +33,8 @@ | `apiKey` | Datadog API Key, only needed when `flushMetricsToLogs` is `false` or `addExtension` is `true`. For more information about getting a Datadog API key, see the [API key documentation][3]. | | ||
| `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 `apiKey` (or `apiKMSKey`) parameter. While using `addExtension` set `flushMetricsToLogs` to `false` and leave out `forwarderArn`. The Datadog Lambda Extension Layer is in public preview. Learn more about the Lambda Extension Layer [here][8]. | | ||
| `addExtension` | Whether to install the Datadog Lambda Extension as a layer. Defaults to `false`. When enabled, it's required to set the `apiKey` (or `apiKMSKey`) parameter. While using `addExtension` leave out `forwarderArn`. The Datadog Lambda Extension Layer is in public preview. Learn more about the Lambda Extension Layer [here][8]. | | ||
| `logLevel` | The log level, set to `DEBUG` for extended logging. Defaults to `info`. | | ||
| `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. Defaults to `true`. | | ||
| `forwarderArn` | Setting this parameter subscribes the given Datadog forwarder to the Lambda functions’ CloudWatch log groups. Required when `enableDDTracing` is set to `true`. Do not set `addExtension` to `true` when using `forwarderArn`. | | ||
| `forwarderArn` | Setting this parameter subscribes the given Datadog forwarder to the Lambda functions’ CloudWatch log groups. Required when `enableDDTracing` is set to `true` unless the subscription is otherwise applied. For example, if a Datadog Forwarder subscription is applied via Datadog's AWS Integration, then `forwarderArn` is not required. Do not set `addExtension` to `true` when using `forwarderArn`. | | ||
| `integrationTesting` | Set `true` when running integration tests. This will bypass the validation of the Forwarder ARN and the addition of Datadog Monitor output links. Defaults to `false`. | | ||
| `enableTags` | When set, automatically tag the Lambda functions with the `service` and `env` tags using the `service` and `stage` values from the serverless application definition. It does NOT override if a `service` or `env` tag already exists. Defaults to `true`. | | ||
@@ -52,3 +53,3 @@ | `injectLogContext` | When set, the lambda layer will automatically patch console.log with Datadog's tracing ids. Defaults to `true`. | | ||
apiKey: "{Datadog_API_Key}" | ||
apiKMSKey: "{Encripted_Datadog_API_Key}" | ||
apiKMSKey: "{Encrypted_Datadog_API_Key}" | ||
addLayers: true | ||
@@ -55,0 +56,0 @@ logLevel: "info" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
110951
1108
165