mirror of
https://github.com/openai/codex.git
synced 2026-11-07 20:30:33 +00:00
## What changed - Add `GetProcessMetrics` and provider sampling APIs for process ID, start time, cumulative CPU time, and resident memory, exposed through `ThreadManager` without creating a thread or session. - Distinguish unsupported collection, a locally absent host, and sampling failures. Process-owned providers never start or replace a host when sampling. - Bound gRPC sampling to one second without retries or explicit connection resets. Run optional collectors on a detached worker with at most one collection in flight, so stalled collection cannot block the HTTP/2 driver or runtime shutdown. ## Testing Add coverage for snapshots, collector errors and panics, deadlines, overload, and shutdown with a stuck collector. Extend lifecycle tests to check that sampling preserves session state and keepalive behavior without starting or restarting local hosts. GitOrigin-RevId: eeafe275891d0464636f28a29345a87aed1a12dc
22 lines
841 B
Rust
22 lines
841 B
Rust
//! Optional process observations, independent of sessions. Process-owned
|
|
//! providers observe existing children; remote transports own connection policy.
|
|
|
|
/// A cumulative observation of one host process, shared across its sessions.
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub struct CodeModeProcessMetrics {
|
|
pub process_id: u32,
|
|
/// Unix timestamp, stable for this process across all metrics transports.
|
|
pub process_start_time_seconds: f64,
|
|
pub cpu_seconds_total: f64,
|
|
pub resident_memory_bytes: u64,
|
|
}
|
|
|
|
/// Unsupported capability and an absent process are distinct from a failed sample.
|
|
#[derive(Clone, Debug, PartialEq)]
|
|
pub enum CodeModeProcessMetricsSample {
|
|
Unsupported,
|
|
/// The process owner knows no host is running; never inferred from an RPC status.
|
|
NotRunning,
|
|
Snapshot(CodeModeProcessMetrics),
|
|
}
|