Repository navigation
chore(orchestrator): Replace per-visit sweep logs with a heartbeat - #419
morgan-wowk wants to merge 1 commit into
Conversation
4ebb687 to
ac47a1e
Compare
| _logger.info( | ||
| f"Before processing running container execution. Queries duration {queries_duration_ms}ms." | ||
| ) | ||
| start_timestamp = time.monotonic_ns() |
There was a problem hiding this comment.
Is moving this start_timestamp here intentional and any beahviour changes?
There was a problem hiding this comment.
🤖 AI-assisted: Yes, intentional. start_timestamp used to be set before the execution-node-IDs query, so that query was counted in both queries_duration_ms and the processing duration. Setting it after the queries makes the two numbers in the slow-visit line separate, which tells a slow database apart from a slow launcher. No other behaviour changes: duration_ms only feeds that log line.
Also added in f0daa92: a once-a-minute heartbeat (Orchestrator heartbeat: processed N queued executions and M running container executions in the last 60s.). The per-visit lines we removed were the only sign the sweep was alive, so the heartbeat keeps that signal at one line a minute. If it stops appearing, the sweep has stopped.
ac47a1e to
f0daa92
Compare
f0daa92 to
4d8615d
Compare
9f0aa73 to
d7b523d
Compare
4d8615d to
27ead6d
Compare
d7b523d to
75a55e6
Compare
27ead6d to
227f42a
Compare
75a55e6 to
89b07cc
Compare
227f42a to
6f573cb
Compare
89b07cc to
8da2f52
Compare
6f573cb to
1dbfb6d
Compare
8da2f52 to
aa4bb4e
Compare
1dbfb6d to
99b4d85
Compare
The running queue visits every pending or running container execution round-robin, and each visit logged three INFO lines even when nothing changed. With hundreds of active executions that is tens of lines per second carrying no information. Drop the "Before processing", "After processing" and "remains in state" lines. Log one line only when a visit is slow: its queries or its processing take over 1s, matching the existing slow-query threshold for the idle queue log. The queries and processing times stay separate so a slow database is distinguishable from a slow launcher. Add a heartbeat line about once a minute from process_each_queue_once with the number of queued and running executions processed since the last one. The per-visit lines were the only sign that the sweep was still going; the heartbeat keeps that signal at one line a minute, and its absence means the sweep has stopped. State changes, terminations, retries and errors keep their existing logs.
99b4d85 to
750469f
Compare
Problem
Each visit of the running sweep logs three INFO lines, even when nothing changed. At 300–1000 active executions, that is tens of lines per second of noise. If the sweep hangs, the flood just stops, and nothing makes that easy to alert on.
Objective
Log only what carries information. The per-visit durations now come from the
container_execution.refresh.durationmetric added in #425.sequenceDiagram participant Sweep as Orchestrator sweep participant Logs participant Metrics loop Every running container execution visit Sweep->>Metrics: refresh.duration (queries, processing) alt Queries or processing over 1s Sweep->>Logs: Slow running container execution visit else Normal visit Note over Sweep,Logs: No log line (before: 3 INFO lines) end end Sweep->>Logs: Orchestrator heartbeat, about once a minute, with queued and running counts Note over Logs: A missing heartbeat means the sweep stoppedChanges
Before processing …,… remains in RUNNING state.andAfter processing ….Slow running container execution visit (queries: …ms, processing: …ms). It is logged only when either part takes over 1s, the same threshold the idle-queue log uses.Orchestrator heartbeat: processed N queued executions and M running container executions in the last 60s.It is logged even when both queues are idle.orchestrator.process_running_executionspan are unchanged.Testing
pytest tests: 584 passed.TestHeartbeatcovers an idle heartbeat and the counts resetting.