Skip to content

Commit

Permalink
chore(metrics): always report env
Browse files Browse the repository at this point in the history
  • Loading branch information
yossi-eynav committed Feb 4, 2024
1 parent c1ee700 commit 73b6009
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ jobs:
AWS_ACCESS_KEY_ID=${{ secrets.SERVER_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY=${{ secrets.SERVER_AWS_SECRET_ACCESS_KEY }}
VERSION=${{github.sha}}
NODE_ENV=staging
- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@df9643053eda01f169e64a0e60233aacca83799a
with:
Expand Down Expand Up @@ -172,6 +173,7 @@ jobs:
VERSION=${{github.sha}}
AWS_ACCESS_KEY_ID=${{ secrets.SERVER_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY=${{ secrets.SERVER_AWS_SECRET_ACCESS_KEY }}
NODE_ENV=production
- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@df9643053eda01f169e64a0e60233aacca83799a
with:
Expand Down
3 changes: 2 additions & 1 deletion server/metrics.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

const { CloudWatchClient, PutMetricDataCommand } = require("@aws-sdk/client-cloudwatch"); // CommonJS import
const client = new CloudWatchClient();
const env = process.env.NODE_ENV

// [
// {
Expand All @@ -16,7 +17,7 @@ const report = async ({ metricName, unit = "None", value = 1.0, dims = [] }) =>
MetricData: [
{
MetricName: metricName,
Dimensions: dims,
Dimensions: [...dims, { Name: "environment", Value: env }],
Unit: unit,
Value: value,
},
Expand Down

0 comments on commit 73b6009

Please sign in to comment.