@datadog/datadog-ci 0.17.12 → 0.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +6 -1
  2. package/dist/commands/git-metadata/__tests__/git.test.js +44 -2
  3. package/dist/commands/git-metadata/__tests__/library.test.d.ts +1 -0
  4. package/dist/commands/git-metadata/__tests__/library.test.js +82 -0
  5. package/dist/commands/git-metadata/git.d.ts +1 -2
  6. package/dist/commands/git-metadata/git.js +13 -25
  7. package/dist/commands/git-metadata/index.d.ts +1 -0
  8. package/dist/commands/git-metadata/index.js +13 -0
  9. package/dist/commands/git-metadata/library.d.ts +6 -0
  10. package/dist/commands/git-metadata/library.js +68 -0
  11. package/dist/commands/git-metadata/upload.d.ts +1 -2
  12. package/dist/commands/git-metadata/upload.js +31 -27
  13. package/dist/commands/junit/upload.js +1 -1
  14. package/dist/commands/lambda/__tests__/fixtures.d.ts +5 -1
  15. package/dist/commands/lambda/__tests__/fixtures.js +13 -2
  16. package/dist/commands/lambda/__tests__/functions/commons.test.js +267 -2
  17. package/dist/commands/lambda/__tests__/functions/instrument.test.js +64 -42
  18. package/dist/commands/lambda/__tests__/functions/uninstrument.test.js +34 -0
  19. package/dist/commands/lambda/__tests__/instrument.test.js +644 -5
  20. package/dist/commands/lambda/__tests__/prompt.test.d.ts +1 -0
  21. package/dist/commands/lambda/__tests__/prompt.test.js +216 -0
  22. package/dist/commands/lambda/__tests__/uninstrument.test.js +310 -4
  23. package/dist/commands/lambda/constants.d.ts +46 -16
  24. package/dist/commands/lambda/constants.js +66 -18
  25. package/dist/commands/lambda/functions/commons.d.ts +20 -3
  26. package/dist/commands/lambda/functions/commons.js +116 -9
  27. package/dist/commands/lambda/functions/instrument.d.ts +1 -1
  28. package/dist/commands/lambda/functions/instrument.js +69 -26
  29. package/dist/commands/lambda/functions/uninstrument.js +23 -7
  30. package/dist/commands/lambda/instrument.d.ts +2 -0
  31. package/dist/commands/lambda/instrument.js +104 -48
  32. package/dist/commands/lambda/interfaces.d.ts +4 -0
  33. package/dist/commands/lambda/prompt.d.ts +9 -0
  34. package/dist/commands/lambda/prompt.js +187 -0
  35. package/dist/commands/lambda/uninstrument.d.ts +1 -0
  36. package/dist/commands/lambda/uninstrument.js +68 -30
  37. package/dist/commands/synthetics/__tests__/cli.test.js +1 -0
  38. package/dist/commands/synthetics/__tests__/fixtures.js +1 -0
  39. package/dist/commands/synthetics/__tests__/run-test.test.js +48 -2
  40. package/dist/commands/synthetics/__tests__/utils.test.js +38 -0
  41. package/dist/commands/synthetics/command.d.ts +1 -0
  42. package/dist/commands/synthetics/command.js +11 -5
  43. package/dist/commands/synthetics/crypto.d.ts +2 -1
  44. package/dist/commands/synthetics/interfaces.d.ts +13 -4
  45. package/dist/commands/synthetics/interfaces.js +7 -3
  46. package/dist/commands/synthetics/reporters/default.js +5 -1
  47. package/dist/commands/synthetics/run-test.d.ts +2 -0
  48. package/dist/commands/synthetics/run-test.js +3 -1
  49. package/dist/commands/synthetics/utils.d.ts +4 -0
  50. package/dist/commands/synthetics/utils.js +44 -16
  51. package/dist/commands/trace/api.js +1 -1
  52. package/dist/helpers/__tests__/ci.test.js +71 -24
  53. package/dist/helpers/__tests__/user-provided-git.test.js +69 -27
  54. package/dist/helpers/ci.js +1 -1
  55. package/dist/helpers/git.js +1 -1
  56. package/dist/helpers/user-provided-git.d.ts +2 -1
  57. package/dist/helpers/user-provided-git.js +18 -3
  58. package/dist/index.d.ts +2 -1
  59. package/dist/index.js +3 -1
  60. package/package.json +1 -1
@@ -1,10 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EXTRA_TAGS_REG_EXP = exports.MAX_LAMBDA_STATE_CHECK_ATTEMPTS = exports.LIST_FUNCTIONS_MAX_RETRY_COUNT = exports.CI_KMS_API_KEY_ENV_VAR = exports.CI_API_KEY_SECRET_ARN_ENV_VAR = exports.CI_API_KEY_ENV_VAR = exports.CI_SITE_ENV_VAR = exports.EXTRA_TAGS_ENV_VAR = exports.ENVIRONMENT_ENV_VAR = exports.VERSION_ENV_VAR = exports.SERVICE_ENV_VAR = exports.LAMBDA_HANDLER_ENV_VAR = exports.LOG_LEVEL_ENV_VAR = exports.FLUSH_TO_LOG_ENV_VAR = exports.MERGE_XRAY_TRACES_ENV_VAR = exports.TRACE_ENABLED_ENV_VAR = exports.SITE_ENV_VAR = exports.KMS_API_KEY_ENV_VAR = exports.API_KEY_SECRET_ARN_ENV_VAR = exports.API_KEY_ENV_VAR = exports.TAG_VERSION_NAME = exports.SUBSCRIPTION_FILTER_NAME = exports.GOVCLOUD_LAYER_AWS_ACCOUNT = exports.DEFAULT_LAYER_AWS_ACCOUNT = exports.SITES = exports.HANDLER_LOCATION = exports.RUNTIME_LOOKUP = exports.RuntimeType = exports.ARM_LAYER_SUFFIX = exports.ARM64_ARCHITECTURE = exports.ARM_RUNTIMES = exports.RUNTIME_LAYER_LOOKUP = exports.EXTENSION_LAYER_KEY = exports.DD_LAMBDA_EXTENSION_LAYER_NAME = void 0;
3
+ exports.EXTRA_TAGS_REG_EXP = exports.MAX_LAMBDA_STATE_CHECK_ATTEMPTS = exports.LIST_FUNCTIONS_MAX_RETRY_COUNT = exports.AWS_SESSION_TOKEN_ENV_VAR = exports.AWS_DEFAULT_REGION_ENV_VAR = exports.AWS_SECRET_ACCESS_KEY_ENV_VAR = exports.AWS_ACCESS_KEY_ID_ENV_VAR = exports.CI_KMS_API_KEY_ENV_VAR = exports.CI_API_KEY_SECRET_ARN_ENV_VAR = exports.CI_API_KEY_ENV_VAR = exports.CI_SITE_ENV_VAR = exports.DOTNET_TRACER_HOME_ENV_VAR = exports.PROFILER_PATH_ENV_VAR = exports.PROFILER_ENV_VAR = exports.ENABLE_PROFILING_ENV_VAR = exports.CAPTURE_LAMBDA_PAYLOAD_ENV_VAR = exports.EXTRA_TAGS_ENV_VAR = exports.ENVIRONMENT_ENV_VAR = exports.VERSION_ENV_VAR = exports.SERVICE_ENV_VAR = exports.LAMBDA_HANDLER_ENV_VAR = exports.LOG_LEVEL_ENV_VAR = exports.FLUSH_TO_LOG_ENV_VAR = exports.MERGE_XRAY_TRACES_ENV_VAR = exports.TRACE_ENABLED_ENV_VAR = exports.SITE_ENV_VAR = exports.KMS_API_KEY_ENV_VAR = exports.API_KEY_SECRET_ARN_ENV_VAR = exports.API_KEY_ENV_VAR = exports.DD_DOTNET_TRACER_HOME = exports.CORECLR_PROFILER_PATH = exports.CORECLR_PROFILER = exports.CORECLR_ENABLE_PROFILING = exports.TAG_VERSION_NAME = exports.SUBSCRIPTION_FILTER_NAME = exports.GOVCLOUD_LAYER_AWS_ACCOUNT = exports.DEFAULT_LAYER_AWS_ACCOUNT = exports.AWS_REGIONS = exports.SITES = exports.NODE_HANDLER_LOCATION = exports.PYTHON_HANDLER_LOCATION = exports.ARM_LAYER_SUFFIX = exports.ARM64_ARCHITECTURE = exports.ARM_LAYERS = exports.RUNTIME_LOOKUP = exports.RuntimeType = exports.LAYER_LOOKUP = exports.DOTNET_RUNTIME = exports.EXTENSION_LAYER_KEY = exports.DD_LAMBDA_EXTENSION_LAYER_NAME = void 0;
4
+ exports.DATADOG_APP_KEY_REG_EXP = exports.DATADOG_API_KEY_REG_EXP = exports.AWS_SECRET_ACCESS_KEY_REG_EXP = exports.AWS_ACCESS_KEY_ID_REG_EXP = void 0;
4
5
  exports.DD_LAMBDA_EXTENSION_LAYER_NAME = 'Datadog-Extension';
5
6
  exports.EXTENSION_LAYER_KEY = 'extension';
6
- exports.RUNTIME_LAYER_LOOKUP = {
7
+ exports.DOTNET_RUNTIME = 'dotnetcore3.1';
8
+ exports.LAYER_LOOKUP = {
7
9
  [exports.EXTENSION_LAYER_KEY]: exports.DD_LAMBDA_EXTENSION_LAYER_NAME,
10
+ 'dotnetcore3.1': 'dd-trace-dotnet',
8
11
  'nodejs12.x': 'Datadog-Node12-x',
9
12
  'nodejs14.x': 'Datadog-Node14-x',
10
13
  'python3.6': 'Datadog-Python36',
@@ -12,43 +15,75 @@ exports.RUNTIME_LAYER_LOOKUP = {
12
15
  'python3.8': 'Datadog-Python38',
13
16
  'python3.9': 'Datadog-Python39',
14
17
  };
15
- exports.ARM_RUNTIMES = [exports.EXTENSION_LAYER_KEY, 'python3.8', 'python3.9'];
16
- exports.ARM64_ARCHITECTURE = 'arm64';
17
- exports.ARM_LAYER_SUFFIX = '-ARM';
18
18
  var RuntimeType;
19
19
  (function (RuntimeType) {
20
- RuntimeType[RuntimeType["NODE"] = 0] = "NODE";
21
- RuntimeType[RuntimeType["PYTHON"] = 1] = "PYTHON";
20
+ RuntimeType[RuntimeType["DOTNET"] = 0] = "DOTNET";
21
+ RuntimeType[RuntimeType["CUSTOM"] = 1] = "CUSTOM";
22
+ RuntimeType[RuntimeType["JAVA"] = 2] = "JAVA";
23
+ RuntimeType[RuntimeType["NODE"] = 3] = "NODE";
24
+ RuntimeType[RuntimeType["PYTHON"] = 4] = "PYTHON";
25
+ RuntimeType[RuntimeType["RUBY"] = 5] = "RUBY";
22
26
  })(RuntimeType = exports.RuntimeType || (exports.RuntimeType = {}));
23
27
  exports.RUNTIME_LOOKUP = {
28
+ 'dotnetcore3.1': RuntimeType.DOTNET,
29
+ java11: RuntimeType.JAVA,
30
+ 'java8.al2': RuntimeType.JAVA,
24
31
  'nodejs12.x': RuntimeType.NODE,
25
32
  'nodejs14.x': RuntimeType.NODE,
33
+ 'provided.al2': RuntimeType.CUSTOM,
26
34
  'python3.6': RuntimeType.PYTHON,
27
35
  'python3.7': RuntimeType.PYTHON,
28
36
  'python3.8': RuntimeType.PYTHON,
29
37
  'python3.9': RuntimeType.PYTHON,
38
+ 'ruby2.5': RuntimeType.RUBY,
39
+ 'ruby2.7': RuntimeType.RUBY,
30
40
  };
31
- const PYTHON_HANDLER_LOCATION = 'datadog_lambda.handler.handler';
32
- const NODE_HANDLER_LOCATION = '/opt/nodejs/node_modules/datadog-lambda-js/handler.handler';
33
- exports.HANDLER_LOCATION = {
34
- 'nodejs12.x': NODE_HANDLER_LOCATION,
35
- 'nodejs14.x': NODE_HANDLER_LOCATION,
36
- 'python3.6': PYTHON_HANDLER_LOCATION,
37
- 'python3.7': PYTHON_HANDLER_LOCATION,
38
- 'python3.8': PYTHON_HANDLER_LOCATION,
39
- 'python3.9': PYTHON_HANDLER_LOCATION,
40
- };
41
+ exports.ARM_LAYERS = [exports.EXTENSION_LAYER_KEY, 'python3.8', 'python3.9'];
42
+ exports.ARM64_ARCHITECTURE = 'arm64';
43
+ exports.ARM_LAYER_SUFFIX = '-ARM';
44
+ exports.PYTHON_HANDLER_LOCATION = 'datadog_lambda.handler.handler';
45
+ exports.NODE_HANDLER_LOCATION = '/opt/nodejs/node_modules/datadog-lambda-js/handler.handler';
41
46
  exports.SITES = [
42
47
  'datadoghq.com',
43
48
  'datadoghq.eu',
44
49
  'us3.datadoghq.com',
45
50
  'us5.datadoghq.com',
46
- 'ddog-gov.,com',
51
+ 'ddog-gov.com',
52
+ ];
53
+ exports.AWS_REGIONS = [
54
+ 'us-east-1',
55
+ 'us-east-2',
56
+ 'us-west-1',
57
+ 'us-west-2',
58
+ 'af-south-1',
59
+ 'ap-east-1',
60
+ 'ap-south-1',
61
+ 'ap-northeast-3',
62
+ 'ap-northeast-2',
63
+ 'ap-southeast-1',
64
+ 'ap-southeast-2',
65
+ 'ap-northeast-1',
66
+ 'ca-central-1',
67
+ 'eu-central-1',
68
+ 'eu-west-1',
69
+ 'eu-west-2',
70
+ 'eu-south-1',
71
+ 'eu-west-3',
72
+ 'eu-north-1',
73
+ 'me-south-1',
74
+ 'sa-east-1',
75
+ 'us-gov-east-1',
76
+ 'us-gov-west-1',
47
77
  ];
48
78
  exports.DEFAULT_LAYER_AWS_ACCOUNT = '464622532012';
49
79
  exports.GOVCLOUD_LAYER_AWS_ACCOUNT = '002406178527';
50
80
  exports.SUBSCRIPTION_FILTER_NAME = 'datadog-ci-filter';
51
81
  exports.TAG_VERSION_NAME = 'dd_sls_ci';
82
+ // Export const values for .NET tracer
83
+ exports.CORECLR_ENABLE_PROFILING = '1';
84
+ exports.CORECLR_PROFILER = '{846F5F1C-F9AE-4B07-969E-05C26BC060D8}';
85
+ exports.CORECLR_PROFILER_PATH = '/opt/datadog/Datadog.Trace.ClrProfiler.Native.so';
86
+ exports.DD_DOTNET_TRACER_HOME = '/opt/datadog';
52
87
  // Environment variables used in the Lambda environment
53
88
  exports.API_KEY_ENV_VAR = 'DD_API_KEY';
54
89
  exports.API_KEY_SECRET_ARN_ENV_VAR = 'DD_API_KEY_SECRET_ARN';
@@ -63,11 +98,20 @@ exports.SERVICE_ENV_VAR = 'DD_SERVICE';
63
98
  exports.VERSION_ENV_VAR = 'DD_VERSION';
64
99
  exports.ENVIRONMENT_ENV_VAR = 'DD_ENV';
65
100
  exports.EXTRA_TAGS_ENV_VAR = 'DD_TAGS';
101
+ exports.CAPTURE_LAMBDA_PAYLOAD_ENV_VAR = 'DD_CAPTURE_LAMBDA_PAYLOAD';
102
+ exports.ENABLE_PROFILING_ENV_VAR = 'CORECLR_ENABLE_PROFILING';
103
+ exports.PROFILER_ENV_VAR = 'CORECLR_PROFILER';
104
+ exports.PROFILER_PATH_ENV_VAR = 'CORECLR_PROFILER_PATH';
105
+ exports.DOTNET_TRACER_HOME_ENV_VAR = 'DD_DOTNET_TRACER_HOME';
66
106
  // Environment variables used by Datadog CI
67
107
  exports.CI_SITE_ENV_VAR = 'DATADOG_SITE';
68
108
  exports.CI_API_KEY_ENV_VAR = 'DATADOG_API_KEY';
69
109
  exports.CI_API_KEY_SECRET_ARN_ENV_VAR = 'DATADOG_API_KEY_SECRET_ARN';
70
110
  exports.CI_KMS_API_KEY_ENV_VAR = 'DATADOG_KMS_API_KEY';
111
+ exports.AWS_ACCESS_KEY_ID_ENV_VAR = 'AWS_ACCESS_KEY_ID';
112
+ exports.AWS_SECRET_ACCESS_KEY_ENV_VAR = 'AWS_SECRET_ACCESS_KEY';
113
+ exports.AWS_DEFAULT_REGION_ENV_VAR = 'AWS_DEFAULT_REGION';
114
+ exports.AWS_SESSION_TOKEN_ENV_VAR = 'AWS_SESSION_TOKEN';
71
115
  exports.LIST_FUNCTIONS_MAX_RETRY_COUNT = 2;
72
116
  exports.MAX_LAMBDA_STATE_CHECK_ATTEMPTS = 3;
73
117
  // DD_TAGS Regular Expression
@@ -75,3 +119,7 @@ exports.MAX_LAMBDA_STATE_CHECK_ATTEMPTS = 3;
75
119
  // matches a list of <key>:<value> separated by commas
76
120
  // such as: layer:api,team:intake
77
121
  exports.EXTRA_TAGS_REG_EXP = /^(([a-zA-Z]+)\w+:[\w\-/\.]+)+((\,)([a-zA-Z]+)\w+:[\w\-/\.]+)*$/g;
122
+ exports.AWS_ACCESS_KEY_ID_REG_EXP = /(?<![A-Z0-9])[A-Z0-9]{20}(?![A-Z0-9])/g;
123
+ exports.AWS_SECRET_ACCESS_KEY_REG_EXP = /(?<![A-Za-z0-9/+=])[A-Za-z0-9/+=]{40}(?![A-Za-z0-9/+=])/g;
124
+ exports.DATADOG_API_KEY_REG_EXP = /(?<![a-f0-9])[a-f0-9]{32}(?![a-f0-9])/g;
125
+ exports.DATADOG_APP_KEY_REG_EXP = /(?<![a-f0-9])[a-f0-9]{40}(?![a-f0-9])/g;
@@ -1,5 +1,5 @@
1
1
  import { CloudWatchLogs, Lambda } from 'aws-sdk';
2
- import { Runtime } from '../constants';
2
+ import { LayerKey } from '../constants';
3
3
  import { FunctionConfiguration, InstrumentationSettings } from '../interfaces';
4
4
  /**
5
5
  * Returns an array of merged layer ARNs if given a Full Layer ARN,
@@ -32,6 +32,20 @@ export declare const coerceBoolean: (fallback: boolean, ...values: any[]) => boo
32
32
  export declare const collectFunctionsByRegion: (functions: string[], defaultRegion: string | undefined) => {
33
33
  [key: string]: string[];
34
34
  };
35
+ /**
36
+ * Given a layer runtime, return its latest version.
37
+ *
38
+ * @param runtime the runtime of the layer.
39
+ * @param region the region where the layer is stored.
40
+ * @returns the latest version of the layer to find.
41
+ */
42
+ export declare const findLatestLayerVersion: (layer: LayerKey, region: string) => Promise<number>;
43
+ export declare const isMissingAWSCredentials: () => boolean;
44
+ export declare const isMissingDatadogSiteEnvVar: () => boolean;
45
+ export declare const isMissingAnyDatadogApiKeyEnvVar: () => boolean;
46
+ export declare const isMissingDatadogEnvVars: () => boolean;
47
+ export declare const getAllLambdaFunctionConfigs: (lambda: Lambda) => Promise<Lambda.FunctionConfiguration[]>;
48
+ export declare const checkRuntimeTypesAreUniform: (configList: FunctionConfiguration[]) => boolean;
35
49
  /**
36
50
  * Given a Lambda instance and a regular expression,
37
51
  * returns all the Function Configurations that match.
@@ -60,7 +74,8 @@ export declare const getLambdaFunctionConfigs: (lambda: Lambda, functionARNs: st
60
74
  * @param settings instrumentation settings, mainly used to change the AWS account that contains the Layer.
61
75
  * @returns the ARN of a **Specific Runtime Layer** with the correct region, account, architecture, and name.
62
76
  */
63
- export declare const getLayerArn: (config: Lambda.FunctionConfiguration, runtime: Runtime, region: string, settings?: InstrumentationSettings | undefined) => string;
77
+ export declare const getLayerArn: (config: Lambda.FunctionConfiguration, layer: LayerKey, region: string, settings?: InstrumentationSettings | undefined) => string;
78
+ export declare const getLayerNameWithVersion: (layerArn: string) => string | undefined;
64
79
  export declare const getLayers: (config: Lambda.FunctionConfiguration) => string[];
65
80
  /**
66
81
  * Call the aws-sdk Lambda api to get a Function given
@@ -96,6 +111,8 @@ export declare const isLambdaActive: (lambda: Lambda, config: Lambda.FunctionCon
96
111
  * @param runtime a string representing a Lambda FunctionConfiguration Runtime.
97
112
  * @returns if a runtime is supported.
98
113
  */
99
- export declare const isSupportedRuntime: (runtime?: string | undefined) => runtime is Runtime;
114
+ export declare const isSupportedRuntime: (runtime?: string | undefined) => runtime is "nodejs12.x" | "nodejs14.x" | "java8.al2" | "java11" | "python3.6" | "python3.7" | "python3.8" | "python3.9" | "dotnetcore3.1" | "ruby2.5" | "ruby2.7" | "provided.al2";
115
+ export declare const isLayerRuntime: (runtime: string) => runtime is "nodejs12.x" | "nodejs14.x" | "python3.6" | "python3.7" | "python3.8" | "python3.9" | "dotnetcore3.1" | "extension";
100
116
  export declare const sentenceMatchesRegEx: (sentence: string, regex: RegExp) => RegExpMatchArray | null;
101
117
  export declare const updateLambdaFunctionConfigs: (lambda: Lambda, cloudWatch: CloudWatchLogs, configs: FunctionConfiguration[]) => Promise<void>;
118
+ export declare const willUpdateFunctionConfigs: (configs: FunctionConfiguration[]) => boolean;
@@ -9,7 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.updateLambdaFunctionConfigs = exports.sentenceMatchesRegEx = exports.isSupportedRuntime = exports.isLambdaActive = exports.getRegion = exports.getLambdaFunctionConfig = exports.getLayers = exports.getLayerArn = exports.getLambdaFunctionConfigs = exports.getLambdaFunctionConfigsFromRegex = exports.collectFunctionsByRegion = exports.coerceBoolean = exports.addLayerArn = void 0;
12
+ exports.willUpdateFunctionConfigs = exports.updateLambdaFunctionConfigs = exports.sentenceMatchesRegEx = exports.isLayerRuntime = exports.isSupportedRuntime = exports.isLambdaActive = exports.getRegion = exports.getLambdaFunctionConfig = exports.getLayers = exports.getLayerNameWithVersion = exports.getLayerArn = exports.getLambdaFunctionConfigs = exports.getLambdaFunctionConfigsFromRegex = exports.checkRuntimeTypesAreUniform = exports.getAllLambdaFunctionConfigs = exports.isMissingDatadogEnvVars = exports.isMissingAnyDatadogApiKeyEnvVar = exports.isMissingDatadogSiteEnvVar = exports.isMissingAWSCredentials = exports.findLatestLayerVersion = exports.collectFunctionsByRegion = exports.coerceBoolean = exports.addLayerArn = void 0;
13
+ const aws_sdk_1 = require("aws-sdk");
13
14
  const constants_1 = require("../constants");
14
15
  const loggroup_1 = require("../loggroup");
15
16
  const tags_1 = require("../tags");
@@ -91,6 +92,92 @@ const collectFunctionsByRegion = (functions, defaultRegion) => {
91
92
  return groups;
92
93
  };
93
94
  exports.collectFunctionsByRegion = collectFunctionsByRegion;
95
+ /**
96
+ * Given a layer runtime, return its latest version.
97
+ *
98
+ * @param runtime the runtime of the layer.
99
+ * @param region the region where the layer is stored.
100
+ * @returns the latest version of the layer to find.
101
+ */
102
+ const findLatestLayerVersion = (layer, region) => __awaiter(void 0, void 0, void 0, function* () {
103
+ let latestVersion = 0;
104
+ let searchStep = latestVersion > 0 ? 1 : 100;
105
+ let layerVersion = latestVersion + searchStep;
106
+ const account = region.startsWith('us-gov') ? constants_1.GOVCLOUD_LAYER_AWS_ACCOUNT : constants_1.DEFAULT_LAYER_AWS_ACCOUNT;
107
+ const layerName = constants_1.LAYER_LOOKUP[layer];
108
+ let foundLatestVersion = false;
109
+ const lambda = new aws_sdk_1.Lambda({ region });
110
+ while (!foundLatestVersion) {
111
+ try {
112
+ // Search next version
113
+ yield lambda
114
+ .getLayerVersion({
115
+ LayerName: `arn:aws:lambda:${region}:${account}:layer:${layerName}`,
116
+ VersionNumber: layerVersion,
117
+ })
118
+ .promise();
119
+ latestVersion = layerVersion;
120
+ // Increase layer version
121
+ layerVersion += searchStep;
122
+ }
123
+ catch (e) {
124
+ // Search step is too big, reset target to previous version
125
+ // with a smaller search step
126
+ if (searchStep > 1) {
127
+ layerVersion -= searchStep;
128
+ searchStep /= 10;
129
+ layerVersion += searchStep;
130
+ }
131
+ else {
132
+ // Search step is 1, current version was not found.
133
+ // It is likely that the last checked is the latest.
134
+ // Check the next version to be certain, since
135
+ // current version could've been deleted by accident.
136
+ try {
137
+ layerVersion += searchStep;
138
+ yield lambda
139
+ .getLayerVersion({
140
+ LayerName: `arn:aws:lambda:${region}:${account}:layer:${layerName}`,
141
+ VersionNumber: layerVersion,
142
+ })
143
+ .promise();
144
+ latestVersion = layerVersion;
145
+ // Continue the search if the next version does exist (unlikely event)
146
+ layerVersion += searchStep;
147
+ }
148
+ catch (e) {
149
+ // The next version doesn't exist either, so the previous version is indeed the latest
150
+ foundLatestVersion = true;
151
+ }
152
+ }
153
+ }
154
+ }
155
+ return latestVersion;
156
+ });
157
+ exports.findLatestLayerVersion = findLatestLayerVersion;
158
+ const isMissingAWSCredentials = () => process.env[constants_1.AWS_ACCESS_KEY_ID_ENV_VAR] === undefined || process.env[constants_1.AWS_SECRET_ACCESS_KEY_ENV_VAR] === undefined;
159
+ exports.isMissingAWSCredentials = isMissingAWSCredentials;
160
+ const isMissingDatadogSiteEnvVar = () => {
161
+ const site = process.env[constants_1.CI_SITE_ENV_VAR];
162
+ if (site !== undefined) {
163
+ return !constants_1.SITES.includes(site);
164
+ }
165
+ return true;
166
+ };
167
+ exports.isMissingDatadogSiteEnvVar = isMissingDatadogSiteEnvVar;
168
+ const isMissingAnyDatadogApiKeyEnvVar = () => !(process.env[constants_1.CI_API_KEY_ENV_VAR] ||
169
+ process.env[constants_1.CI_KMS_API_KEY_ENV_VAR] ||
170
+ process.env[constants_1.CI_API_KEY_SECRET_ARN_ENV_VAR]);
171
+ exports.isMissingAnyDatadogApiKeyEnvVar = isMissingAnyDatadogApiKeyEnvVar;
172
+ const isMissingDatadogEnvVars = () => exports.isMissingDatadogSiteEnvVar() || exports.isMissingAnyDatadogApiKeyEnvVar();
173
+ exports.isMissingDatadogEnvVars = isMissingDatadogEnvVars;
174
+ const getAllLambdaFunctionConfigs = (lambda) => __awaiter(void 0, void 0, void 0, function* () { return exports.getLambdaFunctionConfigsFromRegex(lambda, '.'); });
175
+ exports.getAllLambdaFunctionConfigs = getAllLambdaFunctionConfigs;
176
+ // Returns false if not all runtimes are of the same RuntimeType across multiple functions
177
+ const checkRuntimeTypesAreUniform = (configList) => configList
178
+ .map((item) => item.lambdaConfig.Runtime)
179
+ .every((runtime) => constants_1.RUNTIME_LOOKUP[runtime] === constants_1.RUNTIME_LOOKUP[configList[0].lambdaConfig.Runtime]);
180
+ exports.checkRuntimeTypesAreUniform = checkRuntimeTypesAreUniform;
94
181
  /**
95
182
  * Given a Lambda instance and a regular expression,
96
183
  * returns all the Function Configurations that match.
@@ -149,10 +236,10 @@ exports.getLambdaFunctionConfigs = getLambdaFunctionConfigs;
149
236
  * @param settings instrumentation settings, mainly used to change the AWS account that contains the Layer.
150
237
  * @returns the ARN of a **Specific Runtime Layer** with the correct region, account, architecture, and name.
151
238
  */
152
- const getLayerArn = (config, runtime, region, settings) => {
239
+ const getLayerArn = (config, layer, region, settings) => {
153
240
  var _a, _b;
154
- let layerName = constants_1.RUNTIME_LAYER_LOOKUP[runtime];
155
- if (constants_1.ARM_RUNTIMES.includes(runtime) && ((_a = config.Architectures) === null || _a === void 0 ? void 0 : _a.includes(constants_1.ARM64_ARCHITECTURE))) {
241
+ let layerName = constants_1.LAYER_LOOKUP[layer];
242
+ if (constants_1.ARM_LAYERS.includes(layer) && ((_a = config.Architectures) === null || _a === void 0 ? void 0 : _a.includes(constants_1.ARM64_ARCHITECTURE))) {
156
243
  layerName += constants_1.ARM_LAYER_SUFFIX;
157
244
  }
158
245
  const account = (_b = settings === null || settings === void 0 ? void 0 : settings.layerAWSAccount) !== null && _b !== void 0 ? _b : constants_1.DEFAULT_LAYER_AWS_ACCOUNT;
@@ -163,7 +250,12 @@ const getLayerArn = (config, runtime, region, settings) => {
163
250
  return `arn:aws:lambda:${region}:${account}:layer:${layerName}`;
164
251
  };
165
252
  exports.getLayerArn = getLayerArn;
166
- const getLayers = (config) => { var _a; return ((_a = config.Layers) !== null && _a !== void 0 ? _a : []).map((layer) => { var _a; return (_a = layer.Arn) !== null && _a !== void 0 ? _a : ''; }); };
253
+ const getLayerNameWithVersion = (layerArn) => {
254
+ const [, , , , , , name, version] = layerArn.split(':');
255
+ return name && version ? `${name}:${version}` : undefined;
256
+ };
257
+ exports.getLayerNameWithVersion = getLayerNameWithVersion;
258
+ const getLayers = (config) => { var _a; return ((_a = config.Layers) !== null && _a !== void 0 ? _a : []).map((layer) => layer.Arn); };
167
259
  exports.getLayers = getLayers;
168
260
  /**
169
261
  * Call the aws-sdk Lambda api to get a Function given
@@ -228,11 +320,10 @@ exports.isLambdaActive = isLambdaActive;
228
320
  * @param runtime a string representing a Lambda FunctionConfiguration Runtime.
229
321
  * @returns if a runtime is supported.
230
322
  */
231
- const isSupportedRuntime = (runtime) => {
232
- const lookup = constants_1.RUNTIME_LAYER_LOOKUP;
233
- return runtime !== undefined && lookup[runtime] !== undefined;
234
- };
323
+ const isSupportedRuntime = (runtime) => runtime !== undefined && constants_1.RUNTIME_LOOKUP[runtime] !== undefined;
235
324
  exports.isSupportedRuntime = isSupportedRuntime;
325
+ const isLayerRuntime = (runtime) => constants_1.LAYER_LOOKUP[runtime] !== undefined;
326
+ exports.isLayerRuntime = isLayerRuntime;
236
327
  const sentenceMatchesRegEx = (sentence, regex) => sentence.match(regex);
237
328
  exports.sentenceMatchesRegEx = sentenceMatchesRegEx;
238
329
  const updateLambdaFunctionConfigs = (lambda, cloudWatch, configs) => __awaiter(void 0, void 0, void 0, function* () {
@@ -250,6 +341,22 @@ const updateLambdaFunctionConfigs = (lambda, cloudWatch, configs) => __awaiter(v
250
341
  yield Promise.all(results);
251
342
  });
252
343
  exports.updateLambdaFunctionConfigs = updateLambdaFunctionConfigs;
344
+ const willUpdateFunctionConfigs = (configs) => {
345
+ var _a, _b, _c;
346
+ let willUpdate = false;
347
+ for (const config of configs) {
348
+ if (config.updateRequest !== undefined ||
349
+ ((_a = config.logGroupConfiguration) === null || _a === void 0 ? void 0 : _a.createLogGroupRequest) !== undefined ||
350
+ ((_b = config.logGroupConfiguration) === null || _b === void 0 ? void 0 : _b.deleteSubscriptionFilterRequest) !== undefined ||
351
+ ((_c = config.logGroupConfiguration) === null || _c === void 0 ? void 0 : _c.subscriptionFilterRequest) !== undefined ||
352
+ (config === null || config === void 0 ? void 0 : config.tagConfiguration) !== undefined) {
353
+ willUpdate = true;
354
+ break;
355
+ }
356
+ }
357
+ return willUpdate;
358
+ };
359
+ exports.willUpdateFunctionConfigs = willUpdateFunctionConfigs;
253
360
  /**
254
361
  * Waits for n ms
255
362
  *
@@ -4,4 +4,4 @@ import { FunctionConfiguration, InstrumentationSettings } from '../interfaces';
4
4
  export declare const getInstrumentedFunctionConfigs: (lambda: Lambda, cloudWatch: CloudWatchLogs, region: string, functionARNs: string[], settings: InstrumentationSettings) => Promise<FunctionConfiguration[]>;
5
5
  export declare const getInstrumentedFunctionConfig: (lambda: Lambda, cloudWatch: CloudWatchLogs, config: Lambda.FunctionConfiguration, region: string, settings: InstrumentationSettings) => Promise<FunctionConfiguration>;
6
6
  export declare const getInstrumentedFunctionConfigsFromRegEx: (lambda: Lambda, cloudWatch: CloudWatchLogs, region: string, pattern: string, settings: InstrumentationSettings) => Promise<FunctionConfiguration[]>;
7
- export declare const calculateUpdateRequest: (config: Lambda.FunctionConfiguration, settings: InstrumentationSettings, region: string, runtime: Runtime) => Lambda.UpdateFunctionConfigurationRequest | undefined;
7
+ export declare const calculateUpdateRequest: (config: Lambda.FunctionConfiguration, settings: InstrumentationSettings, region: string, runtime: Runtime) => Promise<Lambda.UpdateFunctionConfigurationRequest | undefined>;
@@ -31,7 +31,7 @@ const getInstrumentedFunctionConfig = (lambda, cloudWatch, config, region, setti
31
31
  throw Error(`Can't instrument ${functionARN}, runtime ${runtime} not supported`);
32
32
  }
33
33
  yield commons_1.isLambdaActive(lambda, config, functionARN);
34
- const updateRequest = exports.calculateUpdateRequest(config, settings, region, runtime);
34
+ const updateRequest = yield exports.calculateUpdateRequest(config, settings, region, runtime);
35
35
  let logGroupConfiguration;
36
36
  if (settings.forwarderARN !== undefined) {
37
37
  const logGroupName = `/aws/lambda/${config.FunctionName}`;
@@ -57,8 +57,8 @@ const getInstrumentedFunctionConfigsFromRegEx = (lambda, cloudWatch, region, pat
57
57
  return functionsToUpdate;
58
58
  });
59
59
  exports.getInstrumentedFunctionConfigsFromRegEx = getInstrumentedFunctionConfigsFromRegEx;
60
- const calculateUpdateRequest = (config, settings, region, runtime) => {
61
- var _a, _b, _c, _d;
60
+ const calculateUpdateRequest = (config, settings, region, runtime) => __awaiter(void 0, void 0, void 0, function* () {
61
+ var _a, _b, _c, _d, _e;
62
62
  const oldEnvVars = Object.assign({}, (_a = config.Environment) === null || _a === void 0 ? void 0 : _a.Variables);
63
63
  const changedEnvVars = {};
64
64
  const functionARN = config.FunctionArn;
@@ -73,16 +73,41 @@ const calculateUpdateRequest = (config, settings, region, runtime) => {
73
73
  FunctionName: functionARN,
74
74
  };
75
75
  let needsUpdate = false;
76
- // Update Handler
77
- const expectedHandler = constants_1.HANDLER_LOCATION[runtime];
78
- if (config.Handler !== expectedHandler) {
79
- needsUpdate = true;
80
- updateRequest.Handler = constants_1.HANDLER_LOCATION[runtime];
76
+ if (constants_1.RUNTIME_LOOKUP[runtime] === constants_1.RuntimeType.JAVA ||
77
+ constants_1.RUNTIME_LOOKUP[runtime] === constants_1.RuntimeType.CUSTOM ||
78
+ constants_1.RUNTIME_LOOKUP[runtime] === constants_1.RuntimeType.RUBY) {
79
+ if (settings.layerVersion !== undefined) {
80
+ throw new Error(`Only the --extension-version argument should be set for the ${runtime} runtime. Please remove the --layer-version argument from the instrument command.`);
81
+ }
82
+ }
83
+ // We don't support ARM Architecture for .NET at this time. Abort instrumentation if the combination is detected.
84
+ if (constants_1.RUNTIME_LOOKUP[runtime] === constants_1.RuntimeType.DOTNET) {
85
+ if ((_b = config.Architectures) === null || _b === void 0 ? void 0 : _b.includes(constants_1.ARM64_ARCHITECTURE)) {
86
+ throw new Error('Instrumenting arm64 architecture is not currently supported for .NET. Please only instrument .NET functions using x86_64 architecture.');
87
+ }
88
+ }
89
+ // Update Python Handler
90
+ if (constants_1.RUNTIME_LOOKUP[runtime] === constants_1.RuntimeType.PYTHON) {
91
+ const expectedHandler = constants_1.PYTHON_HANDLER_LOCATION;
92
+ if (config.Handler !== expectedHandler) {
93
+ needsUpdate = true;
94
+ updateRequest.Handler = constants_1.PYTHON_HANDLER_LOCATION;
95
+ }
96
+ }
97
+ // Update Node Handler
98
+ if (constants_1.RUNTIME_LOOKUP[runtime] === constants_1.RuntimeType.NODE) {
99
+ const expectedHandler = constants_1.NODE_HANDLER_LOCATION;
100
+ if (config.Handler !== expectedHandler) {
101
+ needsUpdate = true;
102
+ updateRequest.Handler = constants_1.NODE_HANDLER_LOCATION;
103
+ }
81
104
  }
82
105
  // Update Env Vars
83
- if (oldEnvVars[constants_1.LAMBDA_HANDLER_ENV_VAR] === undefined) {
84
- needsUpdate = true;
85
- changedEnvVars[constants_1.LAMBDA_HANDLER_ENV_VAR] = (_b = config.Handler) !== null && _b !== void 0 ? _b : '';
106
+ if (constants_1.RUNTIME_LOOKUP[runtime] === constants_1.RuntimeType.PYTHON || constants_1.RUNTIME_LOOKUP[runtime] === constants_1.RuntimeType.NODE) {
107
+ if (oldEnvVars[constants_1.LAMBDA_HANDLER_ENV_VAR] === undefined) {
108
+ needsUpdate = true;
109
+ changedEnvVars[constants_1.LAMBDA_HANDLER_ENV_VAR] = (_c = config.Handler) !== null && _c !== void 0 ? _c : '';
110
+ }
86
111
  }
87
112
  // KMS > Secrets Manager > API Key
88
113
  if (apiKmsKey !== undefined && oldEnvVars[constants_1.KMS_API_KEY_ENV_VAR] !== apiKmsKey) {
@@ -116,6 +141,7 @@ const calculateUpdateRequest = (config, settings, region, runtime) => {
116
141
  changedEnvVars[constants_1.SITE_ENV_VAR] = 'datadoghq.com';
117
142
  }
118
143
  const environmentVarsTupleArray = [
144
+ ['captureLambdaPayload', constants_1.CAPTURE_LAMBDA_PAYLOAD_ENV_VAR],
119
145
  ['environment', constants_1.ENVIRONMENT_ENV_VAR],
120
146
  ['extraTags', constants_1.EXTRA_TAGS_ENV_VAR],
121
147
  ['mergeXrayTraces', constants_1.MERGE_XRAY_TRACES_ENV_VAR],
@@ -124,15 +150,16 @@ const calculateUpdateRequest = (config, settings, region, runtime) => {
124
150
  ['version', constants_1.VERSION_ENV_VAR],
125
151
  ];
126
152
  for (const [key, environmentVar] of environmentVarsTupleArray) {
127
- if (settings[key] !== undefined && oldEnvVars[environmentVar] !== ((_c = settings[key]) === null || _c === void 0 ? void 0 : _c.toString())) {
153
+ if (settings[key] !== undefined && oldEnvVars[environmentVar] !== ((_d = settings[key]) === null || _d === void 0 ? void 0 : _d.toString())) {
128
154
  needsUpdate = true;
129
155
  changedEnvVars[environmentVar] = settings[key].toString();
130
156
  }
131
157
  }
158
+ // Skip adding DD_FLUSH_TO_LOGS when using Extension
132
159
  const isUsingExtension = settings.extensionVersion !== undefined;
133
160
  if (!isUsingExtension &&
134
161
  settings.flushMetricsToLogs !== undefined &&
135
- oldEnvVars[constants_1.FLUSH_TO_LOG_ENV_VAR] !== ((_d = settings.flushMetricsToLogs) === null || _d === void 0 ? void 0 : _d.toString())) {
162
+ oldEnvVars[constants_1.FLUSH_TO_LOG_ENV_VAR] !== ((_e = settings.flushMetricsToLogs) === null || _e === void 0 ? void 0 : _e.toString())) {
136
163
  needsUpdate = true;
137
164
  changedEnvVars[constants_1.FLUSH_TO_LOG_ENV_VAR] = settings.flushMetricsToLogs.toString();
138
165
  }
@@ -146,25 +173,41 @@ const calculateUpdateRequest = (config, settings, region, runtime) => {
146
173
  delete newEnvVars[constants_1.LOG_LEVEL_ENV_VAR];
147
174
  }
148
175
  }
176
+ if (runtime === constants_1.DOTNET_RUNTIME) {
177
+ needsUpdate = true;
178
+ newEnvVars[constants_1.ENABLE_PROFILING_ENV_VAR] = constants_1.CORECLR_ENABLE_PROFILING;
179
+ newEnvVars[constants_1.PROFILER_ENV_VAR] = constants_1.CORECLR_PROFILER;
180
+ newEnvVars[constants_1.PROFILER_PATH_ENV_VAR] = constants_1.CORECLR_PROFILER_PATH;
181
+ newEnvVars[constants_1.DOTNET_TRACER_HOME_ENV_VAR] = constants_1.DD_DOTNET_TRACER_HOME;
182
+ }
149
183
  updateRequest.Environment = {
150
184
  Variables: newEnvVars,
151
185
  };
152
- // Update Layers
153
- const lambdaLibraryLayerArn = commons_1.getLayerArn(config, config.Runtime, region, settings);
154
- const lambraLibraryLayerName = constants_1.RUNTIME_LAYER_LOOKUP[runtime];
155
- let fullLambdaLibraryLayerARN;
156
- if (settings.layerVersion !== undefined) {
157
- fullLambdaLibraryLayerARN = `${lambdaLibraryLayerArn}:${settings.layerVersion}`;
186
+ let layerARNs = commons_1.getLayers(config);
187
+ const originalLayerARNs = layerARNs;
188
+ let needsLayerUpdate = false;
189
+ if (commons_1.isLayerRuntime(runtime)) {
190
+ const lambdaLibraryLayerArn = commons_1.getLayerArn(config, config.Runtime, region, settings);
191
+ const lambdaLibraryLayerName = constants_1.LAYER_LOOKUP[runtime];
192
+ let fullLambdaLibraryLayerARN;
193
+ if (settings.layerVersion !== undefined || settings.interactive) {
194
+ let layerVersion = settings.layerVersion;
195
+ if (settings.interactive && !settings.layerVersion) {
196
+ layerVersion = yield commons_1.findLatestLayerVersion(config.Runtime, region);
197
+ }
198
+ fullLambdaLibraryLayerARN = `${lambdaLibraryLayerArn}:${layerVersion}`;
199
+ }
200
+ layerARNs = commons_1.addLayerArn(fullLambdaLibraryLayerARN, lambdaLibraryLayerName, layerARNs);
158
201
  }
159
202
  const lambdaExtensionLayerArn = commons_1.getLayerArn(config, constants_1.EXTENSION_LAYER_KEY, region, settings);
160
203
  let fullExtensionLayerARN;
161
- if (settings.extensionVersion !== undefined) {
162
- fullExtensionLayerARN = `${lambdaExtensionLayerArn}:${settings.extensionVersion}`;
204
+ if (settings.extensionVersion !== undefined || settings.interactive) {
205
+ let extensionVersion = settings.extensionVersion;
206
+ if (settings.interactive && !settings.extensionVersion) {
207
+ extensionVersion = yield commons_1.findLatestLayerVersion(constants_1.EXTENSION_LAYER_KEY, region);
208
+ }
209
+ fullExtensionLayerARN = `${lambdaExtensionLayerArn}:${extensionVersion}`;
163
210
  }
164
- let layerARNs = commons_1.getLayers(config);
165
- const originalLayerARNs = layerARNs;
166
- let needsLayerUpdate = false;
167
- layerARNs = commons_1.addLayerArn(fullLambdaLibraryLayerARN, lambraLibraryLayerName, layerARNs);
168
211
  layerARNs = commons_1.addLayerArn(fullExtensionLayerARN, constants_1.DD_LAMBDA_EXTENSION_LAYER_NAME, layerARNs);
169
212
  if (originalLayerARNs.sort().join(',') !== layerARNs.sort().join(',')) {
170
213
  needsLayerUpdate = true;
@@ -182,5 +225,5 @@ const calculateUpdateRequest = (config, settings, region, runtime) => {
182
225
  }
183
226
  });
184
227
  return needsUpdate ? updateRequest : undefined;
185
- };
228
+ });
186
229
  exports.calculateUpdateRequest = calculateUpdateRequest;
@@ -67,12 +67,23 @@ const calculateUpdateRequest = (config, runtime) => {
67
67
  FunctionName: functionARN,
68
68
  };
69
69
  let needsUpdate = false;
70
- // Remove Handler
71
- const expectedHandler = constants_1.HANDLER_LOCATION[runtime];
72
- if (config.Handler === expectedHandler) {
73
- needsUpdate = true;
74
- updateRequest.Handler = oldEnvVars[constants_1.LAMBDA_HANDLER_ENV_VAR];
75
- delete oldEnvVars[constants_1.LAMBDA_HANDLER_ENV_VAR];
70
+ // Remove Handler for Python
71
+ if (constants_1.RUNTIME_LOOKUP[runtime] === constants_1.RuntimeType.PYTHON) {
72
+ const expectedHandler = constants_1.PYTHON_HANDLER_LOCATION;
73
+ if (config.Handler === expectedHandler) {
74
+ needsUpdate = true;
75
+ updateRequest.Handler = oldEnvVars[constants_1.LAMBDA_HANDLER_ENV_VAR];
76
+ delete oldEnvVars[constants_1.LAMBDA_HANDLER_ENV_VAR];
77
+ }
78
+ }
79
+ // Remove Handler for Node
80
+ if (constants_1.RUNTIME_LOOKUP[runtime] === constants_1.RuntimeType.NODE) {
81
+ const expectedHandler = constants_1.NODE_HANDLER_LOCATION;
82
+ if (config.Handler === expectedHandler) {
83
+ needsUpdate = true;
84
+ updateRequest.Handler = oldEnvVars[constants_1.LAMBDA_HANDLER_ENV_VAR];
85
+ delete oldEnvVars[constants_1.LAMBDA_HANDLER_ENV_VAR];
86
+ }
76
87
  }
77
88
  /**
78
89
  * Array used to remove environment vars used in
@@ -83,6 +94,7 @@ const calculateUpdateRequest = (config, runtime) => {
83
94
  constants_1.API_KEY_SECRET_ARN_ENV_VAR,
84
95
  constants_1.KMS_API_KEY_ENV_VAR,
85
96
  constants_1.SITE_ENV_VAR,
97
+ constants_1.CAPTURE_LAMBDA_PAYLOAD_ENV_VAR,
86
98
  constants_1.ENVIRONMENT_ENV_VAR,
87
99
  constants_1.EXTRA_TAGS_ENV_VAR,
88
100
  constants_1.FLUSH_TO_LOG_ENV_VAR,
@@ -91,6 +103,10 @@ const calculateUpdateRequest = (config, runtime) => {
91
103
  constants_1.SERVICE_ENV_VAR,
92
104
  constants_1.TRACE_ENABLED_ENV_VAR,
93
105
  constants_1.VERSION_ENV_VAR,
106
+ constants_1.ENABLE_PROFILING_ENV_VAR,
107
+ constants_1.PROFILER_ENV_VAR,
108
+ constants_1.PROFILER_PATH_ENV_VAR,
109
+ constants_1.DOTNET_TRACER_HOME_ENV_VAR,
94
110
  ];
95
111
  // Remove Environment Variables
96
112
  for (const environmentVar of environmentVarsArray) {
@@ -104,7 +120,7 @@ const calculateUpdateRequest = (config, runtime) => {
104
120
  };
105
121
  // Remove Layers
106
122
  let needsLayerRemoval = false;
107
- const lambdaLibraryLayerName = constants_1.RUNTIME_LAYER_LOOKUP[runtime];
123
+ const lambdaLibraryLayerName = constants_1.LAYER_LOOKUP[runtime];
108
124
  const originalLayerARNs = commons_1.getLayers(config);
109
125
  const layerARNs = ((_b = config.Layers) !== null && _b !== void 0 ? _b : [])
110
126
  .filter((layer) => { var _a, _b; return !((_a = layer.Arn) === null || _a === void 0 ? void 0 : _a.includes(lambdaLibraryLayerName)) && !((_b = layer.Arn) === null || _b === void 0 ? void 0 : _b.includes(constants_1.DD_LAMBDA_EXTENSION_LAYER_NAME)); })
@@ -1,5 +1,6 @@
1
1
  import { Command } from 'clipanion';
2
2
  export declare class InstrumentCommand extends Command {
3
+ private captureLambdaPayload?;
3
4
  private config;
4
5
  private configPath?;
5
6
  private dryRun;
@@ -9,6 +10,7 @@ export declare class InstrumentCommand extends Command {
9
10
  private flushMetricsToLogs?;
10
11
  private forwarder?;
11
12
  private functions;
13
+ private interactive;
12
14
  private layerAWSAccount?;
13
15
  private layerVersion?;
14
16
  private logLevel?;