Skip to content

feat: Add @openai/codex-sdk instrumentation#1945

Open
Luca Forstner (lforst) wants to merge 9 commits intomainfrom
lforst/instrument-codex-sdk
Open

feat: Add @openai/codex-sdk instrumentation#1945
Luca Forstner (lforst) wants to merge 9 commits intomainfrom
lforst/instrument-codex-sdk

Conversation

@lforst
Copy link
Copy Markdown
Member

@lforst Luca Forstner (lforst) commented May 4, 2026

Fixes #1902

Screenshot 2026-05-08 at 09 01 32

@lforst Luca Forstner (lforst) marked this pull request as ready for review May 8, 2026 16:22
Comment on lines +36 to +37
openaiCodex?: boolean;
codex?: boolean;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why do we have both? Feels confusing to me.

Comment on lines +838 to +842
metrics.tokens =
(metrics.prompt_tokens ?? 0) +
(metrics.completion_tokens ?? 0) +
(metrics.prompt_cached_tokens ?? 0) +
(metrics.completion_reasoning_tokens ?? 0);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can we add a test to make sure this is not double counting tokens? Always get a bit scared at logic like this.

return;
}
states.delete(event);
void finalizeCompletedRun(state, event.result);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should we not await on these?

arguments: args,
operation: "run",
thread: target,
} as never,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

as never?

@AbhiPrasad Abhijeet Prasad (AbhiPrasad) dismissed their stale review May 8, 2026 18:19

oops approved by accident

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.

Support tracing the OpenAI Codex SDK

2 participants