Skip to content

[codex] Record exec-server lifecycle metrics#27467

Open
richardopenai wants to merge 1 commit into
codex/exec-server-rpc-tracingfrom
codex/exec-server-connection-metrics
Open

[codex] Record exec-server lifecycle metrics#27467
richardopenai wants to merge 1 commit into
codex/exec-server-rpc-tracingfrom
codex/exec-server-connection-metrics

Conversation

@richardopenai

@richardopenai richardopenai commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Record bounded connection, request, and process lifecycle metrics.
  • Serialize active-gauge updates so concurrent starts and finishes cannot publish stale values.
  • Track process completion exactly once across normal exit, explicit termination, and session shutdown.
  • Cover the recorder in memory and verify real OTLP/HTTP export through a codex exec-server subprocess.

Stack

Review and land this stack in order:

  1. [codex] Trace exec-server JSON-RPC requests #27466 — trace exec-server JSON-RPC requests
  2. [codex] Record exec-server lifecycle metrics #27467 — record bounded connection, request, and process lifecycle metrics (this PR)
  3. [codex] Observe remote exec-server lifecycle #27470 — observe remote registration and Noise rendezvous lifecycle

Validation

  • just test -p codex-exec-server --lib (147 passed)
  • just test -p codex-cli --test exec_server (3 passed)
  • just argument-comment-lint
  • just bazel-lock-check
  • just fix -p codex-exec-server -p codex-cli
  • just fmt

@richardopenai richardopenai marked this pull request as ready for review June 10, 2026 21:12
@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Review source: Codex Cloud Agents (CCA)

Codex Cloud Agents (CCA) couldn't complete this review. The original Codex Review is unaffected.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d6b943d92c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/exec-server/src/telemetry.rs Outdated
Comment on lines +70 to +78
let active = inner
.connection_counter(transport)
.fetch_add(1, Ordering::AcqRel)
+ 1;
inner.gauge(
CONNECTIONS_ACTIVE_METRIC,
CONNECTIONS_ACTIVE_DESCRIPTION,
active,
&[("transport", transport.metric_tag())],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Serialize active connection gauge updates

When two connections of the same transport start or finish concurrently, the atomic counter update and the gauge recording can be reordered: e.g. one disconnect computes active = 1, another computes and records 0, then the first records stale 1, leaving exec_server_connections_active overreported until another event. Please make the active gauge observe the atomic value at collection time or protect the update+record sequence so the emitted value cannot go backwards after a newer count was recorded.

Useful? React with 👍 / 👎.

@richardopenai richardopenai force-pushed the codex/exec-server-connection-metrics branch from d6b943d to 7a28c0a Compare June 16, 2026 19:21
@richardopenai richardopenai force-pushed the codex/exec-server-rpc-tracing branch from e06c4e5 to f3958b2 Compare June 16, 2026 19:21
@richardopenai richardopenai changed the title [codex] Record exec-server connection metrics [codex] Record exec-server lifecycle metrics Jun 16, 2026
@richardopenai richardopenai force-pushed the codex/exec-server-rpc-tracing branch from f3958b2 to 1ef0691 Compare June 18, 2026 18:09
@richardopenai richardopenai force-pushed the codex/exec-server-connection-metrics branch 2 times, most recently from 5a94cf1 to 1128e27 Compare June 18, 2026 22:39
@richardopenai richardopenai force-pushed the codex/exec-server-rpc-tracing branch from 1ef0691 to eb4572e Compare June 19, 2026 00:15
@richardopenai richardopenai force-pushed the codex/exec-server-connection-metrics branch from 1128e27 to 2d7885f Compare June 19, 2026 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant