Repository navigation
feat(vmpool): the always-on vmpool: exec line carries start_ms and dur_ms - #983
Conversation
…r_ms Per-Exec timing on the microVM worker needed SH_EXEC_TIMING=1: the always-on line named the workspace, kind and VM but no time, so a reader had only the journal's whole-second stamp. The line now ends with start_ms (epoch ms) and dur_ms, the same values the opt-in exec-timing line writes (one time.Since, shared by both). The fields are appended, so a reader matching the existing prefix still matches; exec-timing is unchanged and still adds the phases and CPU. The container worker has no always-on per-Exec line (only its opt-in exec-timing), so there is nothing to match there. The microVM tier guide's sample lines show the fields. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Rong Chang <[email protected]>
clawgenti
left a comment
There was a problem hiding this comment.
Summary
The line gains exactly what the body promises, in the format the opt-in line already uses, and the two cannot drift: both now read the same start and the same dur (logExecTiming(..., start, dur, ...)), so start_ms/dur_ms are byte-identical between the always-on line and exec-timing. Appending after err=%v keeps p4-turn-smoke.sh:286's grep -cE 'vmpool: exec .*vm=vm-' matching.
Verified at bf01043:
go vet ./internal/vmpool/...clean;go test ./internal/vmpool -run 'TestRunnerLogs|TestRunnerExecLogCarries'passes.- Mutation check: with
runner.goreverted tomain(the new test kept) it fails —exec log start_ms = "", want the exec-timing line's "1795441183472"— and passes at head, so the test pins the change. - One nit inline.
Author: webchang (MEMBER — maintainer)
Areas reviewed: Go (remote-worker/internal/vmpool), docs (docs/operate/harness/microvm-tier.md), the smoke-test fixture
Agent/IDE config (.claude/.vscode): none
Commits: 1, all signed off: yes
CI status: passing (k8s-kind-e2e, lint, microvm-gates, proto, shellcheck, trivy-scan)
Generated by RepoMan github-pr-review@235a7f7 (https://github.com/rossoctl/agent-skills/blob/235a7f7620139ee3e4ab0872b8439591fe52e8c1/skills/github-pr-review/SKILL.md).
| } | ||
| execLog("vmpool: exec req=%d workspace_key=%q kind=%s vm=%s cold=%q exit=%d err=%v", | ||
| s.ReqID, s.WorkspaceKey, logKind, ph.VMID, string(ph.Cold), res.ExitCode, err) | ||
| execLog("vmpool: exec req=%d workspace_key=%q kind=%s vm=%s cold=%q exit=%d err=%v start_ms=%d dur_ms=%.1f", |
There was a problem hiding this comment.
nit — the smoke test's stand-in journal line no longer looks like a real one. deploy/microvm/tests/p4-turn-smoke.test.sh:98 writes vmpool: exec req=$n workspace_key=... vm=vm-$n cold="" exit=0 err=<nil>; it was already missing kind= and now also lacks start_ms/dur_ms. The test only needs the vmpool: exec .*vm=vm- match, so nothing fails today — but the fixture is what a future reader will copy when they add a field-dependent assertion.
Suggested fix: append kind=command start_ms=0 dur_ms=0.0 (or …) to that echo, so the fixture tracks the line it stands in for.
ingpaolodettori-dev
left a comment
There was a problem hiding this comment.
Review — vmpool exec timing
Approving. The always-on vmpool: exec line now ends with start_ms (epoch ms) and dur_ms, both from the same time.Since(start) that feeds the opt-in exec-timing line; logExecTiming formats them identically, so the new test's field-for-field comparison is meaningful. Appending after err=%v keeps the existing prefix match, and the docs sample matches the format string.
Verified the test pins equality with the opt-in line, that start_ms falls inside the call, and that dur_ms covers the 5 ms run. CI 18/18; DCO signed; MEMBER author; no .claude//.vscode/ changes; no injection content.
Upstream rossoctl#972, rossoctl#977, rossoctl#978, rossoctl#979, rossoctl#981, rossoctl#983, rossoctl#985, rossoctl#988 and rossoctl#990 (44 commits past 49cce28). No conflict. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Rong Chang <[email protected]>
Closes #982
The always-on
vmpool: execline now ends withstart_ms(epoch ms) anddur_ms, so per-Exec timing no longer needsSH_EXEC_TIMING=1.exec-timing: both come from onetime.Since(start)inRunner.Run.err=: a reader matching the existing prefix still matches.exec-timingis unchanged: still opt-in, and it still adds the phases and the VM's CPU.internal/exec) has no always-on per-Exec line, only its opt-inexec-timing, so there's nothing to match there.kind=, which they had been missing.Tests:
TestRunnerExecLogCarriesTheExecTimingOfTheOptInLine(internal/vmpool) checks that the line'sstart_msanddur_msequal theexec-timingline's, thatstart_msfalls within the call, and thatdur_mscovers the run. It fails without the change.go vet ./...andgo test ./...inremote-workerpass, and so doesdeploy/microvm/tests/p4-turn-smoke.test.sh.Assisted-By: Claude Code