OpenAI Codex
OpenAI Codex has native OpenTelemetry support. Once enabled, Oodle collects metrics and event logs so you can track token usage, session activity, tool calls, and WebSocket request patterns across your organization.
Getting Started
1. Enable Telemetry
The fastest way is to use the integration tile in the Oodle UI:
- Navigate to Settings → Integrations
- Open the AI Cost Management section
- Click the Codex Observability tile
- Select an API key and follow the steps shown
Alternatively, add the following to your Codex
configuration file (~/.codex/config.toml):
#:schema https://developers.openai.com/codex/config-schema.json
[otel]
environment = "production"
log_user_prompt = true
exporter = { otlp-http = {
endpoint = "https://<LOGS_ENDPOINT>/ingest/otel/v1/logs",
protocol = "binary",
headers = {
"X-API-KEY" = "<API_KEY>",
"X-OODLE-INSTANCE" = "<INSTANCE_ID>",
},
}}
metrics_exporter = { otlp-http = {
endpoint = "https://<METRICS_ENDPOINT>/v2/otlp/metrics/<INSTANCE_ID>",
protocol = "binary",
headers = {
"X-API-KEY" = "<API_KEY>",
"X-OODLE-INSTANCE" = "<INSTANCE_ID>",
},
}}
Replace <METRICS_ENDPOINT>, <API_KEY>, and
<INSTANCE_ID> with values from the integration tile.
The integration tile in the Oodle UI generates a
ready-to-copy config.toml with the correct
endpoints and API key pre-filled.
Alternative: Environment Variables
For quick testing you can export the standard OpenTelemetry variables directly in your shell:
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=https://<METRICS_ENDPOINT>/v2/otlp/metrics/<INSTANCE_ID>
export OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=https://<LOGS_ENDPOINT>/ingest/otel/v1/logs
export OTEL_EXPORTER_OTLP_HEADERS="X-API-KEY=<API_KEY>, X-OODLE-INSTANCE=<INSTANCE_ID>"
export OTEL_LOG_USER_PROMPTS=1
export OTEL_METRIC_EXPORT_INTERVAL=10000
export OTEL_LOGS_EXPORT_INTERVAL=5000
2. Roll Out to Your Team
Commit the config.toml above to your dotfiles
repository or place it in each developer's
~/.codex/ directory via your configuration
management tool.
3. Verify Data
Once telemetry starts flowing, navigate to AI Assistants → Codex in the Oodle sidebar.
Charts Dashboard
The Charts tab embeds a Grafana dashboard with panels covering:
| Panel | Description |
|---|---|
| Total Tokens | Aggregate token usage over the selected range |
| Conversations | Number of Codex conversations started |
| WebSocket Requests | Total WebSocket requests made |
| Tool Calls | Total tool invocations |
| Token Usage | Time series by token type (input, output, cached, reasoning) |
| Conversations Over Time | Conversation start trends |
| Tool Call Activity | Tool invocations over time |
| WebSocket Requests | Success vs failure rates |
| Avg Turn E2E Duration | End-to-end latency per turn |
| Avg TTFT | Time to first token |
| Avg TTFM | Time to first message |
| Avg WS Event Duration | WebSocket event processing time |
| Startup Prewarm Duration | Agent startup prewarm latency |
| Shell Snapshot Duration | Shell snapshot capture latency |
Sessions
The Sessions tab shows individual Codex sessions:
| Column | Description |
|---|---|
| Start Time | When the session began |
| Session | Codex conversation ID |
| User | Email of the developer |
| Surface | Where Codex ran — app-server (IDE/extension) or cli (terminal) |
| Duration | Wall-clock duration |
| Tokens | Total tokens (input + output + cached) |
Codex does not currently export cost data, so the Cost column is hidden for Codex sessions. Duration is blank for a session until it has reported more than one data point.
Click any row to open a Session Detail drawer showing a turn-by-turn timeline of every event.
Session Detail Drawer
The drawer displays:
- Session metadata — user, model, app version
- Aggregated stats — tokens, tool calls, errors, duration (only populated fields are shown)
- Turn-by-turn timeline — each turn is collapsible and shows individual events (SSE events, WebSocket events, tool calls). Every event row is expandable to reveal the full raw JSON payload.
Tool Usage
The Tool Usage tab embeds a Codex-specific Grafana
dashboard (separate from the Claude Code one) driven by
the log-derived oodle_logs_codex_tool_* metrics:
| Panel | Description |
|---|---|
| Tool Calls Over Time | Invocations per tool name |
| Top Tools by Call Count | Most-used tools in the range |
| Avg Tool Duration | Mean execution time per tool |
| Tool Outcomes | Success vs failure call counts |
| MCP Tool Calls by Server | MCP invocations grouped by server |
Filter by Surface, Model, and User from the dashboard template variables.
Token Usage
The Token Usage tab breaks down token consumption
from the log-derived oodle_logs_codex_token_usage
metric:
| Panel | Description |
|---|---|
| Token Usage by User | Daily tokens per developer |
| Token Usage by Model | Daily tokens per model |
| Token Usage by Token Type | input / output / cached_input / reasoning_output |
| Token Usage by Surface | app-server vs CLI |
| Token Usage by App Version | Daily tokens per Codex version |
| Top Sessions by Token Usage | Highest-token sessions in range |
Cached-input and reasoning-output tokens are tracked separately from input/output — use the Token Type filter to isolate a category.
What Gets Collected
Metrics
Codex exports the following as OpenTelemetry metrics (delta temporality):
| Metric | Labels | Description |
|---|---|---|
codex_turn_token_usage | model, token_type, originator | Token count by type (input, output, cached, reasoning) |
codex_thread_started | model, originator | Conversations started |
codex_turn_tool_call | model, originator | Tool invocations |
codex_websocket_request | model, success | WebSocket API requests |
codex_turn_e2e_duration_ms | model | End-to-end turn latency |
codex_turn_ttft_ms | model | Time to first token |
codex_turn_ttfm_ms | model | Time to first message |
codex_ws_event_duration_ms | model | WebSocket event processing time |
codex_startup_prewarm_duration_ms | — | Startup prewarm latency |
codex_shell_snapshot_duration_ms |