File tree 2 files changed +54
-0
lines changed
2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change 14
14
SAUCE_ACCESS_KEY : ${{secrets.SAUCE_ACCESS_KEY}}
15
15
MESSAGING_USER_ARN : ${{secrets.MESSAGING_USER_ARN}}
16
16
PRE_RUN_SCRIPT_URL : ${{secrets.PRE_RUN_SCRIPT_URL}}
17
+ METRIC_NAME : ${{ secrets.METRIC_NAME }}
18
+ METRIC_NAMESPACE : ${{ secrets.METRIC_NAMESPACE }}
17
19
18
20
permissions :
19
21
id-token : write # This is required for requesting the JWT
@@ -309,3 +311,28 @@ jobs:
309
311
run : npm install axios
310
312
- name : Send Slack Message
311
313
run : node .github/script/send-test-report.js ${{ secrets.SLACK_JS_SDK_DEV_CORE_PREV_VER_WEBHOOK }} ${{ env.WORKFLOW_URL}} ${{ env.WORKFLOW_JOBS_STATUS }}
314
+ - name : Send Metric to CloudWatch
315
+ if : always()
316
+ run : |
317
+ node -e "
318
+ const { CloudWatchClient, PutMetricDataCommand } = require('@aws-sdk/client-cloudwatch');
319
+ const client = new CloudWatchClient({ region: process.env.REGION });
320
+
321
+ const value = '${{ env.WORKFLOW_JOBS_STATUS }}' === 'failure' ? 0 : 1;
322
+
323
+ const command = new PutMetricDataCommand({
324
+ Namespace: process.env.METRIC_NAMESPACE,
325
+ MetricData: [{
326
+ MetricName: process.env.METRIC_NAME,
327
+ Dimensions: [
328
+ { Name: 'Platform', Value: 'JS SDK Daily PMV Compatibility' }
329
+ ],
330
+ Value: value,
331
+ }]
332
+ });
333
+
334
+ client.send(command).then(() => console.log('Daily test result sent to CloudWatch')).catch(err => {
335
+ console.error('Failed to send metric. Error: ', err);
336
+ process.exit(1);
337
+ });
338
+ ";
Original file line number Diff line number Diff line change 15
15
MESSAGING_USER_ARN : ${{secrets.MESSAGING_USER_ARN}}
16
16
SLACK_JS_SDK_DEV_CORE_WEBHOOK : ${{secrets.SLACK_JS_SDK_DEV_CORE_WEBHOOK}}
17
17
PRE_RUN_SCRIPT_URL : ${{secrets.PRE_RUN_SCRIPT_URL}}
18
+ METRIC_NAME : ${{ secrets.METRIC_NAME }}
19
+ METRIC_NAMESPACE : ${{ secrets.METRIC_NAMESPACE }}
18
20
19
21
permissions :
20
22
id-token : write # This is required for requesting the JWT
@@ -282,3 +284,28 @@ jobs:
282
284
run : npm install axios
283
285
- name : Send Slack Message
284
286
run : node .github/script/send-test-report.js ${{ secrets.SLACK_JS_SDK_DEV_CORE_WEBHOOK }} ${{ env.WORKFLOW_URL}} ${{ env.WORKFLOW_JOBS_STATUS }}
287
+ - name : Send Metric to CloudWatch
288
+ if : always()
289
+ run : |
290
+ node -e "
291
+ const { CloudWatchClient, PutMetricDataCommand } = require('@aws-sdk/client-cloudwatch');
292
+ const client = new CloudWatchClient({ region: process.env.REGION });
293
+
294
+ const value = '${{ env.WORKFLOW_JOBS_STATUS }}' === 'failure' ? 0 : 1;
295
+
296
+ const command = new PutMetricDataCommand({
297
+ Namespace: process.env.METRIC_NAMESPACE,
298
+ MetricData: [{
299
+ MetricName: process.env.METRIC_NAME,
300
+ Dimensions: [
301
+ { Name: 'Platform', Value: 'JS SDK Daily Compatibility' }
302
+ ],
303
+ Value: value,
304
+ }]
305
+ });
306
+
307
+ client.send(command).then(() => console.log('Daily test result sent to CloudWatch')).catch(err => {
308
+ console.error('Failed to send metric. Error: ', err);
309
+ process.exit(1);
310
+ });
311
+ ";
You can’t perform that action at this time.
0 commit comments