Skip to content

[codex] Initialize exec-server OpenTelemetry at startup#25019

Open
starr-openai wants to merge 4 commits into
codex/otel-duration-secondsfrom
starr/cca-exec-logging
Open

[codex] Initialize exec-server OpenTelemetry at startup#25019
starr-openai wants to merge 4 commits into
codex/otel-duration-secondsfrom
starr/cca-exec-logging

Conversation

@starr-openai

@starr-openai starr-openai commented May 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Initialize stderr tracing and the configured OpenTelemetry provider for local and remote codex exec-server startup, with a root runtime span.

Stack

Validation

  • just test -p codex-exec-server --lib (107 passed)
  • just test -p codex-cli --test exec_server (2 passed)

@starr-openai starr-openai force-pushed the starr/cca-exec-logging branch from c8ab9d0 to 4282a6e Compare May 29, 2026 19:07
@starr-openai starr-openai marked this pull request as ready for review May 29, 2026 22:33

@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: 4282a6e28b

ℹ️ 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/local_process.rs Outdated
starr-openai added a commit that referenced this pull request May 29, 2026
starr-openai added a commit that referenced this pull request Jun 1, 2026
crate::protocol::FS_READ_DIRECTORY_METHOD => crate::protocol::FS_READ_DIRECTORY_METHOD,
crate::protocol::FS_REMOVE_METHOD => crate::protocol::FS_REMOVE_METHOD,
crate::protocol::FS_COPY_METHOD => crate::protocol::FS_COPY_METHOD,
crate::protocol::HTTP_REQUEST_METHOD => crate::protocol::HTTP_REQUEST_METHOD,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

hmm...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

there is no better way to do this?

Comment thread codex-rs/exec-server/src/remote.rs Outdated
.telemetry
.remote_registration_completed("success", registration_started_at.elapsed());
drop(registration_span);
eprintln!("codex exec-server remote environment registered");

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This regresses the existing raw stderr diagnostic while the PR only needs OTEL export to be sanitized. The base code printed the registered environment_id to local stderr; removing it here makes multi-environment remote exec-server debugging materially worse. Please keep the raw eprintln! detail and sanitize only the OTEL/log-only event payloads.

JsonRpcConnectionEvent::Message(message) => match message {
codex_app_server_protocol::JSONRPCMessage::Request(request) => {
let method = request_method(request.method.as_str());
let request_span = request_span(method);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This new request span should attach the inbound JSON-RPC trace context before exporting. JSONRPCRequest already carries trace, and the adjacent app-server path calls set_parent_from_w3c_trace_context before emitting server spans. As written, exec-server request spans are orphaned from caller traces, so the new OTEL request spans do not actually join the distributed trace. Please parent request_span from request.trace here; ideally the exec-server client should also stop sending trace: None for outbound requests.

.open(&instructions_path)
.await
{
Ok(mut file) => {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This PR still carries unrelated behavioral fixes outside the exec-server OTEL surface: this ad-hoc memory seed flush and the RMCP ETXTBSY retry in codex-rs/rmcp-client/src/program_resolver.rs. Please split those into separate PRs so review and rollback scope stay tied to the stated feature.

Comment thread codex-rs/exec-server/src/remote.rs Outdated
emit_remote_otel_event!(
INFO,
"codex.exec_server.remote_environment_registered",
"codex exec-server remote environment registered"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

can we move this code out to a function

Comment thread codex-rs/exec-server/src/remote.rs Outdated
);
config
.telemetry
.remote_websocket_reconnect("connect_failed");

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the event logging is definitely cluttering up the main logic of this function - is there any way to simplify this?

@richardopenai richardopenai force-pushed the starr/cca-exec-logging branch from d0265f4 to db44d86 Compare June 3, 2026 08:10
@richardopenai richardopenai changed the base branch from main to codex/otel-metric-instruments June 3, 2026 08:11
@richardopenai richardopenai force-pushed the codex/otel-metric-instruments branch from ff23345 to 4b17850 Compare June 8, 2026 20:57
@richardopenai richardopenai force-pushed the codex/otel-metric-instruments branch from 4b17850 to a107f7b Compare June 8, 2026 21:19
Base automatically changed from codex/otel-metric-instruments to main June 8, 2026 22:29
@richardopenai richardopenai force-pushed the starr/cca-exec-logging branch from db44d86 to bf4be25 Compare June 10, 2026 21:00
@richardopenai richardopenai changed the title Add exec-server OTEL lifecycle logging [codex] Initialize exec-server OpenTelemetry at startup Jun 10, 2026
@richardopenai richardopenai changed the base branch from main to codex/otel-duration-seconds June 10, 2026 21:01
@richardopenai richardopenai marked this pull request as draft June 10, 2026 21:01
@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.

@richardopenai richardopenai force-pushed the codex/otel-duration-seconds branch from a848c75 to 7530ed6 Compare June 10, 2026 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants