fleetd #501: readiness-grace expiry logs measured elapsed time and poll counter #503
Reference in New Issue
Block a user
Delete Branch "worker/501-a31fa0-7"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes two defects in the CB-114 readiness-grace expiry log at Injector.java:383-387 (both numbers read as measurements but were compile-time constants):
The poll count printed READINESS_GRACE_POLLS instead of the loop's own Target.notReadySincePoll counter, which was already in scope. Fixed to print the counter. Honest caveat, in a comment and in the PR: on this branch the counter has just reached the threshold, so it equals the constant by construction, and no test can tell the two apart.
The elapsed-time figure was READINESS_GRACE_POLLS * POLL_INTERVAL_MILLIS / 1000 -- arithmetic on two constants, never a measurement, and wrong in the direction that says everything ran on schedule. Fixed by adding a new Target.notReadySinceMillis field (stamped at the first non-ready sample, reset at all three sites notReadySincePoll already resets) and an injected java.util.function.LongSupplier nowMillis (default System::currentTimeMillis via new package-private constructor overloads), copying the shape LeadRollover already uses (fleetd #494/#480).
The log now reads: "readiness grace for {target} expired after {measured polls} polls (configured={N} polls/{N}s elapsed={measured}ms): ..."
Tests
Added two tests to InjectorTest using the existing ListAppender log-capture pattern:
Mutation-testing proof (see full detail in the fleet_reply handoff)
Build
fleetd/: mvn clean install -- Tests run: 1683, Failures: 0, Errors: 0, Skipped: 0, BUILD SUCCESS. No new compiler warnings; the one pre-existing deprecation warning is in FleetConfig.java, untouched by this change.
Grep proof that all three notReadySincePoll reset sites (pre-fix line numbers :304, :355, :389) now also reset the new notReadySinceMillis field is in the fleet_reply handoff.