From a890140f17a910d7a479b888bacea56b641b7e61 Mon Sep 17 00:00:00 2001 From: Ian Botsford <83236726+ianbotsf@users.noreply.github.com> Date: Fri, 31 Jan 2025 18:45:54 +0000 Subject: [PATCH] chore: emit success or failure metrics for the release artifact collection job --- .github/workflows/codebuild-ci.yml | 12 ++++++++++ .../artifact-metrics-collection-failure.json | 24 +++++++++++++++++++ .../artifact-metrics-collection-success.json | 24 +++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 .github/workflows/resources/artifact-metrics-collection-failure.json create mode 100644 .github/workflows/resources/artifact-metrics-collection-success.json diff --git a/.github/workflows/codebuild-ci.yml b/.github/workflows/codebuild-ci.yml index 71c54146f91..e37048104ec 100644 --- a/.github/workflows/codebuild-ci.yml +++ b/.github/workflows/codebuild-ci.yml @@ -237,3 +237,15 @@ jobs: run: ./gradlew saveArtifactSizeMetrics -Prelease=${{ github.event.release.tag_name }} - name: Put Artifact Size Metrics in CloudWatch run: ./gradlew putArtifactSizeMetricsInCloudWatch -Prelease=${{ github.event.release.tag_name }} + - name: Emit success metric + if: ${{ success() }} + run: | + echo "::error ::Failed to collect and emit release artifact size metrics. Attempting to emit error metric to" + echo "::error ::CloudWatch..." + aws cloudwatch put-metric-data --namespace "Artifact Metrics" --metric-data file://./resources/artifact-metrics-collection-success.json + - name: Emit failure metric + if: ${{ failure() }} + run: | + echo "::error ::Failed to collect and emit release artifact size metrics. Attempting to emit error metric to" + echo "::error ::CloudWatch..." + aws cloudwatch put-metric-data --namespace "Artifact Metrics" --metric-data file://./resources/artifact-metrics-collection-failure.json diff --git a/.github/workflows/resources/artifact-metrics-collection-failure.json b/.github/workflows/resources/artifact-metrics-collection-failure.json new file mode 100644 index 00000000000..edcef47bde2 --- /dev/null +++ b/.github/workflows/resources/artifact-metrics-collection-failure.json @@ -0,0 +1,24 @@ +[ + { + "Dimensions": [ + { + "Name": "Project", + "Value": "aws-sdk-kotlin" + } + ], + "MetricName": "CollectionsAttempted", + "Unit": "Count", + "Value": 1 + }, + { + "Dimensions": [ + { + "Name": "Project", + "Value": "aws-sdk-kotlin" + } + ], + "MetricName": "CollectionsFailed", + "Unit": "Count", + "Value": 1 + } +] diff --git a/.github/workflows/resources/artifact-metrics-collection-success.json b/.github/workflows/resources/artifact-metrics-collection-success.json new file mode 100644 index 00000000000..561a79287a2 --- /dev/null +++ b/.github/workflows/resources/artifact-metrics-collection-success.json @@ -0,0 +1,24 @@ +[ + { + "Dimensions": [ + { + "Name": "Project", + "Value": "aws-sdk-kotlin" + } + ], + "MetricName": "CollectionsAttempted", + "Unit": "Count", + "Value": 1 + }, + { + "Dimensions": [ + { + "Name": "Project", + "Value": "aws-sdk-kotlin" + } + ], + "MetricName": "CollectionsSucceeded", + "Unit": "Count", + "Value": 1 + } +]