Technology
OpenAI Codex
Monitor OpenAI Codex with cost visibility, adoption tracking, and productivity signals across your engineering teams — without changing how developers work.
Overview
OpenAI Codex
OpenAI Codex is OpenAI's agentic coding tool that runs in your terminal. With the Dash0 agent plugin it emits OpenTelemetry traces about every session — prompts and responses, token usage, cost, the model behind each turn, tool and MCP calls, sub-agent activity, and the pull requests it helps ship. Sending that telemetry to Dash0 gives engineering leaders and platform teams a single place to understand how Codex is adopted, what it costs, and the impact it has — without changing how developers work.
Use Cases
- Cost visibility: Track spend by user, team, and model so you can understand and control what Codex costs.
- Adoption tracking: Follow active users, new adopters, and usage distribution to see how Codex rolls out across your engineering teams.
- Productivity signals: Correlate sessions, tool calls, and assisted pull requests to understand the impact Codex has on your team's output.
Setup
Overview
The Dash0 agent plugin captures OpenAI Codex agent activity as OpenTelemetry traces: prompts and responses, token usage, cost, tool calls, MCP calls, and sub-agent activity, all sharing one trace context per turn. Send that data to Dash0 and the AI Coding section reports what Codex costs, how widely your teams use it, and what it helps ship.
Prerequisites
- The OpenAI Codex CLI installed and authenticated, on macOS, Linux, or Windows, on
amd64orarm64. - A Dash0 auth token with ingest permissions.
- Your name and email set in your git configuration. The plugin uses them to attribute activity to users:
git config --global user.name "{{user_full_name}}"
git config --global user.email "{{user_email}}"Installation
Run the installer:
curl -fsSL https://raw.githubusercontent.com/dash0hq/dash0-agent-plugin/main/install-codex.sh | bashOn Windows, run the PowerShell installer instead:
irm https://raw.githubusercontent.com/dash0hq/dash0-agent-plugin/main/install-codex.ps1 | iexYou are prompted for your Dash0 connection details:
- OTLP URL:
{{endpoint_otlp_http}} - Auth token:
{{token_ingestion}} - Dataset (optional):
{{dataset}}
The installer registers the plugin's hooks in ~/.codex/config.toml as a managed block, which preserves any hooks and
config you already have. It then fetches the codex-on-event binary from
GitHub Releases with checksum verification, and writes your
credentials to ~/.codex/dash0-agent-plugin.local.md. A download that cannot verify against checksums.txt is deleted, and the installer stops and says why.
For more information on choosing a dataset, see the dataset documentation.
Unattended installation
Pass the credentials up front to skip every prompt, which is what CI, containers, and fleet rollouts need:
curl -fsSL https://raw.githubusercontent.com/dash0hq/dash0-agent-plugin/main/install-codex.sh | bash -s -- \
--endpoint {{endpoint_otlp_http}} \
--token {{token_ingestion}} \
--dataset {{dataset}}On Windows:
$installer = irm https://raw.githubusercontent.com/dash0hq/dash0-agent-plugin/main/install-codex.ps1
& ([scriptblock]::Create($installer)) `
-Endpoint {{endpoint_otlp_http}} `
-Token {{token_ingestion}} `
-Dataset {{dataset}}The same values can be supplied as the DASH0_OTLP_URL, DASH0_AUTH_TOKEN, and DASH0_DATASET environment variables,
on every platform. DASH0_TEAM_NAME sets the team name, and DASH0_VERSION pins a specific plugin release instead of
the latest one.
Via the Codex plugin marketplace
If you prefer Codex's native plugin flow:
codex plugin marketplace add dash0hq/dash0-agent-plugin
codex plugin add dash0-agent-plugin@dash0This path needs two steps the installer would otherwise handle for you. Create ~/.codex/dash0-agent-plugin.local.md
with your endpoint and token as shown below, then run /hooks inside Codex and trust the Dash0 hooks by pressing t.
Codex does not auto-trust a plugin's hooks on install.
Configure
The configuration lives in the YAML frontmatter of ~/.codex/dash0-agent-plugin.local.md
(%USERPROFILE%\.codex\dash0-agent-plugin.local.md on Windows), which the installer writes for you. Edit it to
reconfigure later. Changes take effect on the next hook fire, with no restart:
---
otlp_url: "{{endpoint_otlp_http}}"
auth_token: "{{token_ingestion}}"
dataset: "{{dataset}}" # optional
agent_name: "codex" # optional — used as service.name
team_name: "<your team>" # optional — tagged as dash0.team.name on every span
---A per-project .codex/dash0-agent-plugin.local.md inside a repository takes precedence over the global file. The two
files do not merge: if a project-level file exists, the global one is ignored entirely. Set enabled: false to switch
the plugin off for a scope without uninstalling it.
By default the plugin omits prompt content and tool inputs and outputs from spans (omit_io: true) and sends the real
user name and email (omit_user_info: false). Set omit_user_info: true to hash the user name, drop the email, and
redact the working directory.
Attribute Usage by Team (Optional)
Codex activity breaks down by user and model out of the box. To also break down by team or department, set team_name in
the configuration file. It is attached to every span as dash0.team.name.
Verify
- Start a new Codex session and send a prompt that uses a tool.
- Within a few seconds, the telemetry appears in the AI Coding section of Dash0: one trace per turn, with a
chat <model>span carrying token usage and anexecute_tool <Name>span per tool call.
If no traces arrive, run /hooks in Codex and check that the Dash0 hooks are listed and Active. Adding
debug: true and debug_file: /tmp/dash0-codex-debug.log to the configuration file logs every emitted span as a
[dash0:trace] line, which tells you whether the problem is span emission or the endpoint and token.
Upgrade and uninstall
Re-run the installer to upgrade. It fetches the latest release and leaves your credentials untouched. To remove the
plugin, run the uninstaller, which strips Dash0's entries from ~/.codex/config.toml while preserving your own hooks
and config:
curl -fsSL https://raw.githubusercontent.com/dash0hq/dash0-agent-plugin/main/uninstall-codex.sh | bashOn Windows, re-run install-codex.ps1 to upgrade, and use the PowerShell uninstaller to remove the plugin:
irm https://raw.githubusercontent.com/dash0hq/dash0-agent-plugin/main/uninstall-codex.ps1 | iexStart a new Codex session after either operation.