feat: record launch latency in statistics for start-only jobs
StartOnly jobs previously forced DurationMS to 0 because GoSentry does not wait for the process to exit, leaving the Statistics line stuck at "last 0 ms, avg 0 ms". The runner already measures launch latency (time to spawn the process) for the History detail; this now returns that value as the run duration so the existing duration-driven stats pipeline folds it into last/avg/max. Sub-millisecond launches still round to 0 and are excluded from the average, matching prior behavior. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -89,8 +89,9 @@ flowchart LR
|
||||
`runner.RunJob` builds the platform-specific invocation, executes the
|
||||
command through the platform shell, captures stdout and stderr, writes one
|
||||
timestamped `.log` file, and returns a `domain.RunRecord` containing
|
||||
`DurationMS` (wall-clock milliseconds from start to finish; 0 for
|
||||
`StartOnly` fire-and-forget jobs).
|
||||
`DurationMS` (wall-clock milliseconds from start to finish; for `StartOnly`
|
||||
fire-and-forget jobs it measures launch latency — the time to spawn the
|
||||
process — since there is no exit to wait for).
|
||||
|
||||
6. History update:
|
||||
When a run goroutine completes, `Service` updates the job's runtime
|
||||
@@ -132,7 +133,7 @@ in flight increments `JobRuntime.PendingRuns`. When the current run finishes,
|
||||
|-------|---------|
|
||||
| `RunCount` | total runs recorded |
|
||||
| `FailCount` | runs that exited non-zero |
|
||||
| `LastDurationMS` | wall-clock time of the most recent run |
|
||||
| `LastDurationMS` | wall-clock time of the most recent run (launch latency for `StartOnly`) |
|
||||
| `AvgDurationMS` | mean over all runs with a recorded duration |
|
||||
| `MaxDurationMS` | longest recorded run |
|
||||
|
||||
|
||||
@@ -2,6 +2,14 @@
|
||||
|
||||
All notable GoSentry changes are recorded in this file.
|
||||
|
||||
## Unreleased
|
||||
|
||||
**Statistics:**
|
||||
- `StartOnly` jobs now record launch latency (time to spawn the process) as the
|
||||
run duration instead of a hard-coded `0`, so the Statistics line shows a real
|
||||
last/avg/max for fire-and-forget jobs. Sub-millisecond launches still round to
|
||||
0 and are excluded from the average, as before.
|
||||
|
||||
## 0.11.3 - 2026-06-29
|
||||
|
||||
**Reliability fixes from an internal code review: safer runs, a real overlap
|
||||
|
||||
Reference in New Issue
Block a user