Skip to content

Surface MPS control-daemon impairment reason as StatusReason - #5125

Merged
harishxr merged 1 commit into
aws:devfrom
harishxr:harishxr/mps-ec2-daemon-healthcheck-statusreason
Sep 4, 2026
Merged

harishxr merged 1 commit into
aws:devfrom
harishxr:harishxr/mps-ec2-daemon-healthcheck-statusreason

Conversation

@harishxr

@harishxr harishxr commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Surface a human-readable reason alongside the instance health status. On IMPAIRED, the MPS control-daemon health check now reports why e.g. "probe timed out, daemon wedged" or "probe failed, cannot find MPS control daemon process", which reaches DescribeContainerInstances and the "ECS Container Instance Health Change" EventBridge event as statusReason. Follow up to #5124, which reported status only.

The plumbing is generic and any doctor health check that returns a non-empty reason gets it forwarded to the wire. Only the MPS check populates one in this change.

Implementation details

The doctor Healthcheck interface gains a GetStatusReason() accessor and SetHealthcheckStatus now takes the reason alongside the status so the two are always set together. The shared status tracker stores and returns the reason under its existing lock, so every check that embeds the tracker picks up both new methods for free.

On the publish side, the TCS client forwards a non-empty reason to InstanceStatus.StatusReason and leaves the pointer nil when there is none, so omitempty drops it and the backend sees null rather than an empty string.

Only the MPS control-daemon check populates a reason today: on IMPAIRED it reports the probe error (daemon wedged / probe timed out / control binary missing), bounded to MHS's 1024-character limit on a rune boundary, and clears it on any healthy tick. Every other check stays status-only, so their behavior is unchanged; the plumbing is generic, so a future check can surface a reason by simply returning one.

Testing

New tests cover the changes: yes

Agent built from this branch:

  • Baseline: DescribeContainerInstances --include CONTAINER_INSTANCE_HEALTH → ACCELERATED_COMPUTE = OK, no statusReason; CONTAINER_RUNTIME = OK.
  • systemctl stop nvidia-mps.service: after the 3-strike threshold (~70s), ACCELERATED_COMPUTE = IMPAIRED with statusReason = "mps control daemon probe failed (exit 1, output "Cannot find MPS control daemon process"): exit status 1". systemctl start → back to OK, statusReason cleared.
  • Wedge path (kill -STOP the control daemon so the probe times out): after ~70s, ACCELERATED_COMPUTE = IMPAIRED with statusReason = "mps control daemon probe timed out after 3s (daemon wedged?): signal: killed" (timedOut=true in the log). kill -CONT → OK, statusReason cleared.
  • Both channels, both paths: the reason appears identically on DescribeContainerInstances --include CONTAINER_INSTANCE_HEALTH and on the "ECS Container Instance Health Change" EventBridge event (ec2InstanceId set, capacityProviderName: null), and clears on recovery on both.

Description for the changelog

Enhancement - Surface MPS control-daemon impairment reason as StatusReason

Additional Information

Does this PR include breaking model changes? If so, Have you added transformation functions? No

Does this PR include the addition of new environment variables in the README? No

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@harishxr
harishxr force-pushed the harishxr/mps-ec2-daemon-healthcheck-statusreason branch 5 times, most recently from b927b5f to 3ca9b93 Compare September 4, 2026 00:43
@harishxr harishxr changed the title Harishxr/mps ec2 daemon healthcheck statusreason Surface MPS control-daemon impairment reason as StatusReason Sep 4, 2026
@harishxr
harishxr force-pushed the harishxr/mps-ec2-daemon-healthcheck-statusreason branch from 3ca9b93 to accb279 Compare September 4, 2026 02:12
@harishxr
harishxr force-pushed the harishxr/mps-ec2-daemon-healthcheck-statusreason branch from accb279 to 9271b15 Compare September 4, 2026 02:40
@harishxr
harishxr marked this pull request as ready for review September 4, 2026 02:58
@harishxr
harishxr requested a review from a team as a code owner September 4, 2026 02:58
Comment thread agent/doctor/mps_daemon_healthcheck_test.go
@harishxr
harishxr merged commit 4b65950 into aws:dev Sep 4, 2026
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants