Skip to content

ci: emit canary heartbeat metric for external failure alarm#1812

Open
jesseturner21 wants to merge 1 commit into
mainfrom
canary-failure-alarm
Open

ci: emit canary heartbeat metric for external failure alarm#1812
jesseturner21 wants to merge 1 commit into
mainfrom
canary-failure-alarm

Conversation

@jesseturner21

@jesseturner21 jesseturner21 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a heartbeat step to the canary workflow: every run emits a Success = 1|0 metric to CloudWatch (AgentCoreCLI/Canary namespace) via if: always(). A CloudWatch alarm in the canary's AWS account watches the metric and alerts the team when the canary fails — or stops running — for 30+ minutes.

Why a heartbeat instead of a failure-triggered push

A metric pushed only on failure goes silent in exactly the scenarios we most need to know about: runner never starts, broken credentials, silently disabled cron. The alarm treats missing data as breaching, so with a heartbeat, silence is itself the signal.

Notes for reviewers

  • The alarm and its alerting action live in the canary's AWS account (already deployed and verified end-to-end); this PR only adds the metric emission.
  • Single-run flakes keep going through the existing Canary Failure GitHub issue + Slack path, which carries the per-failure detail (variant, commit, run URL). The alarm only fires after 30+ minutes of failure or silence.
  • The alarm period is coupled to the */15 cron — there's a comment at the cron line; if the schedule changes, the alarm period must change with it.
  • The heartbeat step needs cloudwatch:PutMetricData on the workflow's AWS role (already granted, scoped to the AgentCoreCLI/Canary namespace).

@jesseturner21
jesseturner21 requested a review from a team July 22, 2026 22:17
@github-actions github-actions Bot added size/m PR size: M agentcore-harness-reviewing AgentCore Harness review in progress labels Jul 22, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Jul 22, 2026
@github-actions github-actions Bot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Jul 22, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Jul 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-0.24.1.tgz

How to install

gh release download pr-1812-tarball --repo aws/agentcore-cli --pattern "*.tgz" --dir /tmp/pr-tarball
npm install -g /tmp/pr-tarball/aws-agentcore-0.24.1.tgz

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 40.3% 15047 / 37333
🔵 Statements 39.56% 16037 / 40535
🔵 Functions 34.42% 2567 / 7457
🔵 Branches 33.71% 10016 / 29710
Generated in workflow #4180 for commit 863c461 by the Vitest Coverage Report Action

@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels Jul 22, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Jul 22, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Jul 22, 2026
Every canary run now emits a Success=1|0 heartbeat metric to CloudWatch
via an if: always() step. An alarm in the canary's AWS account watches
the metric and alerts the team when the canary fails or stops reporting.

The alarm treats missing data as breaching, so a heartbeat (rather than
a failure-triggered push) also covers failure modes that produce no
signal at all: runner never starts, broken credentials, silently
disabled cron.
@jesseturner21
jesseturner21 force-pushed the canary-failure-alarm branch from d0617eb to 863c461 Compare July 22, 2026 22:32
@github-actions github-actions Bot added size/s PR size: S and removed size/m PR size: M labels Jul 22, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Jul 22, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Jul 22, 2026
@jesseturner21 jesseturner21 changed the title ci: alarm and SIM ticket when the canary fails or goes silent ci: emit canary heartbeat metric for external failure alarm Jul 22, 2026

@notgitika notgitika left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smart approach! LGTM :)

# manually dispatched against another region — so an off-region run can't
# starve the alarm into a false missing-data breach.
readonly MONITOR_REGION=us-east-1
readonly NAMESPACE=AgentCoreCLI/Canary

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

qq can we make this an env variable instead? this would prevent anyone configuring it themselves to have this value that could mess with our alarms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/s PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants