diff --git a/.github/workflows/workflow-metrics.yml b/.github/workflows/workflow-metrics.yml index bcf0e25..293997a 100644 --- a/.github/workflows/workflow-metrics.yml +++ b/.github/workflows/workflow-metrics.yml @@ -48,6 +48,7 @@ jobs: METRIC_NAMESPACE: ${{ inputs.namespace }} OS: ${{ inputs.os }} WORKFLOW_NAME: ${{ github.event.workflow_run.name }} + BRANCH: ${{ github.event.workflow_run.head_branch }} RESULT: ${{ github.event.workflow_run.conclusion }} RUN_STARTED_AT: ${{ github.event.workflow_run.run_started_at }} RUN_COMPLETED_AT: ${{ github.event.workflow_run.updated_at }} @@ -58,6 +59,7 @@ jobs: fi metric_data=$(jq -nc \ --arg workflow "$WORKFLOW_NAME" \ + --arg branch "$BRANCH" \ --arg result "${RESULT:-Unknown}" \ --arg os "$OS" \ --arg timestamp "$RUN_COMPLETED_AT" \ @@ -66,6 +68,7 @@ jobs: MetricName: "WorkflowRunDuration", Dimensions: [ {Name: "WorkflowName", Value: $workflow}, + {Name: "Branch", Value: $branch}, {Name: "Result", Value: $result}, {Name: "OS", Value: $os} ], diff --git a/README.md b/README.md index d359b09..c4dacd1 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,10 @@ The `.github/workflows/` directory contains reusable workflows. Each is invoked callers retain their event triggers and repository-specific prompts. `workflow-metrics.yml` emits `WorkflowRunDuration` for a completed -`workflow_run`. Callers provide the namespace, OS, and writer-role secret name, -grant `id-token: write`, and pass `WORKFLOW_SECRETS_READER_ROLE_ARN`. Pin the -workflow to a full commit SHA. The writer role needs `cloudwatch:PutMetricData`. +`workflow_run`, with `WorkflowName`, `Branch`, `Result`, and `OS` dimensions. +Callers provide the namespace, OS, and writer-role secret name, grant +`id-token: write`, and pass `WORKFLOW_SECRETS_READER_ROLE_ARN`. Pin the workflow +to a full commit SHA. The writer role needs `cloudwatch:PutMetricData`. ```yaml on: