Skip to content

Commit

Permalink
feat: Set dd_cdk_construct version tag on state machine
Browse files Browse the repository at this point in the history
  • Loading branch information
lym953 committed Nov 26, 2024
1 parent 8fcf1e1 commit df9fb18
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions src/tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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}`);
}
4 changes: 4 additions & 0 deletions test/tags.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit df9fb18

Please sign in to comment.