Skip to content

Commit

Permalink
feat: cloudwatch metrics tags (#4172)
Browse files Browse the repository at this point in the history
  • Loading branch information
heilhead authored Jan 26, 2024
1 parent 133673e commit 75a7761
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions packages/sign-client/test/shared/metrics.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { CloudWatch, PutMetricDataCommandInput } from "@aws-sdk/client-cloudwatch";

const tag = process.env.TAG || "default";

export const uploadCanaryResultsToCloudWatch = async (
env: string,
region: string,
Expand All @@ -23,6 +25,10 @@ export const uploadCanaryResultsToCloudWatch = async (
Name: "Region",
Value: region,
},
{
Name: "Tag",
Value: tag,
},
],
Unit: "Count",
Value: isTestPassed ? 1 : 0,
Expand All @@ -39,6 +45,10 @@ export const uploadCanaryResultsToCloudWatch = async (
Name: "Region",
Value: region,
},
{
Name: "Tag",
Value: tag,
},
],
Unit: "Count",
Value: isTestPassed ? 0 : 1,
Expand All @@ -58,6 +68,10 @@ export const uploadCanaryResultsToCloudWatch = async (
Name: "Region",
Value: region,
},
{
Name: "Tag",
Value: tag,
},
],
Unit: "Milliseconds",
Value: testDurationMs,
Expand All @@ -78,6 +92,10 @@ export const uploadCanaryResultsToCloudWatch = async (
Name: "Region",
Value: region,
},
{
Name: "Tag",
Value: tag,
},
],
Unit: "Milliseconds",
Value: metric[metricName],
Expand Down Expand Up @@ -124,6 +142,10 @@ export const uploadLoadTestConnectionDataToCloudWatch = async (
Name: "Target",
Value: target,
},
{
Name: "Tag",
Value: tag,
},
],
Unit: "Count",
Value: successfullyConnected,
Expand All @@ -136,6 +158,10 @@ export const uploadLoadTestConnectionDataToCloudWatch = async (
Name: "Target",
Value: target,
},
{
Name: "Tag",
Value: tag,
},
],
Unit: "Count",
Value: failedToConnect,
Expand All @@ -148,6 +174,10 @@ export const uploadLoadTestConnectionDataToCloudWatch = async (
Name: "Target",
Value: target,
},
{
Name: "Tag",
Value: tag,
},
],
Unit: "Milliseconds",
Value: averagePairingTimeMs,
Expand All @@ -160,6 +190,10 @@ export const uploadLoadTestConnectionDataToCloudWatch = async (
Name: "Target",
Value: target,
},
{
Name: "Tag",
Value: tag,
},
],
Unit: "Milliseconds",
Value: averageHandshakeTimeMs,
Expand Down

0 comments on commit 75a7761

Please sign in to comment.