Skip to content

Commit

Permalink
feat: Set DD_TRACE_ENABLED tag on state machine
Browse files Browse the repository at this point in the history
  • Loading branch information
lym953 committed Nov 25, 2024
1 parent 44e9dd0 commit 6e22a20
Show file tree
Hide file tree
Showing 6 changed files with 85 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_TRACE_ENABLED",
"Value": "true"
},
{
"Key": "env",
"Value": "dev"
Expand Down Expand Up @@ -112,6 +116,10 @@
"Key": "custom-tag-2",
"Value": "tag-value-2"
},
{
"Key": "DD_TRACE_ENABLED",
"Value": "true"
},
{
"Key": "env",
"Value": "dev"
Expand Down Expand Up @@ -150,6 +158,10 @@
"Key": "custom-tag-2",
"Value": "tag-value-2"
},
{
"Key": "DD_TRACE_ENABLED",
"Value": "true"
},
{
"Key": "env",
"Value": "dev"
Expand Down Expand Up @@ -292,6 +304,10 @@
"Key": "custom-tag-2",
"Value": "tag-value-2"
},
{
"Key": "DD_TRACE_ENABLED",
"Value": "true"
},
{
"Key": "env",
"Value": "dev"
Expand Down Expand Up @@ -439,6 +455,10 @@
"Key": "custom-tag-2",
"Value": "tag-value-2"
},
{
"Key": "DD_TRACE_ENABLED",
"Value": "true"
},
{
"Key": "env",
"Value": "dev"
Expand Down Expand Up @@ -477,6 +497,10 @@
"Key": "custom-tag-2",
"Value": "tag-value-2"
},
{
"Key": "DD_TRACE_ENABLED",
"Value": "true"
},
{
"Key": "env",
"Value": "dev"
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_TRACE_ENABLED",
"Value": "true"
},
{
"Key": "env",
"Value": "dev"
Expand Down Expand Up @@ -112,6 +116,10 @@
"Key": "custom-tag-2",
"Value": "tag-value-2"
},
{
"Key": "DD_TRACE_ENABLED",
"Value": "true"
},
{
"Key": "env",
"Value": "dev"
Expand Down Expand Up @@ -150,6 +158,10 @@
"Key": "custom-tag-2",
"Value": "tag-value-2"
},
{
"Key": "DD_TRACE_ENABLED",
"Value": "true"
},
{
"Key": "env",
"Value": "dev"
Expand Down Expand Up @@ -293,6 +305,10 @@
"Key": "custom-tag-2",
"Value": "tag-value-2"
},
{
"Key": "DD_TRACE_ENABLED",
"Value": "true"
},
{
"Key": "env",
"Value": "dev"
Expand Down Expand Up @@ -440,6 +456,10 @@
"Key": "custom-tag-2",
"Value": "tag-value-2"
},
{
"Key": "DD_TRACE_ENABLED",
"Value": "true"
},
{
"Key": "env",
"Value": "dev"
Expand Down Expand Up @@ -478,6 +498,10 @@
"Key": "custom-tag-2",
"Value": "tag-value-2"
},
{
"Key": "DD_TRACE_ENABLED",
"Value": "true"
},
{
"Key": "env",
"Value": "dev"
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_TRACE_ENABLED",
"Value": "true"
},
{
"Key": "env",
"Value": "dev"
Expand Down Expand Up @@ -120,6 +124,10 @@
"Key": "custom-tag-2",
"Value": "tag-value-2"
},
{
"Key": "DD_TRACE_ENABLED",
"Value": "true"
},
{
"Key": "env",
"Value": "dev"
Expand Down Expand Up @@ -158,6 +166,10 @@
"Key": "custom-tag-2",
"Value": "tag-value-2"
},
{
"Key": "DD_TRACE_ENABLED",
"Value": "true"
},
{
"Key": "env",
"Value": "dev"
Expand Down Expand Up @@ -338,6 +350,10 @@
"Key": "custom-tag-2",
"Value": "tag-value-2"
},
{
"Key": "DD_TRACE_ENABLED",
"Value": "true"
},
{
"Key": "env",
"Value": "dev"
Expand Down Expand Up @@ -485,6 +501,10 @@
"Key": "custom-tag-2",
"Value": "tag-value-2"
},
{
"Key": "DD_TRACE_ENABLED",
"Value": "true"
},
{
"Key": "env",
"Value": "dev"
Expand Down Expand Up @@ -523,6 +543,10 @@
"Key": "custom-tag-2",
"Value": "tag-value-2"
},
{
"Key": "DD_TRACE_ENABLED",
"Value": "true"
},
{
"Key": "env",
"Value": "dev"
Expand Down
1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export enum TagKeys {
ENV = "env",
SERVICE = "service",
VERSION = "version",
DD_TRACE_ENABLED = "DD_TRACE_ENABLED",
}

export const runtimeLookup: { [key: string]: RuntimeType } = {
Expand Down
8 changes: 8 additions & 0 deletions src/tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,12 @@ export function setTags(
}
});
}

if (resource instanceof sfn.StateMachine) {
setStepFunctionTags(resource);
}
}

function setStepFunctionTags(stateMachine: sfn.StateMachine) {
Tags.of(stateMachine).add(TagKeys.DD_TRACE_ENABLED, "true");
}
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_TRACE_ENABLED",
Value: "true",
},
{
Key: "env",
Value: "dev",
Expand Down

0 comments on commit 6e22a20

Please sign in to comment.