mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Measure total exec-server request duration including queueing (#44207)
## Why The existing request duration metric starts at dispatch, leaving out time spent waiting before dispatch. ## What changed Add `exec_server_request_total_duration_seconds` to measure time from decoded receipt until response enqueue or disconnection, including queueing. Record it alongside the existing duration metric with the same `method` and `result` labels for success, error, and disconnection paths. Preserve existing dispatch and queue timing semantics. ## Testing Add coverage for successful requests, route errors, unknown methods, response delivery failures, and disconnection during execution. Extend admission-wait coverage to verify total timing includes queueing and route setup without double-counting, and assert each completion and duration is recorded once. GitOrigin-RevId: ed0f719751b821b8f9f9556914b0f67dc6c5ad8f
This commit is contained in:
1 parent
8ff4aa8ee4
commit
4f2449b4b2
3 files changed
+254
-8
No files matched your search
@@ -35,6 +35,8 @@ const REQUESTS_TOTAL_METRIC: &str = "exec_server_requests_total";
|
||||
const REQUESTS_TOTAL_DESCRIPTION: &str = "Total number of exec-server requests.";
|
||||
const REQUEST_DURATION_METRIC: &str = "exec_server_request_duration_seconds";
|
||||
const REQUEST_DURATION_DESCRIPTION: &str = "Duration of exec-server requests in seconds.";
|
||||
const REQUEST_TOTAL_DURATION_METRIC: &str = "exec_server_request_total_duration_seconds";
|
||||
const REQUEST_TOTAL_DURATION_DESCRIPTION: &str = "Total exec-server request duration in seconds, including queueing, from decoded receipt until response enqueue or disconnection.";
|
||||
const REQUEST_QUEUE_DURATION_METRIC: &str = "exec_server_request_queue_duration_seconds";
|
||||
const REQUEST_QUEUE_DURATION_DESCRIPTION: &str =
|
||||
"Time exec-server requests spend queued before execution in seconds.";
|
||||
@@ -157,6 +159,7 @@ impl ExecServerTelemetry {
|
||||
method: &'static str,
|
||||
result: &'static str,
|
||||
duration: Duration,
|
||||
total_duration: Duration,
|
||||
) {
|
||||
self.with_inner(|inner| {
|
||||
let tags = [("method", method), ("result", result)];
|
||||
@@ -167,6 +170,12 @@ impl ExecServerTelemetry {
|
||||
duration,
|
||||
&tags,
|
||||
);
|
||||
inner.duration(
|
||||
REQUEST_TOTAL_DURATION_METRIC,
|
||||
REQUEST_TOTAL_DURATION_DESCRIPTION,
|
||||
total_duration,
|
||||
&tags,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user