datadog-cdk-constructs-v2 4.0.0__tar.gz → 4.2.0__tar.gz

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 (20) hide show
  1. {datadog_cdk_constructs_v2-4.0.0 → datadog_cdk_constructs_v2-4.2.0}/NOTICE +1 -1
  2. {datadog_cdk_constructs_v2-4.0.0/src/datadog_cdk_constructs_v2.egg-info → datadog_cdk_constructs_v2-4.2.0}/PKG-INFO +42 -46
  3. {datadog_cdk_constructs_v2-4.0.0 → datadog_cdk_constructs_v2-4.2.0}/README.md +35 -40
  4. {datadog_cdk_constructs_v2-4.0.0 → datadog_cdk_constructs_v2-4.2.0}/pyproject.toml +2 -2
  5. {datadog_cdk_constructs_v2-4.0.0 → datadog_cdk_constructs_v2-4.2.0}/setup.py +9 -8
  6. {datadog_cdk_constructs_v2-4.0.0 → datadog_cdk_constructs_v2-4.2.0}/src/datadog_cdk_constructs_v2/__init__.py +106 -63
  7. datadog_cdk_constructs_v2-4.2.0/src/datadog_cdk_constructs_v2/_jsii/__init__.py +31 -0
  8. datadog_cdk_constructs_v2-4.2.0/src/datadog_cdk_constructs_v2/_jsii/datadog-cdk-constructs-v2@4.2.0.jsii.tgz +0 -0
  9. {datadog_cdk_constructs_v2-4.0.0 → datadog_cdk_constructs_v2-4.2.0/src/datadog_cdk_constructs_v2.egg-info}/PKG-INFO +42 -46
  10. {datadog_cdk_constructs_v2-4.0.0 → datadog_cdk_constructs_v2-4.2.0}/src/datadog_cdk_constructs_v2.egg-info/SOURCES.txt +1 -1
  11. datadog_cdk_constructs_v2-4.2.0/src/datadog_cdk_constructs_v2.egg-info/requires.txt +4 -0
  12. datadog_cdk_constructs_v2-4.0.0/src/datadog_cdk_constructs_v2/_jsii/__init__.py +0 -45
  13. datadog_cdk_constructs_v2-4.0.0/src/datadog_cdk_constructs_v2/_jsii/datadog-cdk-constructs-v2@4.0.0.jsii.tgz +0 -0
  14. datadog_cdk_constructs_v2-4.0.0/src/datadog_cdk_constructs_v2.egg-info/requires.txt +0 -5
  15. {datadog_cdk_constructs_v2-4.0.0 → datadog_cdk_constructs_v2-4.2.0}/LICENSE +0 -0
  16. {datadog_cdk_constructs_v2-4.0.0 → datadog_cdk_constructs_v2-4.2.0}/MANIFEST.in +0 -0
  17. {datadog_cdk_constructs_v2-4.0.0 → datadog_cdk_constructs_v2-4.2.0}/setup.cfg +0 -0
  18. {datadog_cdk_constructs_v2-4.0.0 → datadog_cdk_constructs_v2-4.2.0}/src/datadog_cdk_constructs_v2/py.typed +0 -0
  19. {datadog_cdk_constructs_v2-4.0.0 → datadog_cdk_constructs_v2-4.2.0}/src/datadog_cdk_constructs_v2.egg-info/dependency_links.txt +0 -0
  20. {datadog_cdk_constructs_v2-4.0.0 → datadog_cdk_constructs_v2-4.2.0}/src/datadog_cdk_constructs_v2.egg-info/top_level.txt +0 -0
@@ -1,4 +1,4 @@
1
1
  Datadog datadog-cdk-constructs
2
- Copyright 2021 Datadog, Inc.
2
+ Copyright 2020-2026 Datadog, Inc.
3
3
 
4
4
  This product includes software developed at Datadog (https://www.datadoghq.com/).
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: datadog-cdk-constructs-v2
3
- Version: 4.0.0
3
+ Version: 4.2.0
4
4
  Summary: CDK Construct Library to automatically instrument Python and Node Lambda functions with Datadog using AWS CDK v2
5
5
  Home-page: https://github.com/DataDog/datadog-cdk-constructs
6
6
  Author: Datadog
@@ -10,21 +10,22 @@ Classifier: Intended Audience :: Developers
10
10
  Classifier: Operating System :: OS Independent
11
11
  Classifier: Programming Language :: JavaScript
12
12
  Classifier: Programming Language :: Python :: 3 :: Only
13
- Classifier: Programming Language :: Python :: 3.9
14
13
  Classifier: Programming Language :: Python :: 3.10
15
14
  Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
16
18
  Classifier: Typing :: Typed
17
19
  Classifier: Development Status :: 5 - Production/Stable
18
20
  Classifier: License :: OSI Approved
19
- Requires-Python: ~=3.9
21
+ Requires-Python: >=3.10
20
22
  Description-Content-Type: text/markdown
21
23
  License-File: LICENSE
22
24
  License-File: NOTICE
23
- Requires-Dist: aws-cdk-lib<3.0.0,>=2.253.0
25
+ Requires-Dist: aws-cdk-lib<3.0.0,>=2.257.0
24
26
  Requires-Dist: constructs<11.0.0,>=10.5.1
25
- Requires-Dist: jsii<2.0.0,>=1.128.0
27
+ Requires-Dist: jsii<2.0.0,>=1.136.0
26
28
  Requires-Dist: publication>=0.0.3
27
- Requires-Dist: typeguard==2.13.3
28
29
 
29
30
  # Datadog CDK Constructs
30
31
 
@@ -93,16 +94,13 @@ Add this to your CDK stack:
93
94
  #### TypeScript
94
95
 
95
96
  ```python
96
- import { DatadogLambda } from "datadog-cdk-constructs-v2";
97
+ import { DatadogLambda, DatadogDefaultLayerVersions } from "datadog-cdk-constructs-v2";
97
98
 
98
99
  const datadogLambda = new DatadogLambda(this, "datadogLambda", {
99
- nodeLayerVersion: <LAYER_VERSION>,
100
- pythonLayerVersion: <LAYER_VERSION>,
101
- javaLayerVersion: <LAYER_VERSION>,
102
- dotnetLayerVersion: <LAYER_VERSION>,
103
- rubyLayerVersion: <LAYER_VERSION>,
100
+ // Lambda library layer versions are optional; they default to the latest
101
+ // version bundled with this construct. Set them to pin a specific version.
104
102
  addLayers: <BOOLEAN>,
105
- extensionLayerVersion: <EXTENSION_VERSION>,
103
+ extensionLayerVersion: DatadogDefaultLayerVersions.EXTENSION,
106
104
  forwarderArn: "<FORWARDER_ARN>",
107
105
  createForwarderPermissions: <BOOLEAN>,
108
106
  flushMetricsToLogs: <BOOLEAN>,
@@ -128,16 +126,13 @@ datadogLambda.addForwarderToNonLambdaLogGroups([<LOG_GROUPS>])
128
126
  #### Python
129
127
 
130
128
  ```python
131
- from datadog_cdk_constructs_v2 import DatadogLambda
129
+ from datadog_cdk_constructs_v2 import DatadogLambda, DatadogDefaultLayerVersions
132
130
  datadog = DatadogLambda(
133
131
  self,
134
132
  "Datadog",
135
- dotnet_layer_version=<LAYER_VERSION>,
136
- node_layer_version=<LAYER_VERSION>,
137
- python_layer_version=<LAYER_VERSION>,
138
- ruby_layer_version=<LAYER_VERSION>,
139
- java_layer_version=<LAYER_VERSION>,
140
- extension_layer_version=<EXTENSION_VERSION>,
133
+ # Lambda library layer versions are optional; they default to the latest
134
+ # version bundled with this construct. Set them to pin a specific version.
135
+ extension_layer_version=DatadogDefaultLayerVersions.EXTENSION,
141
136
  add_layers=<BOOLEAN>,
142
137
  api_key=os.getenv("DD_API_KEY"),
143
138
  site=<SITE>,
@@ -156,11 +151,9 @@ datadogLambda := ddcdkconstruct.NewDatadogLambda(
156
151
  stack,
157
152
  jsii.String("Datadog"),
158
153
  &ddcdkconstruct.DatadogLambdaProps{
159
- NodeLayerVersion: jsii.Number(<LAYER_VERSION>),
160
- PythonLayerVersion: jsii.Number(<LAYER_VERSION>),
161
- JavaLayerVersion: jsii.Number(<LAYER_VERSION>),
162
- DotnetLayerVersion: jsii.Number(<LAYER_VERSION>),
163
- RubyLayerVersion: jsii.Number(<LAYER_VERSION>),
154
+ // Lambda library layer versions are optional; they default to the latest
155
+ // version bundled with this construct. Set them to pin a specific version.
156
+ ExtensionLayerVersion: ddcdkconstruct.DatadogDefaultLayerVersions_EXTENSION(),
164
157
  AddLayers: jsii.Bool(<BOOLEAN>),
165
158
  Site: jsii.String(<SITE>),
166
159
  ApiKey: jsii.String(os.Getenv("DD_API_KEY")),
@@ -175,16 +168,14 @@ datadogLambda.AddForwarderToNonLambdaLogGroups()
175
168
  ```java
176
169
  import com.datadoghq.cdkconstructs.DatadogLambda;
177
170
  import com.datadoghq.cdkconstructs.DatadogLambdaProps;
171
+ import com.datadoghq.cdkconstructs.DatadogDefaultLayerVersions;
178
172
 
179
173
  DatadogLambda datadogLambda = new DatadogLambda(this, "Datadog",
180
174
  DatadogLambdaProps.builder()
181
- .nodeLayerVersion(<LAYER_VERSION>)
182
- .pythonLayerVersion(<LAYER_VERSION>)
183
- .javaLayerVersion(<LAYER_VERSION>)
184
- .dotnetLayerVersion(<LAYER_VERSION>)
185
- .rubyLayerVersion(<LAYER_VERSION>)
175
+ // Lambda library layer versions are optional; they default to the latest
176
+ // version bundled with this construct. Set them to pin a specific version.
186
177
  .addLayers(<BOOLEAN>)
187
- .extensionLayerVersion(<EXTENSION_VERSION>)
178
+ .extensionLayerVersion(DatadogDefaultLayerVersions.EXTENSION)
188
179
  .flushMetricsToLogs(<BOOLEAN>)
189
180
  .site("<SITE>")
190
181
  .apiKey(System.getenv("DD_API_KEY"))
@@ -271,21 +262,21 @@ To further configure your DatadogLambda construct for Lambda, use the following
271
262
 
272
263
  | npm package parameter | PyPI package parameter | Description |
273
264
  | ---------------------------- | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
274
- | `addLayers` | `add_layers` | Whether to add the runtime Lambda Layers or expect the user to bring their own. Defaults to `true`. When `true`, the Lambda Library version variables are also required. When `false`, you must include the Datadog Lambda library in your functions' deployment packages. |
275
- | `pythonLayerVersion` | `python_layer_version` | Version of the Python Lambda layer to install, such as `122`. Required if you are deploying at least one Lambda function written in Python and `addLayers` is `true`. Find the latest version number [here](https://github.com/DataDog/datadog-lambda-python/releases). **Warning**: This parameter and `pythonLayerArn` are mutually exclusive. If used, only set one or the other. |
265
+ | `addLayers` | `add_layers` | Whether to add the runtime Lambda Layers or expect the user to bring their own. Defaults to `true`. When `false`, you must include the Datadog Lambda library in your functions' deployment packages. |
266
+ | `pythonLayerVersion` | `python_layer_version` | Version of the Python Lambda layer to install, such as `122`. Optional: Defaults to the latest version bundled with this construct (`DatadogDefaultLayerVersions.PYTHON`). Set this to pin a specific version. Find the latest version number [here](https://github.com/DataDog/datadog-lambda-python/releases). **Warning**: This parameter and `pythonLayerArn` are mutually exclusive. If used, only set one or the other. |
276
267
  | `pythonLayerArn` | `python_layer_arn` | The custom ARN of the Python Lambda layer to install. Required if you are deploying at least one Lambda function written in Python and `addLayers` is `true`. **Warning**: This parameter and `pythonLayerVersion` are mutually exclusive. If used, only set one or the other. |
277
- | `nodeLayerVersion` | `node_layer_version` | Version of the Node.js Lambda layer to install, such as `133`. Required if you are deploying at least one Lambda function written in Node.js and `addLayers` is `true`. Find the latest version number from [here](https://github.com/DataDog/datadog-lambda-js/releases). **Warning**: This parameter and `nodeLayerArn` are mutually exclusive. If used, only set one or the other. |
268
+ | `nodeLayerVersion` | `node_layer_version` | Version of the Node.js Lambda layer to install, such as `133`. Optional: Defaults to the latest version bundled with this construct (`DatadogDefaultLayerVersions.NODE`). Set this to pin a specific version. Find the latest version number from [here](https://github.com/DataDog/datadog-lambda-js/releases). **Warning**: This parameter and `nodeLayerArn` are mutually exclusive. If used, only set one or the other. |
278
269
  | `nodeLayerArn` | `node_layer_arn` | The custom ARN of the Node.js Lambda layer to install. Required if you are deploying at least one Lambda function written in Node.js and `addLayers` is `true`. **Warning**: This parameter and `nodeLayerVersion` are mutually exclusive. If used, only set one or the other. |
279
- | `javaLayerVersion` | `java_layer_version` | Version of the Java layer to install, such as `25`. Required if you are deploying at least one Lambda function written in Java and `addLayers` is `true`. Find the latest version number [here](https://github.com/DataDog/datadog-lambda-java/releases). **Note**: `extensionLayerVersion >= 25` and `javaLayerVersion >= 5` are required for the DatadogLambda construct to instrument your Java functions properly. **Warning**: This parameter and `javaLayerArn` are mutually exclusive. If used, only set one or the other. |
270
+ | `javaLayerVersion` | `java_layer_version` | Version of the Java layer to install, such as `25`. Optional: Defaults to the latest version bundled with this construct (`DatadogDefaultLayerVersions.JAVA`). Set this to pin a specific version. Find the latest version number [here](https://github.com/DataDog/datadog-lambda-java/releases). **Note**: `extensionLayerVersion >= 25` and `javaLayerVersion >= 5` are required for the DatadogLambda construct to instrument your Java functions properly. **Warning**: This parameter and `javaLayerArn` are mutually exclusive. If used, only set one or the other. |
280
271
  | `javaLayerArn` | `java_layer_arn` | The custom ARN of the Java layer to install. Required if you are deploying at least one Lambda function written in Java and `addLayers` is `true`. **Warning**: This parameter and `javaLayerVersion` are mutually exclusive. If used, only set one or the other. |
281
- | `dotnetLayerVersion` | `dotnet_layer_version` | Version of the .NET layer to install, such as `23`. Required if you are deploying at least one Lambda function written in .NET and `addLayers` is `true`. Find the latest version number from [here](https://github.com/DataDog/dd-trace-dotnet-aws-lambda-layer/releases). **Warning**: This parameter and `dotnetLayerArn` are mutually exclusive. If used, only set one or the other. |
272
+ | `dotnetLayerVersion` | `dotnet_layer_version` | Version of the .NET layer to install, such as `23`. Optional: Defaults to the latest version bundled with this construct (`DatadogDefaultLayerVersions.DOTNET`). Set this to pin a specific version. Find the latest version number from [here](https://github.com/DataDog/dd-trace-dotnet-aws-lambda-layer/releases). **Warning**: This parameter and `dotnetLayerArn` are mutually exclusive. If used, only set one or the other. |
282
273
  | `dotnetLayerArn` | `dotnet_layer_arn` | The custom ARN of the .NET layer to install. Required if you are deploying at least one Lambda function written in .NET and `addLayers` is `true`. **Warning**: This parameter and `dotnetLayerVersion` are mutually exclusive. If used, only set one or the other. . |
283
274
  | `extensionLayerVersion` | `extension_layer_version` | Version of the Datadog Lambda Extension layer to install, such as `92`. When `extensionLayerVersion` is set, `apiKey` (or if encrypted, `apiKMSKey`, `apiKeySecret`, or `apiKeySecretArn`) needs to be set as well. When enabled, lambda function log groups will not be subscribed by the forwarder. Learn more about the Lambda extension [here](https://docs.datadoghq.com/serverless/datadog_lambda_library/extension/) and get the [latest version](https://github.com/DataDog/datadog-lambda-extension/releases). **Warning**: This parameter and `extensionVersionArn` are mutually exclusive. Set only one or the other. **Note**: If this parameter is set, it adds a layer even if `addLayers` is set to `false`. |
284
275
  | `extensionLayerArn` | `extension_layer_arn` | The custom ARN of the Datadog Lambda Extension layer to install. When `extensionLayerArn` is set, `apiKey` (or if encrypted, `apiKMSKey`, `apiKeySecret`, or `apiKeySecretArn`) needs to be set as well. When enabled, lambda function log groups are not subscribed by the forwarder. Learn more about the Lambda extension [here](https://docs.datadoghq.com/serverless/datadog_lambda_library/extension/) and get the [latest version](https://github.com/DataDog/datadog-lambda-extension/releases). **Warning**: This parameter and`extensionLayerVersion` are mutually exclusive. If used, only set one or the other. **Note**: If this parameter is set, it adds a layer even if `addLayers` is set to `false`. |
285
276
  | `forwarderArn` | `forwarder_arn` | When set, the plugin automatically subscribes the Datadog Forwarder to the functions' log groups. Do not set `forwarderArn` when `extensionLayerVersion` or `extensionLayerArn` is set. |
286
277
  | `createForwarderPermissions` | `createForwarderPermissions` | When set to `true`, creates a Lambda permission on the the Datadog Forwarder per log group. Since the Datadog Forwarder has permissions configured by default, this is unnecessary in most use cases. |
287
278
  | `flushMetricsToLogs` | `flush_metrics_to_logs` | Send custom metrics using CloudWatch logs with the Datadog Forwarder Lambda function (recommended). Defaults to `true` . If you disable this parameter, it's required to set `apiKey` (or if encrypted, `apiKMSKey`, `apiKeySecret`, or `apiKeySecretArn`). |
288
- | `site` | `site` | Set which Datadog site to send data. This is only used when `flushMetricsToLogs` is `false` or `extensionLayerVersion` or `extensionLayerArn` is set. Possible values are `datadoghq.com`, `datadoghq.eu`, `us3.datadoghq.com`, `us5.datadoghq.com`, `ap1.datadoghq.com`, `ap2.datadoghq.com`, `ddog-gov.com`, and `us2.ddog-gov.com`. The default is `datadoghq.com`. |
279
+ | `site` | `site` | Set which Datadog site to send data. This is only used when `flushMetricsToLogs` is `false` or `extensionLayerVersion` or `extensionLayerArn` is set. Possible values are `datadoghq.com`, `datadoghq.eu`, `us3.datadoghq.com`, `us5.datadoghq.com`, `ap1.datadoghq.com`, `ap2.datadoghq.com`, `uk1.datadoghq.com`, `ddog-gov.com`, and `us2.ddog-gov.com`. The default is `datadoghq.com`. |
289
280
  | `apiKey` | `api_key` | Datadog API Key, only needed when `flushMetricsToLogs` is `false` or `extensionLayerVersion` or `extensionLayerArn` is set. For more information about getting a Datadog API key, see the [API key documentation](https://docs.datadoghq.com/account_management/api-app-keys/#api-keys). |
290
281
  | `apiKeySecretArn` | `api_key_secret_arn` | The ARN of the secret storing the Datadog API key in AWS Secrets Manager. Use this parameter in place of `apiKey` when `flushMetricsToLogs` is `false` or `extensionLayer` is set. Remember to add the `secretsmanager:GetSecretValue` permission to the Lambda execution role. |
291
282
  | `apiKeySsmArn` | `api_key_ssm_arn` | The ARN of the parameter storing the Datadog API key in AWS Systems Manager Parameter Store (for example, `arn:aws:ssm:us-east-1:123456789012:parameter/my/parameter/name`). Use this parameter in place of `apiKey` when `flushMetricsToLogs` is `false` or `extensionLayer` is set. Supports both `String` and `SecureString` parameter types. When `grantSecretReadAccess` is `true` (default), the construct automatically grants `ssm:GetParameter` and `kms:Decrypt` (for the AWS managed key `alias/aws/ssm`) permissions. If using a custom KMS key for SecureString encryption, you must grant `kms:Decrypt` permission for that key separately. |
@@ -318,6 +309,19 @@ To further configure your DatadogLambda construct for Lambda, use the following
318
309
  | `llmObsMlApp` | `llm_obs_ml_app` | The name of your LLM application, service, or project, under which all traces and spans are grouped. This helps distinguish between different applications or experiments. See [Application naming guidelines](https://docs.datadoghq.com/llm_observability/sdk/?tab=nodejs#application-naming-guidelines) for allowed characters and other constraints. To override this value for a given root span, see [Tracing multiple applications](https://docs.datadoghq.com/llm_observability/sdk/?tab=nodejs#tracing-multiple-applications). Required if `llmObsEnabled` is `true` |
319
310
  | `llmObsAgentlessEnabled` | `llm_obs_agentless_enabled` | Only required if you are not using the Datadog Lambda Extension, in which case this should be set to `true`. Defaults to `false`. |
320
311
 
312
+ #### Default layer versions
313
+
314
+ When you don't pass a `*LayerVersion` or `*LayerArn`, the construct uses a default layer version bundled with the package. These defaults track the latest released Datadog Lambda layers at the time the construct version was published, and are exposed via the `DatadogDefaultLayerVersions` class so you can reference them directly in any language:
315
+
316
+ ```python
317
+ import { DatadogDefaultLayerVersions } from "datadog-cdk-constructs-v2";
318
+
319
+ DatadogDefaultLayerVersions.NODE;
320
+ DatadogDefaultLayerVersions.EXTENSION;
321
+ ```
322
+
323
+ Available members: `NODE`, `PYTHON`, `JAVA`, `DOTNET`, `RUBY`, and `EXTENSION`. To pin a specific version, set the corresponding `*LayerVersion` prop. The extension layer is still only applied when `extensionLayerVersion` or `extensionLayerArn` is set.
324
+
321
325
  #### Tracing
322
326
 
323
327
  Enable X-Ray Tracing on your Lambda functions. For more information, see [CDK documentation](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.Tracing.html).
@@ -348,10 +352,6 @@ class RootStack extends cdk.Stack {
348
352
  new NestedStack(this, "NestedStack");
349
353
 
350
354
  const datadogLambda = new DatadogLambda(this, "DatadogLambda", {
351
- nodeLayerVersion: <LAYER_VERSION>,
352
- pythonLayerVersion: <LAYER_VERSION>,
353
- javaLayerVersion: <LAYER_VERSION>,
354
- dotnetLayerVersion: <LAYER-VERSION>,
355
355
  addLayers: <BOOLEAN>,
356
356
  forwarderArn: "<FORWARDER_ARN>",
357
357
  flushMetricsToLogs: <BOOLEAN>,
@@ -374,10 +374,6 @@ class NestedStack extends cdk.NestedStack {
374
374
  super(scope, id, props);
375
375
 
376
376
  const datadogLambda = new DatadogLambda(this, "DatadogLambda", {
377
- nodeLayerVersion: <LAYER_VERSION>,
378
- pythonLayerVersion: <LAYER_VERSION>,
379
- javaLayerVersion: <LAYER_VERSION>,
380
- dotnetLayerVersion: <LAYER-VERSION>,
381
377
  addLayers: <BOOLEAN>,
382
378
  forwarderArn: "<FORWARDER_ARN>",
383
379
  flushMetricsToLogs: <BOOLEAN>,
@@ -792,4 +788,4 @@ For product feedback and questions, join the `#serverless` channel in the [Datad
792
788
 
793
789
  Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
794
790
 
795
- This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc.
791
+ This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2020-2026 Datadog, Inc.
@@ -65,16 +65,13 @@ Add this to your CDK stack:
65
65
  #### TypeScript
66
66
 
67
67
  ```python
68
- import { DatadogLambda } from "datadog-cdk-constructs-v2";
68
+ import { DatadogLambda, DatadogDefaultLayerVersions } from "datadog-cdk-constructs-v2";
69
69
 
70
70
  const datadogLambda = new DatadogLambda(this, "datadogLambda", {
71
- nodeLayerVersion: <LAYER_VERSION>,
72
- pythonLayerVersion: <LAYER_VERSION>,
73
- javaLayerVersion: <LAYER_VERSION>,
74
- dotnetLayerVersion: <LAYER_VERSION>,
75
- rubyLayerVersion: <LAYER_VERSION>,
71
+ // Lambda library layer versions are optional; they default to the latest
72
+ // version bundled with this construct. Set them to pin a specific version.
76
73
  addLayers: <BOOLEAN>,
77
- extensionLayerVersion: <EXTENSION_VERSION>,
74
+ extensionLayerVersion: DatadogDefaultLayerVersions.EXTENSION,
78
75
  forwarderArn: "<FORWARDER_ARN>",
79
76
  createForwarderPermissions: <BOOLEAN>,
80
77
  flushMetricsToLogs: <BOOLEAN>,
@@ -100,16 +97,13 @@ datadogLambda.addForwarderToNonLambdaLogGroups([<LOG_GROUPS>])
100
97
  #### Python
101
98
 
102
99
  ```python
103
- from datadog_cdk_constructs_v2 import DatadogLambda
100
+ from datadog_cdk_constructs_v2 import DatadogLambda, DatadogDefaultLayerVersions
104
101
  datadog = DatadogLambda(
105
102
  self,
106
103
  "Datadog",
107
- dotnet_layer_version=<LAYER_VERSION>,
108
- node_layer_version=<LAYER_VERSION>,
109
- python_layer_version=<LAYER_VERSION>,
110
- ruby_layer_version=<LAYER_VERSION>,
111
- java_layer_version=<LAYER_VERSION>,
112
- extension_layer_version=<EXTENSION_VERSION>,
104
+ # Lambda library layer versions are optional; they default to the latest
105
+ # version bundled with this construct. Set them to pin a specific version.
106
+ extension_layer_version=DatadogDefaultLayerVersions.EXTENSION,
113
107
  add_layers=<BOOLEAN>,
114
108
  api_key=os.getenv("DD_API_KEY"),
115
109
  site=<SITE>,
@@ -128,11 +122,9 @@ datadogLambda := ddcdkconstruct.NewDatadogLambda(
128
122
  stack,
129
123
  jsii.String("Datadog"),
130
124
  &ddcdkconstruct.DatadogLambdaProps{
131
- NodeLayerVersion: jsii.Number(<LAYER_VERSION>),
132
- PythonLayerVersion: jsii.Number(<LAYER_VERSION>),
133
- JavaLayerVersion: jsii.Number(<LAYER_VERSION>),
134
- DotnetLayerVersion: jsii.Number(<LAYER_VERSION>),
135
- RubyLayerVersion: jsii.Number(<LAYER_VERSION>),
125
+ // Lambda library layer versions are optional; they default to the latest
126
+ // version bundled with this construct. Set them to pin a specific version.
127
+ ExtensionLayerVersion: ddcdkconstruct.DatadogDefaultLayerVersions_EXTENSION(),
136
128
  AddLayers: jsii.Bool(<BOOLEAN>),
137
129
  Site: jsii.String(<SITE>),
138
130
  ApiKey: jsii.String(os.Getenv("DD_API_KEY")),
@@ -147,16 +139,14 @@ datadogLambda.AddForwarderToNonLambdaLogGroups()
147
139
  ```java
148
140
  import com.datadoghq.cdkconstructs.DatadogLambda;
149
141
  import com.datadoghq.cdkconstructs.DatadogLambdaProps;
142
+ import com.datadoghq.cdkconstructs.DatadogDefaultLayerVersions;
150
143
 
151
144
  DatadogLambda datadogLambda = new DatadogLambda(this, "Datadog",
152
145
  DatadogLambdaProps.builder()
153
- .nodeLayerVersion(<LAYER_VERSION>)
154
- .pythonLayerVersion(<LAYER_VERSION>)
155
- .javaLayerVersion(<LAYER_VERSION>)
156
- .dotnetLayerVersion(<LAYER_VERSION>)
157
- .rubyLayerVersion(<LAYER_VERSION>)
146
+ // Lambda library layer versions are optional; they default to the latest
147
+ // version bundled with this construct. Set them to pin a specific version.
158
148
  .addLayers(<BOOLEAN>)
159
- .extensionLayerVersion(<EXTENSION_VERSION>)
149
+ .extensionLayerVersion(DatadogDefaultLayerVersions.EXTENSION)
160
150
  .flushMetricsToLogs(<BOOLEAN>)
161
151
  .site("<SITE>")
162
152
  .apiKey(System.getenv("DD_API_KEY"))
@@ -243,21 +233,21 @@ To further configure your DatadogLambda construct for Lambda, use the following
243
233
 
244
234
  | npm package parameter | PyPI package parameter | Description |
245
235
  | ---------------------------- | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
246
- | `addLayers` | `add_layers` | Whether to add the runtime Lambda Layers or expect the user to bring their own. Defaults to `true`. When `true`, the Lambda Library version variables are also required. When `false`, you must include the Datadog Lambda library in your functions' deployment packages. |
247
- | `pythonLayerVersion` | `python_layer_version` | Version of the Python Lambda layer to install, such as `122`. Required if you are deploying at least one Lambda function written in Python and `addLayers` is `true`. Find the latest version number [here](https://github.com/DataDog/datadog-lambda-python/releases). **Warning**: This parameter and `pythonLayerArn` are mutually exclusive. If used, only set one or the other. |
236
+ | `addLayers` | `add_layers` | Whether to add the runtime Lambda Layers or expect the user to bring their own. Defaults to `true`. When `false`, you must include the Datadog Lambda library in your functions' deployment packages. |
237
+ | `pythonLayerVersion` | `python_layer_version` | Version of the Python Lambda layer to install, such as `122`. Optional: Defaults to the latest version bundled with this construct (`DatadogDefaultLayerVersions.PYTHON`). Set this to pin a specific version. Find the latest version number [here](https://github.com/DataDog/datadog-lambda-python/releases). **Warning**: This parameter and `pythonLayerArn` are mutually exclusive. If used, only set one or the other. |
248
238
  | `pythonLayerArn` | `python_layer_arn` | The custom ARN of the Python Lambda layer to install. Required if you are deploying at least one Lambda function written in Python and `addLayers` is `true`. **Warning**: This parameter and `pythonLayerVersion` are mutually exclusive. If used, only set one or the other. |
249
- | `nodeLayerVersion` | `node_layer_version` | Version of the Node.js Lambda layer to install, such as `133`. Required if you are deploying at least one Lambda function written in Node.js and `addLayers` is `true`. Find the latest version number from [here](https://github.com/DataDog/datadog-lambda-js/releases). **Warning**: This parameter and `nodeLayerArn` are mutually exclusive. If used, only set one or the other. |
239
+ | `nodeLayerVersion` | `node_layer_version` | Version of the Node.js Lambda layer to install, such as `133`. Optional: Defaults to the latest version bundled with this construct (`DatadogDefaultLayerVersions.NODE`). Set this to pin a specific version. Find the latest version number from [here](https://github.com/DataDog/datadog-lambda-js/releases). **Warning**: This parameter and `nodeLayerArn` are mutually exclusive. If used, only set one or the other. |
250
240
  | `nodeLayerArn` | `node_layer_arn` | The custom ARN of the Node.js Lambda layer to install. Required if you are deploying at least one Lambda function written in Node.js and `addLayers` is `true`. **Warning**: This parameter and `nodeLayerVersion` are mutually exclusive. If used, only set one or the other. |
251
- | `javaLayerVersion` | `java_layer_version` | Version of the Java layer to install, such as `25`. Required if you are deploying at least one Lambda function written in Java and `addLayers` is `true`. Find the latest version number [here](https://github.com/DataDog/datadog-lambda-java/releases). **Note**: `extensionLayerVersion >= 25` and `javaLayerVersion >= 5` are required for the DatadogLambda construct to instrument your Java functions properly. **Warning**: This parameter and `javaLayerArn` are mutually exclusive. If used, only set one or the other. |
241
+ | `javaLayerVersion` | `java_layer_version` | Version of the Java layer to install, such as `25`. Optional: Defaults to the latest version bundled with this construct (`DatadogDefaultLayerVersions.JAVA`). Set this to pin a specific version. Find the latest version number [here](https://github.com/DataDog/datadog-lambda-java/releases). **Note**: `extensionLayerVersion >= 25` and `javaLayerVersion >= 5` are required for the DatadogLambda construct to instrument your Java functions properly. **Warning**: This parameter and `javaLayerArn` are mutually exclusive. If used, only set one or the other. |
252
242
  | `javaLayerArn` | `java_layer_arn` | The custom ARN of the Java layer to install. Required if you are deploying at least one Lambda function written in Java and `addLayers` is `true`. **Warning**: This parameter and `javaLayerVersion` are mutually exclusive. If used, only set one or the other. |
253
- | `dotnetLayerVersion` | `dotnet_layer_version` | Version of the .NET layer to install, such as `23`. Required if you are deploying at least one Lambda function written in .NET and `addLayers` is `true`. Find the latest version number from [here](https://github.com/DataDog/dd-trace-dotnet-aws-lambda-layer/releases). **Warning**: This parameter and `dotnetLayerArn` are mutually exclusive. If used, only set one or the other. |
243
+ | `dotnetLayerVersion` | `dotnet_layer_version` | Version of the .NET layer to install, such as `23`. Optional: Defaults to the latest version bundled with this construct (`DatadogDefaultLayerVersions.DOTNET`). Set this to pin a specific version. Find the latest version number from [here](https://github.com/DataDog/dd-trace-dotnet-aws-lambda-layer/releases). **Warning**: This parameter and `dotnetLayerArn` are mutually exclusive. If used, only set one or the other. |
254
244
  | `dotnetLayerArn` | `dotnet_layer_arn` | The custom ARN of the .NET layer to install. Required if you are deploying at least one Lambda function written in .NET and `addLayers` is `true`. **Warning**: This parameter and `dotnetLayerVersion` are mutually exclusive. If used, only set one or the other. . |
255
245
  | `extensionLayerVersion` | `extension_layer_version` | Version of the Datadog Lambda Extension layer to install, such as `92`. When `extensionLayerVersion` is set, `apiKey` (or if encrypted, `apiKMSKey`, `apiKeySecret`, or `apiKeySecretArn`) needs to be set as well. When enabled, lambda function log groups will not be subscribed by the forwarder. Learn more about the Lambda extension [here](https://docs.datadoghq.com/serverless/datadog_lambda_library/extension/) and get the [latest version](https://github.com/DataDog/datadog-lambda-extension/releases). **Warning**: This parameter and `extensionVersionArn` are mutually exclusive. Set only one or the other. **Note**: If this parameter is set, it adds a layer even if `addLayers` is set to `false`. |
256
246
  | `extensionLayerArn` | `extension_layer_arn` | The custom ARN of the Datadog Lambda Extension layer to install. When `extensionLayerArn` is set, `apiKey` (or if encrypted, `apiKMSKey`, `apiKeySecret`, or `apiKeySecretArn`) needs to be set as well. When enabled, lambda function log groups are not subscribed by the forwarder. Learn more about the Lambda extension [here](https://docs.datadoghq.com/serverless/datadog_lambda_library/extension/) and get the [latest version](https://github.com/DataDog/datadog-lambda-extension/releases). **Warning**: This parameter and`extensionLayerVersion` are mutually exclusive. If used, only set one or the other. **Note**: If this parameter is set, it adds a layer even if `addLayers` is set to `false`. |
257
247
  | `forwarderArn` | `forwarder_arn` | When set, the plugin automatically subscribes the Datadog Forwarder to the functions' log groups. Do not set `forwarderArn` when `extensionLayerVersion` or `extensionLayerArn` is set. |
258
248
  | `createForwarderPermissions` | `createForwarderPermissions` | When set to `true`, creates a Lambda permission on the the Datadog Forwarder per log group. Since the Datadog Forwarder has permissions configured by default, this is unnecessary in most use cases. |
259
249
  | `flushMetricsToLogs` | `flush_metrics_to_logs` | Send custom metrics using CloudWatch logs with the Datadog Forwarder Lambda function (recommended). Defaults to `true` . If you disable this parameter, it's required to set `apiKey` (or if encrypted, `apiKMSKey`, `apiKeySecret`, or `apiKeySecretArn`). |
260
- | `site` | `site` | Set which Datadog site to send data. This is only used when `flushMetricsToLogs` is `false` or `extensionLayerVersion` or `extensionLayerArn` is set. Possible values are `datadoghq.com`, `datadoghq.eu`, `us3.datadoghq.com`, `us5.datadoghq.com`, `ap1.datadoghq.com`, `ap2.datadoghq.com`, `ddog-gov.com`, and `us2.ddog-gov.com`. The default is `datadoghq.com`. |
250
+ | `site` | `site` | Set which Datadog site to send data. This is only used when `flushMetricsToLogs` is `false` or `extensionLayerVersion` or `extensionLayerArn` is set. Possible values are `datadoghq.com`, `datadoghq.eu`, `us3.datadoghq.com`, `us5.datadoghq.com`, `ap1.datadoghq.com`, `ap2.datadoghq.com`, `uk1.datadoghq.com`, `ddog-gov.com`, and `us2.ddog-gov.com`. The default is `datadoghq.com`. |
261
251
  | `apiKey` | `api_key` | Datadog API Key, only needed when `flushMetricsToLogs` is `false` or `extensionLayerVersion` or `extensionLayerArn` is set. For more information about getting a Datadog API key, see the [API key documentation](https://docs.datadoghq.com/account_management/api-app-keys/#api-keys). |
262
252
  | `apiKeySecretArn` | `api_key_secret_arn` | The ARN of the secret storing the Datadog API key in AWS Secrets Manager. Use this parameter in place of `apiKey` when `flushMetricsToLogs` is `false` or `extensionLayer` is set. Remember to add the `secretsmanager:GetSecretValue` permission to the Lambda execution role. |
263
253
  | `apiKeySsmArn` | `api_key_ssm_arn` | The ARN of the parameter storing the Datadog API key in AWS Systems Manager Parameter Store (for example, `arn:aws:ssm:us-east-1:123456789012:parameter/my/parameter/name`). Use this parameter in place of `apiKey` when `flushMetricsToLogs` is `false` or `extensionLayer` is set. Supports both `String` and `SecureString` parameter types. When `grantSecretReadAccess` is `true` (default), the construct automatically grants `ssm:GetParameter` and `kms:Decrypt` (for the AWS managed key `alias/aws/ssm`) permissions. If using a custom KMS key for SecureString encryption, you must grant `kms:Decrypt` permission for that key separately. |
@@ -290,6 +280,19 @@ To further configure your DatadogLambda construct for Lambda, use the following
290
280
  | `llmObsMlApp` | `llm_obs_ml_app` | The name of your LLM application, service, or project, under which all traces and spans are grouped. This helps distinguish between different applications or experiments. See [Application naming guidelines](https://docs.datadoghq.com/llm_observability/sdk/?tab=nodejs#application-naming-guidelines) for allowed characters and other constraints. To override this value for a given root span, see [Tracing multiple applications](https://docs.datadoghq.com/llm_observability/sdk/?tab=nodejs#tracing-multiple-applications). Required if `llmObsEnabled` is `true` |
291
281
  | `llmObsAgentlessEnabled` | `llm_obs_agentless_enabled` | Only required if you are not using the Datadog Lambda Extension, in which case this should be set to `true`. Defaults to `false`. |
292
282
 
283
+ #### Default layer versions
284
+
285
+ When you don't pass a `*LayerVersion` or `*LayerArn`, the construct uses a default layer version bundled with the package. These defaults track the latest released Datadog Lambda layers at the time the construct version was published, and are exposed via the `DatadogDefaultLayerVersions` class so you can reference them directly in any language:
286
+
287
+ ```python
288
+ import { DatadogDefaultLayerVersions } from "datadog-cdk-constructs-v2";
289
+
290
+ DatadogDefaultLayerVersions.NODE;
291
+ DatadogDefaultLayerVersions.EXTENSION;
292
+ ```
293
+
294
+ Available members: `NODE`, `PYTHON`, `JAVA`, `DOTNET`, `RUBY`, and `EXTENSION`. To pin a specific version, set the corresponding `*LayerVersion` prop. The extension layer is still only applied when `extensionLayerVersion` or `extensionLayerArn` is set.
295
+
293
296
  #### Tracing
294
297
 
295
298
  Enable X-Ray Tracing on your Lambda functions. For more information, see [CDK documentation](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.Tracing.html).
@@ -320,10 +323,6 @@ class RootStack extends cdk.Stack {
320
323
  new NestedStack(this, "NestedStack");
321
324
 
322
325
  const datadogLambda = new DatadogLambda(this, "DatadogLambda", {
323
- nodeLayerVersion: <LAYER_VERSION>,
324
- pythonLayerVersion: <LAYER_VERSION>,
325
- javaLayerVersion: <LAYER_VERSION>,
326
- dotnetLayerVersion: <LAYER-VERSION>,
327
326
  addLayers: <BOOLEAN>,
328
327
  forwarderArn: "<FORWARDER_ARN>",
329
328
  flushMetricsToLogs: <BOOLEAN>,
@@ -346,10 +345,6 @@ class NestedStack extends cdk.NestedStack {
346
345
  super(scope, id, props);
347
346
 
348
347
  const datadogLambda = new DatadogLambda(this, "DatadogLambda", {
349
- nodeLayerVersion: <LAYER_VERSION>,
350
- pythonLayerVersion: <LAYER_VERSION>,
351
- javaLayerVersion: <LAYER_VERSION>,
352
- dotnetLayerVersion: <LAYER-VERSION>,
353
348
  addLayers: <BOOLEAN>,
354
349
  forwarderArn: "<FORWARDER_ARN>",
355
350
  flushMetricsToLogs: <BOOLEAN>,
@@ -764,4 +759,4 @@ For product feedback and questions, join the `#serverless` channel in the [Datad
764
759
 
765
760
  Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
766
761
 
767
- This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc.
762
+ This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2020-2026 Datadog, Inc.
@@ -1,9 +1,9 @@
1
1
  [build-system]
2
- requires = ["setuptools~=75.3.2", "build~=1.3.0"]
2
+ requires = ["setuptools~=75.3.2", "build~=1.5.0"]
3
3
  build-backend = "setuptools.build_meta"
4
4
 
5
5
  [tool.pyright]
6
6
  defineConstant = { DEBUG = true }
7
- pythonVersion = "3.9"
7
+ pythonVersion = "3.10"
8
8
  pythonPlatform = "All"
9
9
  reportSelfClsParameterName = false
@@ -5,7 +5,7 @@ kwargs = json.loads(
5
5
  """
6
6
  {
7
7
  "name": "datadog-cdk-constructs-v2",
8
- "version": "4.0.0",
8
+ "version": "4.2.0",
9
9
  "description": "CDK Construct Library to automatically instrument Python and Node Lambda functions with Datadog using AWS CDK v2",
10
10
  "license": "Apache-2.0",
11
11
  "url": "https://github.com/DataDog/datadog-cdk-constructs",
@@ -26,28 +26,29 @@ kwargs = json.loads(
26
26
  ],
27
27
  "package_data": {
28
28
  "datadog_cdk_constructs_v2._jsii": [
29
- "datadog-cdk-constructs-v2@4.0.0.jsii.tgz"
29
+ "datadog-cdk-constructs-v2@4.2.0.jsii.tgz"
30
30
  ],
31
31
  "datadog_cdk_constructs_v2": [
32
32
  "py.typed"
33
33
  ]
34
34
  },
35
- "python_requires": "~=3.9",
35
+ "python_requires": ">=3.10",
36
36
  "install_requires": [
37
- "aws-cdk-lib>=2.253.0, <3.0.0",
37
+ "aws-cdk-lib>=2.257.0, <3.0.0",
38
38
  "constructs>=10.5.1, <11.0.0",
39
- "jsii>=1.128.0, <2.0.0",
40
- "publication>=0.0.3",
41
- "typeguard==2.13.3"
39
+ "jsii>=1.136.0, <2.0.0",
40
+ "publication>=0.0.3"
42
41
  ],
43
42
  "classifiers": [
44
43
  "Intended Audience :: Developers",
45
44
  "Operating System :: OS Independent",
46
45
  "Programming Language :: JavaScript",
47
46
  "Programming Language :: Python :: 3 :: Only",
48
- "Programming Language :: Python :: 3.9",
49
47
  "Programming Language :: Python :: 3.10",
50
48
  "Programming Language :: Python :: 3.11",
49
+ "Programming Language :: Python :: 3.12",
50
+ "Programming Language :: Python :: 3.13",
51
+ "Programming Language :: Python :: 3.14",
51
52
  "Typing :: Typed",
52
53
  "Development Status :: 5 - Production/Stable",
53
54
  "License :: OSI Approved"
@@ -66,16 +66,13 @@ Add this to your CDK stack:
66
66
  #### TypeScript
67
67
 
68
68
  ```python
69
- import { DatadogLambda } from "datadog-cdk-constructs-v2";
69
+ import { DatadogLambda, DatadogDefaultLayerVersions } from "datadog-cdk-constructs-v2";
70
70
 
71
71
  const datadogLambda = new DatadogLambda(this, "datadogLambda", {
72
- nodeLayerVersion: <LAYER_VERSION>,
73
- pythonLayerVersion: <LAYER_VERSION>,
74
- javaLayerVersion: <LAYER_VERSION>,
75
- dotnetLayerVersion: <LAYER_VERSION>,
76
- rubyLayerVersion: <LAYER_VERSION>,
72
+ // Lambda library layer versions are optional; they default to the latest
73
+ // version bundled with this construct. Set them to pin a specific version.
77
74
  addLayers: <BOOLEAN>,
78
- extensionLayerVersion: <EXTENSION_VERSION>,
75
+ extensionLayerVersion: DatadogDefaultLayerVersions.EXTENSION,
79
76
  forwarderArn: "<FORWARDER_ARN>",
80
77
  createForwarderPermissions: <BOOLEAN>,
81
78
  flushMetricsToLogs: <BOOLEAN>,
@@ -101,16 +98,13 @@ datadogLambda.addForwarderToNonLambdaLogGroups([<LOG_GROUPS>])
101
98
  #### Python
102
99
 
103
100
  ```python
104
- from datadog_cdk_constructs_v2 import DatadogLambda
101
+ from datadog_cdk_constructs_v2 import DatadogLambda, DatadogDefaultLayerVersions
105
102
  datadog = DatadogLambda(
106
103
  self,
107
104
  "Datadog",
108
- dotnet_layer_version=<LAYER_VERSION>,
109
- node_layer_version=<LAYER_VERSION>,
110
- python_layer_version=<LAYER_VERSION>,
111
- ruby_layer_version=<LAYER_VERSION>,
112
- java_layer_version=<LAYER_VERSION>,
113
- extension_layer_version=<EXTENSION_VERSION>,
105
+ # Lambda library layer versions are optional; they default to the latest
106
+ # version bundled with this construct. Set them to pin a specific version.
107
+ extension_layer_version=DatadogDefaultLayerVersions.EXTENSION,
114
108
  add_layers=<BOOLEAN>,
115
109
  api_key=os.getenv("DD_API_KEY"),
116
110
  site=<SITE>,
@@ -129,11 +123,9 @@ datadogLambda := ddcdkconstruct.NewDatadogLambda(
129
123
  stack,
130
124
  jsii.String("Datadog"),
131
125
  &ddcdkconstruct.DatadogLambdaProps{
132
- NodeLayerVersion: jsii.Number(<LAYER_VERSION>),
133
- PythonLayerVersion: jsii.Number(<LAYER_VERSION>),
134
- JavaLayerVersion: jsii.Number(<LAYER_VERSION>),
135
- DotnetLayerVersion: jsii.Number(<LAYER_VERSION>),
136
- RubyLayerVersion: jsii.Number(<LAYER_VERSION>),
126
+ // Lambda library layer versions are optional; they default to the latest
127
+ // version bundled with this construct. Set them to pin a specific version.
128
+ ExtensionLayerVersion: ddcdkconstruct.DatadogDefaultLayerVersions_EXTENSION(),
137
129
  AddLayers: jsii.Bool(<BOOLEAN>),
138
130
  Site: jsii.String(<SITE>),
139
131
  ApiKey: jsii.String(os.Getenv("DD_API_KEY")),
@@ -148,16 +140,14 @@ datadogLambda.AddForwarderToNonLambdaLogGroups()
148
140
  ```java
149
141
  import com.datadoghq.cdkconstructs.DatadogLambda;
150
142
  import com.datadoghq.cdkconstructs.DatadogLambdaProps;
143
+ import com.datadoghq.cdkconstructs.DatadogDefaultLayerVersions;
151
144
 
152
145
  DatadogLambda datadogLambda = new DatadogLambda(this, "Datadog",
153
146
  DatadogLambdaProps.builder()
154
- .nodeLayerVersion(<LAYER_VERSION>)
155
- .pythonLayerVersion(<LAYER_VERSION>)
156
- .javaLayerVersion(<LAYER_VERSION>)
157
- .dotnetLayerVersion(<LAYER_VERSION>)
158
- .rubyLayerVersion(<LAYER_VERSION>)
147
+ // Lambda library layer versions are optional; they default to the latest
148
+ // version bundled with this construct. Set them to pin a specific version.
159
149
  .addLayers(<BOOLEAN>)
160
- .extensionLayerVersion(<EXTENSION_VERSION>)
150
+ .extensionLayerVersion(DatadogDefaultLayerVersions.EXTENSION)
161
151
  .flushMetricsToLogs(<BOOLEAN>)
162
152
  .site("<SITE>")
163
153
  .apiKey(System.getenv("DD_API_KEY"))
@@ -244,21 +234,21 @@ To further configure your DatadogLambda construct for Lambda, use the following
244
234
 
245
235
  | npm package parameter | PyPI package parameter | Description |
246
236
  | ---------------------------- | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
247
- | `addLayers` | `add_layers` | Whether to add the runtime Lambda Layers or expect the user to bring their own. Defaults to `true`. When `true`, the Lambda Library version variables are also required. When `false`, you must include the Datadog Lambda library in your functions' deployment packages. |
248
- | `pythonLayerVersion` | `python_layer_version` | Version of the Python Lambda layer to install, such as `122`. Required if you are deploying at least one Lambda function written in Python and `addLayers` is `true`. Find the latest version number [here](https://github.com/DataDog/datadog-lambda-python/releases). **Warning**: This parameter and `pythonLayerArn` are mutually exclusive. If used, only set one or the other. |
237
+ | `addLayers` | `add_layers` | Whether to add the runtime Lambda Layers or expect the user to bring their own. Defaults to `true`. When `false`, you must include the Datadog Lambda library in your functions' deployment packages. |
238
+ | `pythonLayerVersion` | `python_layer_version` | Version of the Python Lambda layer to install, such as `122`. Optional: Defaults to the latest version bundled with this construct (`DatadogDefaultLayerVersions.PYTHON`). Set this to pin a specific version. Find the latest version number [here](https://github.com/DataDog/datadog-lambda-python/releases). **Warning**: This parameter and `pythonLayerArn` are mutually exclusive. If used, only set one or the other. |
249
239
  | `pythonLayerArn` | `python_layer_arn` | The custom ARN of the Python Lambda layer to install. Required if you are deploying at least one Lambda function written in Python and `addLayers` is `true`. **Warning**: This parameter and `pythonLayerVersion` are mutually exclusive. If used, only set one or the other. |
250
- | `nodeLayerVersion` | `node_layer_version` | Version of the Node.js Lambda layer to install, such as `133`. Required if you are deploying at least one Lambda function written in Node.js and `addLayers` is `true`. Find the latest version number from [here](https://github.com/DataDog/datadog-lambda-js/releases). **Warning**: This parameter and `nodeLayerArn` are mutually exclusive. If used, only set one or the other. |
240
+ | `nodeLayerVersion` | `node_layer_version` | Version of the Node.js Lambda layer to install, such as `133`. Optional: Defaults to the latest version bundled with this construct (`DatadogDefaultLayerVersions.NODE`). Set this to pin a specific version. Find the latest version number from [here](https://github.com/DataDog/datadog-lambda-js/releases). **Warning**: This parameter and `nodeLayerArn` are mutually exclusive. If used, only set one or the other. |
251
241
  | `nodeLayerArn` | `node_layer_arn` | The custom ARN of the Node.js Lambda layer to install. Required if you are deploying at least one Lambda function written in Node.js and `addLayers` is `true`. **Warning**: This parameter and `nodeLayerVersion` are mutually exclusive. If used, only set one or the other. |
252
- | `javaLayerVersion` | `java_layer_version` | Version of the Java layer to install, such as `25`. Required if you are deploying at least one Lambda function written in Java and `addLayers` is `true`. Find the latest version number [here](https://github.com/DataDog/datadog-lambda-java/releases). **Note**: `extensionLayerVersion >= 25` and `javaLayerVersion >= 5` are required for the DatadogLambda construct to instrument your Java functions properly. **Warning**: This parameter and `javaLayerArn` are mutually exclusive. If used, only set one or the other. |
242
+ | `javaLayerVersion` | `java_layer_version` | Version of the Java layer to install, such as `25`. Optional: Defaults to the latest version bundled with this construct (`DatadogDefaultLayerVersions.JAVA`). Set this to pin a specific version. Find the latest version number [here](https://github.com/DataDog/datadog-lambda-java/releases). **Note**: `extensionLayerVersion >= 25` and `javaLayerVersion >= 5` are required for the DatadogLambda construct to instrument your Java functions properly. **Warning**: This parameter and `javaLayerArn` are mutually exclusive. If used, only set one or the other. |
253
243
  | `javaLayerArn` | `java_layer_arn` | The custom ARN of the Java layer to install. Required if you are deploying at least one Lambda function written in Java and `addLayers` is `true`. **Warning**: This parameter and `javaLayerVersion` are mutually exclusive. If used, only set one or the other. |
254
- | `dotnetLayerVersion` | `dotnet_layer_version` | Version of the .NET layer to install, such as `23`. Required if you are deploying at least one Lambda function written in .NET and `addLayers` is `true`. Find the latest version number from [here](https://github.com/DataDog/dd-trace-dotnet-aws-lambda-layer/releases). **Warning**: This parameter and `dotnetLayerArn` are mutually exclusive. If used, only set one or the other. |
244
+ | `dotnetLayerVersion` | `dotnet_layer_version` | Version of the .NET layer to install, such as `23`. Optional: Defaults to the latest version bundled with this construct (`DatadogDefaultLayerVersions.DOTNET`). Set this to pin a specific version. Find the latest version number from [here](https://github.com/DataDog/dd-trace-dotnet-aws-lambda-layer/releases). **Warning**: This parameter and `dotnetLayerArn` are mutually exclusive. If used, only set one or the other. |
255
245
  | `dotnetLayerArn` | `dotnet_layer_arn` | The custom ARN of the .NET layer to install. Required if you are deploying at least one Lambda function written in .NET and `addLayers` is `true`. **Warning**: This parameter and `dotnetLayerVersion` are mutually exclusive. If used, only set one or the other. . |
256
246
  | `extensionLayerVersion` | `extension_layer_version` | Version of the Datadog Lambda Extension layer to install, such as `92`. When `extensionLayerVersion` is set, `apiKey` (or if encrypted, `apiKMSKey`, `apiKeySecret`, or `apiKeySecretArn`) needs to be set as well. When enabled, lambda function log groups will not be subscribed by the forwarder. Learn more about the Lambda extension [here](https://docs.datadoghq.com/serverless/datadog_lambda_library/extension/) and get the [latest version](https://github.com/DataDog/datadog-lambda-extension/releases). **Warning**: This parameter and `extensionVersionArn` are mutually exclusive. Set only one or the other. **Note**: If this parameter is set, it adds a layer even if `addLayers` is set to `false`. |
257
247
  | `extensionLayerArn` | `extension_layer_arn` | The custom ARN of the Datadog Lambda Extension layer to install. When `extensionLayerArn` is set, `apiKey` (or if encrypted, `apiKMSKey`, `apiKeySecret`, or `apiKeySecretArn`) needs to be set as well. When enabled, lambda function log groups are not subscribed by the forwarder. Learn more about the Lambda extension [here](https://docs.datadoghq.com/serverless/datadog_lambda_library/extension/) and get the [latest version](https://github.com/DataDog/datadog-lambda-extension/releases). **Warning**: This parameter and`extensionLayerVersion` are mutually exclusive. If used, only set one or the other. **Note**: If this parameter is set, it adds a layer even if `addLayers` is set to `false`. |
258
248
  | `forwarderArn` | `forwarder_arn` | When set, the plugin automatically subscribes the Datadog Forwarder to the functions' log groups. Do not set `forwarderArn` when `extensionLayerVersion` or `extensionLayerArn` is set. |
259
249
  | `createForwarderPermissions` | `createForwarderPermissions` | When set to `true`, creates a Lambda permission on the the Datadog Forwarder per log group. Since the Datadog Forwarder has permissions configured by default, this is unnecessary in most use cases. |
260
250
  | `flushMetricsToLogs` | `flush_metrics_to_logs` | Send custom metrics using CloudWatch logs with the Datadog Forwarder Lambda function (recommended). Defaults to `true` . If you disable this parameter, it's required to set `apiKey` (or if encrypted, `apiKMSKey`, `apiKeySecret`, or `apiKeySecretArn`). |
261
- | `site` | `site` | Set which Datadog site to send data. This is only used when `flushMetricsToLogs` is `false` or `extensionLayerVersion` or `extensionLayerArn` is set. Possible values are `datadoghq.com`, `datadoghq.eu`, `us3.datadoghq.com`, `us5.datadoghq.com`, `ap1.datadoghq.com`, `ap2.datadoghq.com`, `ddog-gov.com`, and `us2.ddog-gov.com`. The default is `datadoghq.com`. |
251
+ | `site` | `site` | Set which Datadog site to send data. This is only used when `flushMetricsToLogs` is `false` or `extensionLayerVersion` or `extensionLayerArn` is set. Possible values are `datadoghq.com`, `datadoghq.eu`, `us3.datadoghq.com`, `us5.datadoghq.com`, `ap1.datadoghq.com`, `ap2.datadoghq.com`, `uk1.datadoghq.com`, `ddog-gov.com`, and `us2.ddog-gov.com`. The default is `datadoghq.com`. |
262
252
  | `apiKey` | `api_key` | Datadog API Key, only needed when `flushMetricsToLogs` is `false` or `extensionLayerVersion` or `extensionLayerArn` is set. For more information about getting a Datadog API key, see the [API key documentation](https://docs.datadoghq.com/account_management/api-app-keys/#api-keys). |
263
253
  | `apiKeySecretArn` | `api_key_secret_arn` | The ARN of the secret storing the Datadog API key in AWS Secrets Manager. Use this parameter in place of `apiKey` when `flushMetricsToLogs` is `false` or `extensionLayer` is set. Remember to add the `secretsmanager:GetSecretValue` permission to the Lambda execution role. |
264
254
  | `apiKeySsmArn` | `api_key_ssm_arn` | The ARN of the parameter storing the Datadog API key in AWS Systems Manager Parameter Store (for example, `arn:aws:ssm:us-east-1:123456789012:parameter/my/parameter/name`). Use this parameter in place of `apiKey` when `flushMetricsToLogs` is `false` or `extensionLayer` is set. Supports both `String` and `SecureString` parameter types. When `grantSecretReadAccess` is `true` (default), the construct automatically grants `ssm:GetParameter` and `kms:Decrypt` (for the AWS managed key `alias/aws/ssm`) permissions. If using a custom KMS key for SecureString encryption, you must grant `kms:Decrypt` permission for that key separately. |
@@ -291,6 +281,19 @@ To further configure your DatadogLambda construct for Lambda, use the following
291
281
  | `llmObsMlApp` | `llm_obs_ml_app` | The name of your LLM application, service, or project, under which all traces and spans are grouped. This helps distinguish between different applications or experiments. See [Application naming guidelines](https://docs.datadoghq.com/llm_observability/sdk/?tab=nodejs#application-naming-guidelines) for allowed characters and other constraints. To override this value for a given root span, see [Tracing multiple applications](https://docs.datadoghq.com/llm_observability/sdk/?tab=nodejs#tracing-multiple-applications). Required if `llmObsEnabled` is `true` |
292
282
  | `llmObsAgentlessEnabled` | `llm_obs_agentless_enabled` | Only required if you are not using the Datadog Lambda Extension, in which case this should be set to `true`. Defaults to `false`. |
293
283
 
284
+ #### Default layer versions
285
+
286
+ When you don't pass a `*LayerVersion` or `*LayerArn`, the construct uses a default layer version bundled with the package. These defaults track the latest released Datadog Lambda layers at the time the construct version was published, and are exposed via the `DatadogDefaultLayerVersions` class so you can reference them directly in any language:
287
+
288
+ ```python
289
+ import { DatadogDefaultLayerVersions } from "datadog-cdk-constructs-v2";
290
+
291
+ DatadogDefaultLayerVersions.NODE;
292
+ DatadogDefaultLayerVersions.EXTENSION;
293
+ ```
294
+
295
+ Available members: `NODE`, `PYTHON`, `JAVA`, `DOTNET`, `RUBY`, and `EXTENSION`. To pin a specific version, set the corresponding `*LayerVersion` prop. The extension layer is still only applied when `extensionLayerVersion` or `extensionLayerArn` is set.
296
+
294
297
  #### Tracing
295
298
 
296
299
  Enable X-Ray Tracing on your Lambda functions. For more information, see [CDK documentation](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.Tracing.html).
@@ -321,10 +324,6 @@ class RootStack extends cdk.Stack {
321
324
  new NestedStack(this, "NestedStack");
322
325
 
323
326
  const datadogLambda = new DatadogLambda(this, "DatadogLambda", {
324
- nodeLayerVersion: <LAYER_VERSION>,
325
- pythonLayerVersion: <LAYER_VERSION>,
326
- javaLayerVersion: <LAYER_VERSION>,
327
- dotnetLayerVersion: <LAYER-VERSION>,
328
327
  addLayers: <BOOLEAN>,
329
328
  forwarderArn: "<FORWARDER_ARN>",
330
329
  flushMetricsToLogs: <BOOLEAN>,
@@ -347,10 +346,6 @@ class NestedStack extends cdk.NestedStack {
347
346
  super(scope, id, props);
348
347
 
349
348
  const datadogLambda = new DatadogLambda(this, "DatadogLambda", {
350
- nodeLayerVersion: <LAYER_VERSION>,
351
- pythonLayerVersion: <LAYER_VERSION>,
352
- javaLayerVersion: <LAYER_VERSION>,
353
- dotnetLayerVersion: <LAYER-VERSION>,
354
349
  addLayers: <BOOLEAN>,
355
350
  forwarderArn: "<FORWARDER_ARN>",
356
351
  flushMetricsToLogs: <BOOLEAN>,
@@ -765,8 +760,10 @@ For product feedback and questions, join the `#serverless` channel in the [Datad
765
760
 
766
761
  Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
767
762
 
768
- This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc.
763
+ This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2020-2026 Datadog, Inc.
769
764
  '''
765
+ from __future__ import annotations
766
+
770
767
  from pkgutil import extend_path
771
768
  __path__ = extend_path(__path__, __name__)
772
769
 
@@ -780,32 +777,39 @@ import jsii
780
777
  import publication
781
778
  import typing_extensions
782
779
 
783
- import typeguard
784
- from importlib.metadata import version as _metadata_package_version
785
- TYPEGUARD_MAJOR_VERSION = int(_metadata_package_version('typeguard').split('.')[0])
786
-
787
- def check_type(argname: str, value: object, expected_type: typing.Any) -> typing.Any:
788
- if TYPEGUARD_MAJOR_VERSION <= 2:
789
- return typeguard.check_type(argname=argname, value=value, expected_type=expected_type) # type:ignore
790
- else:
791
- if isinstance(value, jsii._reference_map.InterfaceDynamicProxy): # pyright: ignore [reportAttributeAccessIssue]
792
- pass
793
- else:
794
- if TYPEGUARD_MAJOR_VERSION == 3:
795
- typeguard.config.collection_check_strategy = typeguard.CollectionCheckStrategy.ALL_ITEMS # type:ignore
796
- typeguard.check_type(value=value, expected_type=expected_type) # type:ignore
797
- else:
798
- typeguard.check_type(value=value, expected_type=expected_type, collection_check_strategy=typeguard.CollectionCheckStrategy.ALL_ITEMS) # type:ignore
780
+ from jsii._type_checking import check_type
781
+
799
782
 
800
783
  from ._jsii import *
801
784
 
802
- import aws_cdk as _aws_cdk_ceddda9d
803
- import aws_cdk.aws_ecs as _aws_cdk_aws_ecs_ceddda9d
804
- import aws_cdk.aws_lambda as _aws_cdk_aws_lambda_ceddda9d
805
- import aws_cdk.aws_logs as _aws_cdk_aws_logs_ceddda9d
806
- import aws_cdk.aws_secretsmanager as _aws_cdk_aws_secretsmanager_ceddda9d
807
- import aws_cdk.aws_stepfunctions as _aws_cdk_aws_stepfunctions_ceddda9d
808
- import constructs as _constructs_77d1e7e8
785
+ class _LazyImport:
786
+ def __init__(self, module_name: str) -> None:
787
+ self._module_name = module_name
788
+ self._module: typing.Any = None
789
+ def __getattr__(self, name: str) -> typing.Any:
790
+ if self._module is None:
791
+ import importlib
792
+ self._module = importlib.import_module(self._module_name)
793
+ return getattr(self._module, name)
794
+
795
+ if typing.TYPE_CHECKING:
796
+
797
+ import aws_cdk as _aws_cdk_ceddda9d
798
+ import aws_cdk.aws_ecs as _aws_cdk_aws_ecs_ceddda9d
799
+ import aws_cdk.aws_lambda as _aws_cdk_aws_lambda_ceddda9d
800
+ import aws_cdk.aws_logs as _aws_cdk_aws_logs_ceddda9d
801
+ import aws_cdk.aws_secretsmanager as _aws_cdk_aws_secretsmanager_ceddda9d
802
+ import aws_cdk.aws_stepfunctions as _aws_cdk_aws_stepfunctions_ceddda9d
803
+ import constructs as _constructs_77d1e7e8
804
+ else:
805
+
806
+ _aws_cdk_aws_ecs_ceddda9d = _LazyImport("aws_cdk.aws_ecs")
807
+ _aws_cdk_aws_lambda_ceddda9d = _LazyImport("aws_cdk.aws_lambda")
808
+ _aws_cdk_aws_logs_ceddda9d = _LazyImport("aws_cdk.aws_logs")
809
+ _aws_cdk_aws_secretsmanager_ceddda9d = _LazyImport("aws_cdk.aws_secretsmanager")
810
+ _aws_cdk_aws_stepfunctions_ceddda9d = _LazyImport("aws_cdk.aws_stepfunctions")
811
+ _aws_cdk_ceddda9d = _LazyImport("aws_cdk")
812
+ _constructs_77d1e7e8 = _LazyImport("constructs")
809
813
 
810
814
 
811
815
  @jsii.data_type(
@@ -958,6 +962,44 @@ class DatadogAppSecMode(enum.Enum):
958
962
  '''
959
963
 
960
964
 
965
+ class DatadogDefaultLayerVersions(
966
+ metaclass=jsii.JSIIMeta,
967
+ jsii_type="datadog-cdk-constructs-v2.DatadogDefaultLayerVersions",
968
+ ):
969
+ def __init__(self) -> None:
970
+ jsii.create(self.__class__, self, [])
971
+
972
+ @jsii.python.classproperty
973
+ @jsii.member(jsii_name="DOTNET")
974
+ def DOTNET(cls) -> jsii.Number:
975
+ return typing.cast(jsii.Number, jsii.sget(cls, "DOTNET"))
976
+
977
+ @jsii.python.classproperty
978
+ @jsii.member(jsii_name="EXTENSION")
979
+ def EXTENSION(cls) -> jsii.Number:
980
+ return typing.cast(jsii.Number, jsii.sget(cls, "EXTENSION"))
981
+
982
+ @jsii.python.classproperty
983
+ @jsii.member(jsii_name="JAVA")
984
+ def JAVA(cls) -> jsii.Number:
985
+ return typing.cast(jsii.Number, jsii.sget(cls, "JAVA"))
986
+
987
+ @jsii.python.classproperty
988
+ @jsii.member(jsii_name="NODE")
989
+ def NODE(cls) -> jsii.Number:
990
+ return typing.cast(jsii.Number, jsii.sget(cls, "NODE"))
991
+
992
+ @jsii.python.classproperty
993
+ @jsii.member(jsii_name="PYTHON")
994
+ def PYTHON(cls) -> jsii.Number:
995
+ return typing.cast(jsii.Number, jsii.sget(cls, "PYTHON"))
996
+
997
+ @jsii.python.classproperty
998
+ @jsii.member(jsii_name="RUBY")
999
+ def RUBY(cls) -> jsii.Number:
1000
+ return typing.cast(jsii.Number, jsii.sget(cls, "RUBY"))
1001
+
1002
+
961
1003
  @jsii.data_type(
962
1004
  jsii_type="datadog-cdk-constructs-v2.DatadogECSBaseProps",
963
1005
  jsii_struct_bases=[],
@@ -4512,6 +4554,7 @@ __all__ = [
4512
4554
  "CWSFeatureConfig",
4513
4555
  "Cardinality",
4514
4556
  "DatadogAppSecMode",
4557
+ "DatadogDefaultLayerVersions",
4515
4558
  "DatadogECSBaseProps",
4516
4559
  "DatadogECSFargate",
4517
4560
  "DatadogECSFargateProps",
@@ -0,0 +1,31 @@
1
+ from pkgutil import extend_path
2
+ __path__ = extend_path(__path__, __name__)
3
+
4
+ import abc
5
+ import builtins
6
+ import datetime
7
+ import enum
8
+ import typing
9
+
10
+ import jsii
11
+ import publication
12
+ import typing_extensions
13
+
14
+ from jsii._type_checking import check_type
15
+
16
+
17
+ import aws_cdk._jsii
18
+ import constructs._jsii
19
+
20
+ __jsii_assembly__ = jsii.JSIIAssembly.load(
21
+ "datadog-cdk-constructs-v2",
22
+ "4.2.0",
23
+ __name__[0:-6],
24
+ "datadog-cdk-constructs-v2@4.2.0.jsii.tgz",
25
+ )
26
+
27
+ __all__ = [
28
+ "__jsii_assembly__",
29
+ ]
30
+
31
+ publication.publish()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: datadog-cdk-constructs-v2
3
- Version: 4.0.0
3
+ Version: 4.2.0
4
4
  Summary: CDK Construct Library to automatically instrument Python and Node Lambda functions with Datadog using AWS CDK v2
5
5
  Home-page: https://github.com/DataDog/datadog-cdk-constructs
6
6
  Author: Datadog
@@ -10,21 +10,22 @@ Classifier: Intended Audience :: Developers
10
10
  Classifier: Operating System :: OS Independent
11
11
  Classifier: Programming Language :: JavaScript
12
12
  Classifier: Programming Language :: Python :: 3 :: Only
13
- Classifier: Programming Language :: Python :: 3.9
14
13
  Classifier: Programming Language :: Python :: 3.10
15
14
  Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
16
18
  Classifier: Typing :: Typed
17
19
  Classifier: Development Status :: 5 - Production/Stable
18
20
  Classifier: License :: OSI Approved
19
- Requires-Python: ~=3.9
21
+ Requires-Python: >=3.10
20
22
  Description-Content-Type: text/markdown
21
23
  License-File: LICENSE
22
24
  License-File: NOTICE
23
- Requires-Dist: aws-cdk-lib<3.0.0,>=2.253.0
25
+ Requires-Dist: aws-cdk-lib<3.0.0,>=2.257.0
24
26
  Requires-Dist: constructs<11.0.0,>=10.5.1
25
- Requires-Dist: jsii<2.0.0,>=1.128.0
27
+ Requires-Dist: jsii<2.0.0,>=1.136.0
26
28
  Requires-Dist: publication>=0.0.3
27
- Requires-Dist: typeguard==2.13.3
28
29
 
29
30
  # Datadog CDK Constructs
30
31
 
@@ -93,16 +94,13 @@ Add this to your CDK stack:
93
94
  #### TypeScript
94
95
 
95
96
  ```python
96
- import { DatadogLambda } from "datadog-cdk-constructs-v2";
97
+ import { DatadogLambda, DatadogDefaultLayerVersions } from "datadog-cdk-constructs-v2";
97
98
 
98
99
  const datadogLambda = new DatadogLambda(this, "datadogLambda", {
99
- nodeLayerVersion: <LAYER_VERSION>,
100
- pythonLayerVersion: <LAYER_VERSION>,
101
- javaLayerVersion: <LAYER_VERSION>,
102
- dotnetLayerVersion: <LAYER_VERSION>,
103
- rubyLayerVersion: <LAYER_VERSION>,
100
+ // Lambda library layer versions are optional; they default to the latest
101
+ // version bundled with this construct. Set them to pin a specific version.
104
102
  addLayers: <BOOLEAN>,
105
- extensionLayerVersion: <EXTENSION_VERSION>,
103
+ extensionLayerVersion: DatadogDefaultLayerVersions.EXTENSION,
106
104
  forwarderArn: "<FORWARDER_ARN>",
107
105
  createForwarderPermissions: <BOOLEAN>,
108
106
  flushMetricsToLogs: <BOOLEAN>,
@@ -128,16 +126,13 @@ datadogLambda.addForwarderToNonLambdaLogGroups([<LOG_GROUPS>])
128
126
  #### Python
129
127
 
130
128
  ```python
131
- from datadog_cdk_constructs_v2 import DatadogLambda
129
+ from datadog_cdk_constructs_v2 import DatadogLambda, DatadogDefaultLayerVersions
132
130
  datadog = DatadogLambda(
133
131
  self,
134
132
  "Datadog",
135
- dotnet_layer_version=<LAYER_VERSION>,
136
- node_layer_version=<LAYER_VERSION>,
137
- python_layer_version=<LAYER_VERSION>,
138
- ruby_layer_version=<LAYER_VERSION>,
139
- java_layer_version=<LAYER_VERSION>,
140
- extension_layer_version=<EXTENSION_VERSION>,
133
+ # Lambda library layer versions are optional; they default to the latest
134
+ # version bundled with this construct. Set them to pin a specific version.
135
+ extension_layer_version=DatadogDefaultLayerVersions.EXTENSION,
141
136
  add_layers=<BOOLEAN>,
142
137
  api_key=os.getenv("DD_API_KEY"),
143
138
  site=<SITE>,
@@ -156,11 +151,9 @@ datadogLambda := ddcdkconstruct.NewDatadogLambda(
156
151
  stack,
157
152
  jsii.String("Datadog"),
158
153
  &ddcdkconstruct.DatadogLambdaProps{
159
- NodeLayerVersion: jsii.Number(<LAYER_VERSION>),
160
- PythonLayerVersion: jsii.Number(<LAYER_VERSION>),
161
- JavaLayerVersion: jsii.Number(<LAYER_VERSION>),
162
- DotnetLayerVersion: jsii.Number(<LAYER_VERSION>),
163
- RubyLayerVersion: jsii.Number(<LAYER_VERSION>),
154
+ // Lambda library layer versions are optional; they default to the latest
155
+ // version bundled with this construct. Set them to pin a specific version.
156
+ ExtensionLayerVersion: ddcdkconstruct.DatadogDefaultLayerVersions_EXTENSION(),
164
157
  AddLayers: jsii.Bool(<BOOLEAN>),
165
158
  Site: jsii.String(<SITE>),
166
159
  ApiKey: jsii.String(os.Getenv("DD_API_KEY")),
@@ -175,16 +168,14 @@ datadogLambda.AddForwarderToNonLambdaLogGroups()
175
168
  ```java
176
169
  import com.datadoghq.cdkconstructs.DatadogLambda;
177
170
  import com.datadoghq.cdkconstructs.DatadogLambdaProps;
171
+ import com.datadoghq.cdkconstructs.DatadogDefaultLayerVersions;
178
172
 
179
173
  DatadogLambda datadogLambda = new DatadogLambda(this, "Datadog",
180
174
  DatadogLambdaProps.builder()
181
- .nodeLayerVersion(<LAYER_VERSION>)
182
- .pythonLayerVersion(<LAYER_VERSION>)
183
- .javaLayerVersion(<LAYER_VERSION>)
184
- .dotnetLayerVersion(<LAYER_VERSION>)
185
- .rubyLayerVersion(<LAYER_VERSION>)
175
+ // Lambda library layer versions are optional; they default to the latest
176
+ // version bundled with this construct. Set them to pin a specific version.
186
177
  .addLayers(<BOOLEAN>)
187
- .extensionLayerVersion(<EXTENSION_VERSION>)
178
+ .extensionLayerVersion(DatadogDefaultLayerVersions.EXTENSION)
188
179
  .flushMetricsToLogs(<BOOLEAN>)
189
180
  .site("<SITE>")
190
181
  .apiKey(System.getenv("DD_API_KEY"))
@@ -271,21 +262,21 @@ To further configure your DatadogLambda construct for Lambda, use the following
271
262
 
272
263
  | npm package parameter | PyPI package parameter | Description |
273
264
  | ---------------------------- | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
274
- | `addLayers` | `add_layers` | Whether to add the runtime Lambda Layers or expect the user to bring their own. Defaults to `true`. When `true`, the Lambda Library version variables are also required. When `false`, you must include the Datadog Lambda library in your functions' deployment packages. |
275
- | `pythonLayerVersion` | `python_layer_version` | Version of the Python Lambda layer to install, such as `122`. Required if you are deploying at least one Lambda function written in Python and `addLayers` is `true`. Find the latest version number [here](https://github.com/DataDog/datadog-lambda-python/releases). **Warning**: This parameter and `pythonLayerArn` are mutually exclusive. If used, only set one or the other. |
265
+ | `addLayers` | `add_layers` | Whether to add the runtime Lambda Layers or expect the user to bring their own. Defaults to `true`. When `false`, you must include the Datadog Lambda library in your functions' deployment packages. |
266
+ | `pythonLayerVersion` | `python_layer_version` | Version of the Python Lambda layer to install, such as `122`. Optional: Defaults to the latest version bundled with this construct (`DatadogDefaultLayerVersions.PYTHON`). Set this to pin a specific version. Find the latest version number [here](https://github.com/DataDog/datadog-lambda-python/releases). **Warning**: This parameter and `pythonLayerArn` are mutually exclusive. If used, only set one or the other. |
276
267
  | `pythonLayerArn` | `python_layer_arn` | The custom ARN of the Python Lambda layer to install. Required if you are deploying at least one Lambda function written in Python and `addLayers` is `true`. **Warning**: This parameter and `pythonLayerVersion` are mutually exclusive. If used, only set one or the other. |
277
- | `nodeLayerVersion` | `node_layer_version` | Version of the Node.js Lambda layer to install, such as `133`. Required if you are deploying at least one Lambda function written in Node.js and `addLayers` is `true`. Find the latest version number from [here](https://github.com/DataDog/datadog-lambda-js/releases). **Warning**: This parameter and `nodeLayerArn` are mutually exclusive. If used, only set one or the other. |
268
+ | `nodeLayerVersion` | `node_layer_version` | Version of the Node.js Lambda layer to install, such as `133`. Optional: Defaults to the latest version bundled with this construct (`DatadogDefaultLayerVersions.NODE`). Set this to pin a specific version. Find the latest version number from [here](https://github.com/DataDog/datadog-lambda-js/releases). **Warning**: This parameter and `nodeLayerArn` are mutually exclusive. If used, only set one or the other. |
278
269
  | `nodeLayerArn` | `node_layer_arn` | The custom ARN of the Node.js Lambda layer to install. Required if you are deploying at least one Lambda function written in Node.js and `addLayers` is `true`. **Warning**: This parameter and `nodeLayerVersion` are mutually exclusive. If used, only set one or the other. |
279
- | `javaLayerVersion` | `java_layer_version` | Version of the Java layer to install, such as `25`. Required if you are deploying at least one Lambda function written in Java and `addLayers` is `true`. Find the latest version number [here](https://github.com/DataDog/datadog-lambda-java/releases). **Note**: `extensionLayerVersion >= 25` and `javaLayerVersion >= 5` are required for the DatadogLambda construct to instrument your Java functions properly. **Warning**: This parameter and `javaLayerArn` are mutually exclusive. If used, only set one or the other. |
270
+ | `javaLayerVersion` | `java_layer_version` | Version of the Java layer to install, such as `25`. Optional: Defaults to the latest version bundled with this construct (`DatadogDefaultLayerVersions.JAVA`). Set this to pin a specific version. Find the latest version number [here](https://github.com/DataDog/datadog-lambda-java/releases). **Note**: `extensionLayerVersion >= 25` and `javaLayerVersion >= 5` are required for the DatadogLambda construct to instrument your Java functions properly. **Warning**: This parameter and `javaLayerArn` are mutually exclusive. If used, only set one or the other. |
280
271
  | `javaLayerArn` | `java_layer_arn` | The custom ARN of the Java layer to install. Required if you are deploying at least one Lambda function written in Java and `addLayers` is `true`. **Warning**: This parameter and `javaLayerVersion` are mutually exclusive. If used, only set one or the other. |
281
- | `dotnetLayerVersion` | `dotnet_layer_version` | Version of the .NET layer to install, such as `23`. Required if you are deploying at least one Lambda function written in .NET and `addLayers` is `true`. Find the latest version number from [here](https://github.com/DataDog/dd-trace-dotnet-aws-lambda-layer/releases). **Warning**: This parameter and `dotnetLayerArn` are mutually exclusive. If used, only set one or the other. |
272
+ | `dotnetLayerVersion` | `dotnet_layer_version` | Version of the .NET layer to install, such as `23`. Optional: Defaults to the latest version bundled with this construct (`DatadogDefaultLayerVersions.DOTNET`). Set this to pin a specific version. Find the latest version number from [here](https://github.com/DataDog/dd-trace-dotnet-aws-lambda-layer/releases). **Warning**: This parameter and `dotnetLayerArn` are mutually exclusive. If used, only set one or the other. |
282
273
  | `dotnetLayerArn` | `dotnet_layer_arn` | The custom ARN of the .NET layer to install. Required if you are deploying at least one Lambda function written in .NET and `addLayers` is `true`. **Warning**: This parameter and `dotnetLayerVersion` are mutually exclusive. If used, only set one or the other. . |
283
274
  | `extensionLayerVersion` | `extension_layer_version` | Version of the Datadog Lambda Extension layer to install, such as `92`. When `extensionLayerVersion` is set, `apiKey` (or if encrypted, `apiKMSKey`, `apiKeySecret`, or `apiKeySecretArn`) needs to be set as well. When enabled, lambda function log groups will not be subscribed by the forwarder. Learn more about the Lambda extension [here](https://docs.datadoghq.com/serverless/datadog_lambda_library/extension/) and get the [latest version](https://github.com/DataDog/datadog-lambda-extension/releases). **Warning**: This parameter and `extensionVersionArn` are mutually exclusive. Set only one or the other. **Note**: If this parameter is set, it adds a layer even if `addLayers` is set to `false`. |
284
275
  | `extensionLayerArn` | `extension_layer_arn` | The custom ARN of the Datadog Lambda Extension layer to install. When `extensionLayerArn` is set, `apiKey` (or if encrypted, `apiKMSKey`, `apiKeySecret`, or `apiKeySecretArn`) needs to be set as well. When enabled, lambda function log groups are not subscribed by the forwarder. Learn more about the Lambda extension [here](https://docs.datadoghq.com/serverless/datadog_lambda_library/extension/) and get the [latest version](https://github.com/DataDog/datadog-lambda-extension/releases). **Warning**: This parameter and`extensionLayerVersion` are mutually exclusive. If used, only set one or the other. **Note**: If this parameter is set, it adds a layer even if `addLayers` is set to `false`. |
285
276
  | `forwarderArn` | `forwarder_arn` | When set, the plugin automatically subscribes the Datadog Forwarder to the functions' log groups. Do not set `forwarderArn` when `extensionLayerVersion` or `extensionLayerArn` is set. |
286
277
  | `createForwarderPermissions` | `createForwarderPermissions` | When set to `true`, creates a Lambda permission on the the Datadog Forwarder per log group. Since the Datadog Forwarder has permissions configured by default, this is unnecessary in most use cases. |
287
278
  | `flushMetricsToLogs` | `flush_metrics_to_logs` | Send custom metrics using CloudWatch logs with the Datadog Forwarder Lambda function (recommended). Defaults to `true` . If you disable this parameter, it's required to set `apiKey` (or if encrypted, `apiKMSKey`, `apiKeySecret`, or `apiKeySecretArn`). |
288
- | `site` | `site` | Set which Datadog site to send data. This is only used when `flushMetricsToLogs` is `false` or `extensionLayerVersion` or `extensionLayerArn` is set. Possible values are `datadoghq.com`, `datadoghq.eu`, `us3.datadoghq.com`, `us5.datadoghq.com`, `ap1.datadoghq.com`, `ap2.datadoghq.com`, `ddog-gov.com`, and `us2.ddog-gov.com`. The default is `datadoghq.com`. |
279
+ | `site` | `site` | Set which Datadog site to send data. This is only used when `flushMetricsToLogs` is `false` or `extensionLayerVersion` or `extensionLayerArn` is set. Possible values are `datadoghq.com`, `datadoghq.eu`, `us3.datadoghq.com`, `us5.datadoghq.com`, `ap1.datadoghq.com`, `ap2.datadoghq.com`, `uk1.datadoghq.com`, `ddog-gov.com`, and `us2.ddog-gov.com`. The default is `datadoghq.com`. |
289
280
  | `apiKey` | `api_key` | Datadog API Key, only needed when `flushMetricsToLogs` is `false` or `extensionLayerVersion` or `extensionLayerArn` is set. For more information about getting a Datadog API key, see the [API key documentation](https://docs.datadoghq.com/account_management/api-app-keys/#api-keys). |
290
281
  | `apiKeySecretArn` | `api_key_secret_arn` | The ARN of the secret storing the Datadog API key in AWS Secrets Manager. Use this parameter in place of `apiKey` when `flushMetricsToLogs` is `false` or `extensionLayer` is set. Remember to add the `secretsmanager:GetSecretValue` permission to the Lambda execution role. |
291
282
  | `apiKeySsmArn` | `api_key_ssm_arn` | The ARN of the parameter storing the Datadog API key in AWS Systems Manager Parameter Store (for example, `arn:aws:ssm:us-east-1:123456789012:parameter/my/parameter/name`). Use this parameter in place of `apiKey` when `flushMetricsToLogs` is `false` or `extensionLayer` is set. Supports both `String` and `SecureString` parameter types. When `grantSecretReadAccess` is `true` (default), the construct automatically grants `ssm:GetParameter` and `kms:Decrypt` (for the AWS managed key `alias/aws/ssm`) permissions. If using a custom KMS key for SecureString encryption, you must grant `kms:Decrypt` permission for that key separately. |
@@ -318,6 +309,19 @@ To further configure your DatadogLambda construct for Lambda, use the following
318
309
  | `llmObsMlApp` | `llm_obs_ml_app` | The name of your LLM application, service, or project, under which all traces and spans are grouped. This helps distinguish between different applications or experiments. See [Application naming guidelines](https://docs.datadoghq.com/llm_observability/sdk/?tab=nodejs#application-naming-guidelines) for allowed characters and other constraints. To override this value for a given root span, see [Tracing multiple applications](https://docs.datadoghq.com/llm_observability/sdk/?tab=nodejs#tracing-multiple-applications). Required if `llmObsEnabled` is `true` |
319
310
  | `llmObsAgentlessEnabled` | `llm_obs_agentless_enabled` | Only required if you are not using the Datadog Lambda Extension, in which case this should be set to `true`. Defaults to `false`. |
320
311
 
312
+ #### Default layer versions
313
+
314
+ When you don't pass a `*LayerVersion` or `*LayerArn`, the construct uses a default layer version bundled with the package. These defaults track the latest released Datadog Lambda layers at the time the construct version was published, and are exposed via the `DatadogDefaultLayerVersions` class so you can reference them directly in any language:
315
+
316
+ ```python
317
+ import { DatadogDefaultLayerVersions } from "datadog-cdk-constructs-v2";
318
+
319
+ DatadogDefaultLayerVersions.NODE;
320
+ DatadogDefaultLayerVersions.EXTENSION;
321
+ ```
322
+
323
+ Available members: `NODE`, `PYTHON`, `JAVA`, `DOTNET`, `RUBY`, and `EXTENSION`. To pin a specific version, set the corresponding `*LayerVersion` prop. The extension layer is still only applied when `extensionLayerVersion` or `extensionLayerArn` is set.
324
+
321
325
  #### Tracing
322
326
 
323
327
  Enable X-Ray Tracing on your Lambda functions. For more information, see [CDK documentation](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.Tracing.html).
@@ -348,10 +352,6 @@ class RootStack extends cdk.Stack {
348
352
  new NestedStack(this, "NestedStack");
349
353
 
350
354
  const datadogLambda = new DatadogLambda(this, "DatadogLambda", {
351
- nodeLayerVersion: <LAYER_VERSION>,
352
- pythonLayerVersion: <LAYER_VERSION>,
353
- javaLayerVersion: <LAYER_VERSION>,
354
- dotnetLayerVersion: <LAYER-VERSION>,
355
355
  addLayers: <BOOLEAN>,
356
356
  forwarderArn: "<FORWARDER_ARN>",
357
357
  flushMetricsToLogs: <BOOLEAN>,
@@ -374,10 +374,6 @@ class NestedStack extends cdk.NestedStack {
374
374
  super(scope, id, props);
375
375
 
376
376
  const datadogLambda = new DatadogLambda(this, "DatadogLambda", {
377
- nodeLayerVersion: <LAYER_VERSION>,
378
- pythonLayerVersion: <LAYER_VERSION>,
379
- javaLayerVersion: <LAYER_VERSION>,
380
- dotnetLayerVersion: <LAYER-VERSION>,
381
377
  addLayers: <BOOLEAN>,
382
378
  forwarderArn: "<FORWARDER_ARN>",
383
379
  flushMetricsToLogs: <BOOLEAN>,
@@ -792,4 +788,4 @@ For product feedback and questions, join the `#serverless` channel in the [Datad
792
788
 
793
789
  Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
794
790
 
795
- This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc.
791
+ This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2020-2026 Datadog, Inc.
@@ -12,4 +12,4 @@ src/datadog_cdk_constructs_v2.egg-info/dependency_links.txt
12
12
  src/datadog_cdk_constructs_v2.egg-info/requires.txt
13
13
  src/datadog_cdk_constructs_v2.egg-info/top_level.txt
14
14
  src/datadog_cdk_constructs_v2/_jsii/__init__.py
15
- src/datadog_cdk_constructs_v2/_jsii/datadog-cdk-constructs-v2@4.0.0.jsii.tgz
15
+ src/datadog_cdk_constructs_v2/_jsii/datadog-cdk-constructs-v2@4.2.0.jsii.tgz
@@ -0,0 +1,4 @@
1
+ aws-cdk-lib<3.0.0,>=2.257.0
2
+ constructs<11.0.0,>=10.5.1
3
+ jsii<2.0.0,>=1.136.0
4
+ publication>=0.0.3
@@ -1,45 +0,0 @@
1
- from pkgutil import extend_path
2
- __path__ = extend_path(__path__, __name__)
3
-
4
- import abc
5
- import builtins
6
- import datetime
7
- import enum
8
- import typing
9
-
10
- import jsii
11
- import publication
12
- import typing_extensions
13
-
14
- import typeguard
15
- from importlib.metadata import version as _metadata_package_version
16
- TYPEGUARD_MAJOR_VERSION = int(_metadata_package_version('typeguard').split('.')[0])
17
-
18
- def check_type(argname: str, value: object, expected_type: typing.Any) -> typing.Any:
19
- if TYPEGUARD_MAJOR_VERSION <= 2:
20
- return typeguard.check_type(argname=argname, value=value, expected_type=expected_type) # type:ignore
21
- else:
22
- if isinstance(value, jsii._reference_map.InterfaceDynamicProxy): # pyright: ignore [reportAttributeAccessIssue]
23
- pass
24
- else:
25
- if TYPEGUARD_MAJOR_VERSION == 3:
26
- typeguard.config.collection_check_strategy = typeguard.CollectionCheckStrategy.ALL_ITEMS # type:ignore
27
- typeguard.check_type(value=value, expected_type=expected_type) # type:ignore
28
- else:
29
- typeguard.check_type(value=value, expected_type=expected_type, collection_check_strategy=typeguard.CollectionCheckStrategy.ALL_ITEMS) # type:ignore
30
-
31
- import aws_cdk._jsii
32
- import constructs._jsii
33
-
34
- __jsii_assembly__ = jsii.JSIIAssembly.load(
35
- "datadog-cdk-constructs-v2",
36
- "4.0.0",
37
- __name__[0:-6],
38
- "datadog-cdk-constructs-v2@4.0.0.jsii.tgz",
39
- )
40
-
41
- __all__ = [
42
- "__jsii_assembly__",
43
- ]
44
-
45
- publication.publish()
@@ -1,5 +0,0 @@
1
- aws-cdk-lib<3.0.0,>=2.253.0
2
- constructs<11.0.0,>=10.5.1
3
- jsii<2.0.0,>=1.128.0
4
- publication>=0.0.3
5
- typeguard==2.13.3