Skip to content

Commit a890140

Browse files
committed
chore: emit success or failure metrics for the release artifact collection job
1 parent 2e3860f commit a890140

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

.github/workflows/codebuild-ci.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,3 +237,15 @@ jobs:
237237
run: ./gradlew saveArtifactSizeMetrics -Prelease=${{ github.event.release.tag_name }}
238238
- name: Put Artifact Size Metrics in CloudWatch
239239
run: ./gradlew putArtifactSizeMetricsInCloudWatch -Prelease=${{ github.event.release.tag_name }}
240+
- name: Emit success metric
241+
if: ${{ success() }}
242+
run: |
243+
echo "::error ::Failed to collect and emit release artifact size metrics. Attempting to emit error metric to"
244+
echo "::error ::CloudWatch..."
245+
aws cloudwatch put-metric-data --namespace "Artifact Metrics" --metric-data file://./resources/artifact-metrics-collection-success.json
246+
- name: Emit failure metric
247+
if: ${{ failure() }}
248+
run: |
249+
echo "::error ::Failed to collect and emit release artifact size metrics. Attempting to emit error metric to"
250+
echo "::error ::CloudWatch..."
251+
aws cloudwatch put-metric-data --namespace "Artifact Metrics" --metric-data file://./resources/artifact-metrics-collection-failure.json
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[
2+
{
3+
"Dimensions": [
4+
{
5+
"Name": "Project",
6+
"Value": "aws-sdk-kotlin"
7+
}
8+
],
9+
"MetricName": "CollectionsAttempted",
10+
"Unit": "Count",
11+
"Value": 1
12+
},
13+
{
14+
"Dimensions": [
15+
{
16+
"Name": "Project",
17+
"Value": "aws-sdk-kotlin"
18+
}
19+
],
20+
"MetricName": "CollectionsFailed",
21+
"Unit": "Count",
22+
"Value": 1
23+
}
24+
]
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[
2+
{
3+
"Dimensions": [
4+
{
5+
"Name": "Project",
6+
"Value": "aws-sdk-kotlin"
7+
}
8+
],
9+
"MetricName": "CollectionsAttempted",
10+
"Unit": "Count",
11+
"Value": 1
12+
},
13+
{
14+
"Dimensions": [
15+
{
16+
"Name": "Project",
17+
"Value": "aws-sdk-kotlin"
18+
}
19+
],
20+
"MetricName": "CollectionsSucceeded",
21+
"Unit": "Count",
22+
"Value": 1
23+
}
24+
]

0 commit comments

Comments
 (0)