serverless-plugin-datadog 5.66.0 → 5.67.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2 @@
1
+ export declare function precompilePython(serverless: any): void;
2
+ //# sourceMappingURL=precomile-python.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"precomile-python.d.ts","sourceRoot":"","sources":["../../src/precomile-python.ts"],"names":[],"mappings":"AAIA,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,GAAG,QAW/C"}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.precompilePython = void 0;
27
+ const child_process_1 = require("child_process");
28
+ const fs = __importStar(require("fs"));
29
+ const path = __importStar(require("path"));
30
+ function precompilePython(serverless) {
31
+ serverless.cli.log('Precompiling Python files');
32
+ let tempDirName = 'datadog';
33
+ let slsDir = serverless.processedInput.options.package || '.serverless';
34
+ let tempDir = path.resolve(slsDir, tempDirName);
35
+ for (const file of lsDirFiles(slsDir, false)) {
36
+ if (file.endsWith('.zip')) {
37
+ preCompilePackage(tempDir, file);
38
+ }
39
+ }
40
+ }
41
+ exports.precompilePython = precompilePython;
42
+ function preCompilePackage(tempDir, zipFile) {
43
+ (0, child_process_1.spawnSync)('unzip', ['-d', tempDir, zipFile]);
44
+ (0, child_process_1.spawnSync)('python', ['-m', 'compileall', '-b', tempDir]);
45
+ replacePyFiles(tempDir);
46
+ (0, child_process_1.spawnSync)('rm', [zipFile]);
47
+ (0, child_process_1.execSync)(`cd ${tempDir} && zip -r ${zipFile} .`);
48
+ (0, child_process_1.spawnSync)('rm', ['-r', tempDir]);
49
+ }
50
+ function replacePyFiles(dir) {
51
+ for (const file of lsDirFiles(dir)) {
52
+ if (file.endsWith('.pyc')) {
53
+ let pyFile = file.replace('.pyc', '.py');
54
+ (0, child_process_1.spawnSync)('rm', [pyFile]);
55
+ }
56
+ }
57
+ }
58
+ function* lsDirFiles(dir, recursive = true) {
59
+ for (const dirent of fs.readdirSync(dir, { withFileTypes: true })) {
60
+ const res = path.resolve(dir, dirent.name);
61
+ if (recursive && dirent.isDirectory()) {
62
+ yield* lsDirFiles(res, recursive);
63
+ }
64
+ else {
65
+ yield res;
66
+ }
67
+ }
68
+ }
69
+ //# sourceMappingURL=precomile-python.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"precomile-python.js","sourceRoot":"","sources":["../../src/precomile-python.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAoD;AACpD,uCAAyB;AACzB,2CAA6B;AAE7B,SAAgB,gBAAgB,CAAC,UAAe;IAC9C,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;IAChD,IAAI,WAAW,GAAG,SAAS,CAAC;IAC5B,IAAI,MAAM,GAAG,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,OAAO,IAAI,aAAa,CAAC;IACxE,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAA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C,EAAE;QACjE,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QAC3C,IAAI,SAAS,IAAI,MAAM,CAAC,WAAW,EAAE,EAAE;YACrC,KAAK,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;SACnC;aAAM;YACL,MAAM,GAAG,CAAC;SACX;KACF;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function precompilePython(serverless: any): void;
2
+ //# sourceMappingURL=precompile-python.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"precompile-python.d.ts","sourceRoot":"","sources":["../../src/precompile-python.ts"],"names":[],"mappings":"AAIA,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,GAAG,QAW/C"}
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.precompilePython = void 0;
27
+ const child_process_1 = require("child_process");
28
+ const fs = __importStar(require("fs"));
29
+ const path = __importStar(require("path"));
30
+ function precompilePython(serverless) {
31
+ serverless.cli.log('Precompiling Python files');
32
+ let tempDirName = 'datadog';
33
+ let slsDir = serverless.processedInput.options.package || '.serverless';
34
+ let tempDir = path.resolve(slsDir, tempDirName);
35
+ for (const file of lsDirFiles(slsDir, false)) {
36
+ if (file.endsWith('.zip')) {
37
+ preCompilePackage(serverless.service.provider.runtime, tempDir, file);
38
+ }
39
+ }
40
+ }
41
+ exports.precompilePython = precompilePython;
42
+ function preCompilePackage(python, tempDir, zipFile) {
43
+ (0, child_process_1.spawnSync)('unzip', ['-d', tempDir, zipFile]);
44
+ precompile(python, tempDir);
45
+ replacePyFiles(tempDir);
46
+ (0, child_process_1.spawnSync)('rm', [zipFile]);
47
+ (0, child_process_1.execSync)(`cd ${tempDir} && zip -r ${zipFile} .`);
48
+ (0, child_process_1.spawnSync)('rm', ['-r', tempDir]);
49
+ }
50
+ function precompile(python, dir) {
51
+ // TODO: run precompile in docker container
52
+ //spawnSync('python', ['-m', 'compileall', '-b', dir]);
53
+ console.log("----------------------------------------");
54
+ console.log("python: ", python);
55
+ console.log("----------------------------------------");
56
+ let image = python.replace('python3', 'python:3');
57
+ (0, child_process_1.spawnSync)('docker', ['run', '-v', `${dir}:/mnt`, image, 'python', '-m', 'compileall', '-b', '/mnt']);
58
+ }
59
+ function replacePyFiles(dir) {
60
+ for (const file of lsDirFiles(dir)) {
61
+ if (file.endsWith('.pyc')) {
62
+ let pyFile = file.replace('.pyc', '.py');
63
+ (0, child_process_1.spawnSync)('rm', [pyFile]);
64
+ }
65
+ }
66
+ }
67
+ function* lsDirFiles(dir, recursive = true) {
68
+ for (const dirent of fs.readdirSync(dir, { withFileTypes: true })) {
69
+ const res = path.resolve(dir, dirent.name);
70
+ if (recursive && dirent.isDirectory()) {
71
+ yield* lsDirFiles(res, recursive);
72
+ }
73
+ else {
74
+ yield res;
75
+ }
76
+ }
77
+ }
78
+ //# sourceMappingURL=precompile-python.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"precompile-python.js","sourceRoot":"","sources":["../../src/precompile-python.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAoD;AACpD,uCAAyB;AACzB,2CAA6B;AAE7B,SAAgB,gBAAgB,CAAC,UAAe;IAC9C,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;IAChD,IAAI,WAAW,GAAG,SAAS,CAAC;IAC5B,IAAI,MAAM,GAAG,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,OAAO,IAAI,aAAa,CAAC;IACxE,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAEhD,KAAK,MAAM,IAAI,IAAI,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE;QAC5C,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;YACzB,iBAAiB,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;SACvE;KACF;AACH,CAAC;AAXD,4CAWC;AAED,SAAS,iBAAiB,CAAC,MAAc,EAAE,OAAe,EAAE,OAAe;IACzE,IAAA,yBAAS,EAAC,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAC7C,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5B,cAAc,CAAC,OAAO,CAAC,CAAC;IACxB,IAAA,yBAAS,EAAC,IAAI,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3B,IAAA,wBAAQ,EAAC,MAAM,OAAO,cAAc,OAAO,IAAI,CAAC,CAAC;IACjD,IAAA,yBAAS,EAAC,IAAI,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,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F;AACH,CAAC"}
@@ -0,0 +1,18 @@
1
+ export interface ServerlessMonitor {
2
+ name: string;
3
+ threshold: number;
4
+ query: (cloudFormationStackId: string, criticalThreshold: number) => string;
5
+ message: string;
6
+ type?: string;
7
+ }
8
+ export declare const HIGH_ERROR_RATE: ServerlessMonitor;
9
+ export declare const TIMEOUT: ServerlessMonitor;
10
+ export declare const OUT_OF_MEMORY: ServerlessMonitor;
11
+ export declare const HIGH_ITERATOR_AGE: ServerlessMonitor;
12
+ export declare const HIGH_COLD_START_RATE: ServerlessMonitor;
13
+ export declare const HIGH_THROTTLES: ServerlessMonitor;
14
+ export declare const INCREASED_COST: ServerlessMonitor;
15
+ export declare const SERVERLESS_MONITORS: {
16
+ [key: string]: ServerlessMonitor;
17
+ };
18
+ //# sourceMappingURL=serverless_monitors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serverless_monitors.d.ts","sourceRoot":"","sources":["../../src/serverless_monitors.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,CAAC,qBAAqB,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,KAAK,MAAM,CAAC;IAC5E,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,eAAe,EAAE,iBAQ7B,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,iBAQrB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,iBAQ3B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,iBAQ/B,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,iBAQlC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,iBAQ5B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,iBAQ5B,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAAA;CAQnE,CAAC"}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SERVERLESS_MONITORS = exports.INCREASED_COST = exports.HIGH_THROTTLES = exports.HIGH_COLD_START_RATE = exports.HIGH_ITERATOR_AGE = exports.OUT_OF_MEMORY = exports.TIMEOUT = exports.HIGH_ERROR_RATE = void 0;
4
+ exports.HIGH_ERROR_RATE = {
5
+ name: "High Error Rate on {{functionname.name}} in {{region.name}} for {{aws_account.name}}",
6
+ threshold: 0.1,
7
+ query: (cloudFormationStackId, criticalThreshold) => {
8
+ return `avg(last_15m):sum:aws.lambda.errors{aws_cloudformation_stack-id:${cloudFormationStackId}} by {functionname,region,aws_account}.as_count() / sum:aws.lambda.invocations{aws_cloudformation_stack-id:${cloudFormationStackId}} by {functionname,region,aws_account}.as_count() >= ${criticalThreshold}`;
9
+ },
10
+ message: "More than 10% of the function’s invocations were errors in the selected time range. {{#is_alert}} Resolution: Examine the function’s logs, check for recent code or configuration changes with [Deployment Tracking](https://docs.datadoghq.com/serverless/deployment_tracking), or look for failures across microservices with [distributed tracing](https://docs.datadoghq.com/serverless/distributed_tracing).{{/is_alert}}",
11
+ };
12
+ exports.TIMEOUT = {
13
+ name: "Timeout on {{functionname.name}} in {{region.name}} for {{aws_account.name}}",
14
+ threshold: 1,
15
+ query: (cloudFormationStackId, criticalThreshold) => {
16
+ return `avg(last_15m):sum:aws.lambda.duration.maximum{aws_cloudformation_stack-id:${cloudFormationStackId}} by {aws_account,functionname,region}.as_count() / (sum:aws.lambda.timeout{aws_cloudformation_stack-id:${cloudFormationStackId}} by {aws_account,functionname,region}.as_count() * 1000) >= ${criticalThreshold}`;
17
+ },
18
+ message: "At least one invocation in the selected time range timed out. This occurs when your function runs for longer than the configured timeout or the global Lambda timeout. Resolution: [Distributed tracing](https://docs.datadoghq.com/serverless/distributed_tracing) can help you pinpoint slow requests to APIs and other microservices. You can also consider increasing the timeout of your function. Note that this could affect your AWS bill.",
19
+ };
20
+ exports.OUT_OF_MEMORY = {
21
+ name: "Out of Memory on {{functionname.name}} in {{region.name}} for {{aws_account.name}}",
22
+ threshold: 0,
23
+ query: (cloudFormationStackId, criticalThreshold) => {
24
+ return `avg(last_15m):sum:aws.lambda.enhanced.out_of_memory{aws_cloudformation_stack-id:${cloudFormationStackId}} by {aws_account,functionname,region} > ${criticalThreshold}`;
25
+ },
26
+ message: "At least one invocation in the selected time range ran out of memory. Resolution: Lambda functions that use more than their allotted amount of memory can be killed by the Lambda runtime. To users, this may look like failed requests to your application. [Distributed tracing](https://docs.datadoghq.com/serverless/distributed_tracing) can help you pinpoint parts of your application using excessive amounts of memory. Consider increasing the amount of memory your Lambda function is allowed to use.",
27
+ };
28
+ exports.HIGH_ITERATOR_AGE = {
29
+ name: "High Iterator Age on {{functionname.name}} in {{region.name}} for {{aws_account.name}}",
30
+ threshold: 86400,
31
+ query: (cloudFormationStackId, criticalThreshold) => {
32
+ return `avg(last_15m):min:aws.lambda.iterator_age.maximum{aws_cloudformation_stack-id:${cloudFormationStackId}} by {aws_account,region,functionname} >= ${criticalThreshold}`;
33
+ },
34
+ message: "The function’s iterator was older than two hours. Iterator age measures the age of the last record for each batch of records processed from a stream. When this value increases, it means your function cannot process data fast enough. {{#is_alert}} Resolution: Enable [distributed tracing](https://docs.datadoghq.com/serverless/distributed_tracing) to isolate why your function has so much data being streamed to it. You can also consider increasing the shard count and batch size of the stream your function reads from. {{/is_alert}}",
35
+ };
36
+ exports.HIGH_COLD_START_RATE = {
37
+ name: "High Cold Start Rate on {{functionname.name}} in {{region.name}} for {{aws_account.name}}",
38
+ threshold: 0.01,
39
+ query: (cloudFormationStackId, criticalThreshold) => {
40
+ return `avg(last_15m):sum:aws.lambda.enhanced.invocations{cold_start:true AND aws_cloudformation_stack-id:${cloudFormationStackId}} by {aws_account,functionname,region}.as_count() / sum:aws.lambda.enhanced.invocations{aws_cloudformation_stack-id:${cloudFormationStackId}} by {aws_account,functionname,region}.as_count() >= ${criticalThreshold}`;
41
+ },
42
+ message: "More than 1% of the function’s invocations were cold starts in the selected time range. Datadog’s [enhanced metrics](https://docs.datadoghq.com/serverless/enhanced_lambda_metrics) and [distributed tracing](https://docs.datadoghq.com/serverless/distributed_tracing) can help you understand the impact of cold starts on your applications today. {{#is_alert}} Resolution: Cold starts occur when your serverless applications receive sudden increases in traffic, and can occur when the function was previously inactive or when it was receiving a relatively constant number of requests. Users may perceive cold starts as slow response times or lag. To get ahead of cold starts, consider enabling [provisioned concurrency](https://www.datadoghq.com/blog/monitor-aws-lambda-provisioned-concurrency/) on your impacted Lambda functions. Note that this could affect your AWS bill. {{/is_alert}}",
43
+ };
44
+ exports.HIGH_THROTTLES = {
45
+ name: "High Throttles on {{functionname.name}} in {{region.name}} for {{aws_account.name}}",
46
+ threshold: 0.1,
47
+ query: (cloudFormationStackId, criticalThreshold) => {
48
+ return `avg(last_15m):sum:aws.lambda.throttles {aws_cloudformation_stack-id:${cloudFormationStackId}} by {aws_account,region,functionname}.as_count() / ( sum:aws.lambda.throttles {aws_cloudformation_stack-id:${cloudFormationStackId}} by {aws_account,region,functionname}.as_count() + sum:aws.lambda.invocations{aws_cloudformation_stack-id:${cloudFormationStackId}} by {aws_account,region,functionname}.as_count() ) >= ${criticalThreshold}`;
49
+ },
50
+ message: "More than 10% of invocations in the selected time range were throttled. Throttling occurs when your serverless Lambda applications receive high levels of traffic without adequate [concurrency](https://docs.aws.amazon.com/lambda/latest/dg/configuration-concurrency.html). {{#is_alert}} Resolution: Check your [Lambda concurrency metrics](https://docs.datadoghq.com/integrations/amazon_lambda/#metrics) and confirm if `aws.lambda.concurrent_executions.maximum` is approaching your AWS account concurrency level. If so, consider configuring reserved concurrency, or request a service quota increase from AWS. Note that this may affect your AWS bill. {{/is_alert}}",
51
+ };
52
+ exports.INCREASED_COST = {
53
+ name: "Increased Cost on {{functionname.name}} in {{region.name}} for {{aws_account.name}}",
54
+ threshold: 0.2,
55
+ query: (cloudFormationStackId, criticalThreshold) => {
56
+ return `pct_change(avg(last_5m),last_5m):avg:aws.lambda.enhanced.estimated_cost{aws_cloudformation_stack-id:${cloudFormationStackId}} > ${criticalThreshold}`;
57
+ },
58
+ message: "This Lambda function’s estimated cost has increased more than 20%. This could be due to increased traffic to this function, or because it is running longer than expected. [Distributed tracing](https://docs.datadoghq.com/serverless/distributed_tracing) can help pinpoint application bottlenecks.",
59
+ };
60
+ exports.SERVERLESS_MONITORS = {
61
+ high_error_rate: exports.HIGH_ERROR_RATE,
62
+ timeout: exports.TIMEOUT,
63
+ out_of_memory: exports.OUT_OF_MEMORY,
64
+ high_iterator_age: exports.HIGH_ITERATOR_AGE,
65
+ high_cold_start_rate: exports.HIGH_COLD_START_RATE,
66
+ high_throttles: exports.HIGH_THROTTLES,
67
+ increased_cost: exports.INCREASED_COST,
68
+ };
69
+ //# sourceMappingURL=serverless_monitors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serverless_monitors.js","sourceRoot":"","sources":["../../src/serverless_monitors.ts"],"names":[],"mappings":";;;AAQa,QAAA,eAAe,GAAsB;IAChD,IAAI,EAAE,sFAAsF;IAC5F,SAAS,EAAE,GAAG;IACd,KAAK,EAAE,CAAC,qBAA6B,EAAE,iBAAyB,EAAE,EAAE;QAClE,OAAO,mEAAmE,qBAAqB,8GAA8G,qBAAqB,wDAAwD,iBAAiB,EAAE,CAAC;IAChT,CAAC;IACD,OAAO,EACL,gaAAga;CACna,CAAC;AAEW,QAAA,OAAO,GAAsB;IACxC,IAAI,EAAE,8EAA8E;IACpF,SAAS,EAAE,CAAC;IACZ,KAAK,EAAE,CAAC,qBAA6B,EAAE,iBAAyB,EAAE,EAAE;QAClE,OAAO,6EAA6E,qBAAqB,2GAA2G,qBAAqB,gEAAgE,iBAAiB,EAAE,CAAC;IAC/T,CAAC;IACD,OAAO,EACL,obAAob;CACvb,CAAC;AAEW,QAAA,aAAa,GAAsB;IAC9C,IAAI,EAAE,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QAAA,mBAAmB,GAAyC;IACvE,eAAe,EAAE,uBAAe;IAChC,OAAO,EAAE,eAAO;IAChB,aAAa,EAAE,qBAAa;IAC5B,iBAAiB,EAAE,yBAAiB;IACpC,oBAAoB,EAAE,4BAAoB;IAC1C,cAAc,EAAE,sBAAc;IAC9B,cAAc,EAAE,sBAAc;CAC/B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "serverless-plugin-datadog",
3
- "version": "5.66.0",
3
+ "version": "5.67.0",
4
4
  "description": "Serverless plugin to automatically instrument python and node functions with datadog tracing",
5
5
  "main": "dist/src/index.js",
6
6
  "repository": "https://github.com/DataDog/serverless-plugin-datadog",