Repository navigation
cri: fix container_start_time_seconds unit conversion - #13897
Conversation
There was a problem hiding this comment.
🟢 Ready to approve
The change is a correct, minimal unit conversion that aligns the exported metric with its documented seconds-based semantics.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
Fixes the CRI container_start_time_seconds metric to report Unix time in seconds (as the metric name/help text indicate) instead of incorrectly reporting nanoseconds from the CRI StartedAt field.
Changes:
- Convert
container.Status.Get().StartedAtfrom nanoseconds to seconds by dividing bytime.Secondwhen exportingcontainer_start_time_seconds.
File summaries
| File | Description |
|---|---|
| internal/cri/server/list_pod_sandbox_metrics_linux.go | Convert container start time from nanoseconds to Unix seconds when populating container_start_time_seconds. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
|
cc @mikebrow |
The container_start_time_seconds metric was reporting nanoseconds instead of Unix seconds. The CRI container status stores StartedAt as nanoseconds (per the CRI API spec), but the metric name and help text indicate seconds. Convert by dividing by time.Second. Signed-off-by: Damien Grisonnet <[email protected]>
2e5fc08 to
71bc89b
Compare
There was a problem hiding this comment.
🟢 Ready to approve
The change correctly aligns the metric’s reported unit with its documented semantics by converting nanoseconds to seconds.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0 new
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
|
/cc @dims |
The container_start_time_seconds metric was reporting nanoseconds instead of Unix seconds. The CRI container status stores StartedAt as nanoseconds (per the CRI API spec), but the metric name and help text indicate seconds. Convert by dividing by time.Second.
@Chandan9112 found this bug by running kubernetes/kubernetes#140786 locally and noticed that
container_start_time_secondsreported nanoseconds (~1.78e18) instead of Unix seconds (~1.78e9)