diff --git a/integration_tests/snapshots/correct-step-function-stack-snapshot.json b/integration_tests/snapshots/correct-step-function-stack-snapshot.json index 1f58d4e5..defc0ce7 100644 --- a/integration_tests/snapshots/correct-step-function-stack-snapshot.json +++ b/integration_tests/snapshots/correct-step-function-stack-snapshot.json @@ -24,6 +24,10 @@ "Key": "custom-tag-2", "Value": "tag-value-2" }, + { + "Key": "dd_cdk_construct", + "Value": "vX.XX.X" + }, { "Key": "DD_TRACE_ENABLED", "Value": "true" @@ -116,6 +120,10 @@ "Key": "custom-tag-2", "Value": "tag-value-2" }, + { + "Key": "dd_cdk_construct", + "Value": "vX.XX.X" + }, { "Key": "DD_TRACE_ENABLED", "Value": "true" @@ -158,6 +166,10 @@ "Key": "custom-tag-2", "Value": "tag-value-2" }, + { + "Key": "dd_cdk_construct", + "Value": "vX.XX.X" + }, { "Key": "DD_TRACE_ENABLED", "Value": "true" @@ -304,6 +316,10 @@ "Key": "custom-tag-2", "Value": "tag-value-2" }, + { + "Key": "dd_cdk_construct", + "Value": "vX.XX.X" + }, { "Key": "DD_TRACE_ENABLED", "Value": "true" @@ -455,6 +471,10 @@ "Key": "custom-tag-2", "Value": "tag-value-2" }, + { + "Key": "dd_cdk_construct", + "Value": "vX.XX.X" + }, { "Key": "DD_TRACE_ENABLED", "Value": "true" @@ -497,6 +517,10 @@ "Key": "custom-tag-2", "Value": "tag-value-2" }, + { + "Key": "dd_cdk_construct", + "Value": "vX.XX.X" + }, { "Key": "DD_TRACE_ENABLED", "Value": "true" diff --git a/integration_tests/snapshots/correct-step_functions_go_stack-snapshot.json b/integration_tests/snapshots/correct-step_functions_go_stack-snapshot.json index b5b29941..a39f903e 100644 --- a/integration_tests/snapshots/correct-step_functions_go_stack-snapshot.json +++ b/integration_tests/snapshots/correct-step_functions_go_stack-snapshot.json @@ -24,6 +24,10 @@ "Key": "custom-tag-2", "Value": "tag-value-2" }, + { + "Key": "dd_cdk_construct", + "Value": "vX.XX.X" + }, { "Key": "DD_TRACE_ENABLED", "Value": "true" @@ -116,6 +120,10 @@ "Key": "custom-tag-2", "Value": "tag-value-2" }, + { + "Key": "dd_cdk_construct", + "Value": "vX.XX.X" + }, { "Key": "DD_TRACE_ENABLED", "Value": "true" @@ -158,6 +166,10 @@ "Key": "custom-tag-2", "Value": "tag-value-2" }, + { + "Key": "dd_cdk_construct", + "Value": "vX.XX.X" + }, { "Key": "DD_TRACE_ENABLED", "Value": "true" @@ -305,6 +317,10 @@ "Key": "custom-tag-2", "Value": "tag-value-2" }, + { + "Key": "dd_cdk_construct", + "Value": "vX.XX.X" + }, { "Key": "DD_TRACE_ENABLED", "Value": "true" @@ -456,6 +472,10 @@ "Key": "custom-tag-2", "Value": "tag-value-2" }, + { + "Key": "dd_cdk_construct", + "Value": "vX.XX.X" + }, { "Key": "DD_TRACE_ENABLED", "Value": "true" @@ -498,6 +518,10 @@ "Key": "custom-tag-2", "Value": "tag-value-2" }, + { + "Key": "dd_cdk_construct", + "Value": "vX.XX.X" + }, { "Key": "DD_TRACE_ENABLED", "Value": "true" diff --git a/integration_tests/snapshots/correct-step_functions_python_stack-snapshot.json b/integration_tests/snapshots/correct-step_functions_python_stack-snapshot.json index 476365c7..b8cc39cf 100644 --- a/integration_tests/snapshots/correct-step_functions_python_stack-snapshot.json +++ b/integration_tests/snapshots/correct-step_functions_python_stack-snapshot.json @@ -32,6 +32,10 @@ "Key": "custom-tag-2", "Value": "tag-value-2" }, + { + "Key": "dd_cdk_construct", + "Value": "vX.XX.X" + }, { "Key": "DD_TRACE_ENABLED", "Value": "true" @@ -124,6 +128,10 @@ "Key": "custom-tag-2", "Value": "tag-value-2" }, + { + "Key": "dd_cdk_construct", + "Value": "vX.XX.X" + }, { "Key": "DD_TRACE_ENABLED", "Value": "true" @@ -166,6 +174,10 @@ "Key": "custom-tag-2", "Value": "tag-value-2" }, + { + "Key": "dd_cdk_construct", + "Value": "vX.XX.X" + }, { "Key": "DD_TRACE_ENABLED", "Value": "true" @@ -350,6 +362,10 @@ "Key": "custom-tag-2", "Value": "tag-value-2" }, + { + "Key": "dd_cdk_construct", + "Value": "vX.XX.X" + }, { "Key": "DD_TRACE_ENABLED", "Value": "true" @@ -501,6 +517,10 @@ "Key": "custom-tag-2", "Value": "tag-value-2" }, + { + "Key": "dd_cdk_construct", + "Value": "vX.XX.X" + }, { "Key": "DD_TRACE_ENABLED", "Value": "true" @@ -543,6 +563,10 @@ "Key": "custom-tag-2", "Value": "tag-value-2" }, + { + "Key": "dd_cdk_construct", + "Value": "vX.XX.X" + }, { "Key": "DD_TRACE_ENABLED", "Value": "true" diff --git a/src/tag.ts b/src/tag.ts index 251a7365..39cf70e1 100644 --- a/src/tag.ts +++ b/src/tag.ts @@ -12,6 +12,8 @@ import * as sfn from "aws-cdk-lib/aws-stepfunctions"; import log from "loglevel"; import { TagKeys, DatadogLambdaProps, DatadogStepFunctionsProps } from "./index"; +const versionJson = require("../version.json"); + export function setTags( resource: lambda.Function | sfn.StateMachine, props: DatadogLambdaProps | DatadogStepFunctionsProps, @@ -43,4 +45,5 @@ export function setTags( function setStepFunctionTags(stateMachine: sfn.StateMachine) { Tags.of(stateMachine).add(TagKeys.DD_TRACE_ENABLED, "true"); + Tags.of(stateMachine).add(TagKeys.CDK, `v${versionJson.version}`); } diff --git a/test/tags.spec.ts b/test/tags.spec.ts index 0a283e99..c0f03ebd 100644 --- a/test/tags.spec.ts +++ b/test/tags.spec.ts @@ -188,6 +188,10 @@ describe("setTags for Step Function", () => { Key: "custom-tag-2", Value: "tag-value-2", }, + { + Key: "dd_cdk_construct", + Value: `v${versionJson.version}`, + }, { Key: "DD_TRACE_ENABLED", Value: "true",