Skip to main content

Connect Codex to LinearB using OpenTelemetry

Connect Codex to LinearB using OpenTelemetry to track adoption, accepted lines of code, token consumption, models, and estimated cost.

Steven Silverstone
Updated by Steven Silverstone

Overview

Connect Codex to LinearB using OpenTelemetry to collect Codex usage data and analyze AI adoption and usage in LinearB.

The integration provides Codex adoption, accepted lines of code, token consumption, model, and estimated cost data.

Availability: The Codex OpenTelemetry integration is currently available in Closed Beta.
Supported Codex clients: OpenTelemetry data is available from the Codex CLI and IDE extension. Codex on the web does not send telemetry to this integration.

Data Provided by Codex

The Codex OpenTelemetry integration provides the following data in LinearB:

  • Adoption
  • Accepted lines of code (LOC)
  • Token consumption
  • Models
  • Estimated cost
Estimated cost: Cost data represents estimated AI consumption in LinearB. It is not the amount billed by your AI provider.

Before You Begin

Before configuring the integration:

  • Make sure you have access to AI Tools settings in LinearB.
  • Make sure developers use the Codex CLI or IDE extension. Codex on the web does not send OpenTelemetry data.
  • Decide whether Codex telemetry will be sent through an OpenTelemetry Collector or directly to LinearB. LinearB recommends using an OpenTelemetry Collector.
  • Keep the LinearB ingest token secure. It is used to authenticate telemetry sent to LinearB.
No additional OpenAI configuration is required: LinearB generates the configuration required by Codex. You do not need to create an OpenAI API key or configure an OpenAI-side integration.

Add the Codex OpenTelemetry Integration

  1. Go to Settings → Company Settings → AI Tools → Integrations.
  2. Click Add New.
  3. Select Codex.
  4. Select OpenTelemetry as the connection type.
  5. Continue to the integration settings.

LinearB generates a write-only Ingest Token and displays the OpenTelemetry configuration required to send Codex telemetry to LinearB.


Choose How Codex Telemetry Reaches LinearB

LinearB supports two methods for sending Codex OpenTelemetry data:

LinearB recommends using an OpenTelemetry Collector. The Collector runs on each developer machine and filters Codex telemetry locally before sending the required data to LinearB.

The Collector strips apply_patch arguments locally, so code changes contained in those events do not leave the developer machine.

Organization-wide deployment: IT teams can deploy the Collector and managed Codex configuration to developer machines using an MDM solution. Organization-wide deployment has currently been verified on macOS.

Direct to LinearB

Select Direct to LinearB to send Codex telemetry directly to LinearB without an intermediate Collector.

Data privacy: With Direct, raw telemetry, including apply_patch arguments containing your code changes, is stored by LinearB. Use the OpenTelemetry Collector to keep that data in your environment.

Configure Codex Telemetry

  1. In the Codex integration, choose:
    • Via OpenTelemetry Collector (recommended), or
    • Direct to LinearB.
  2. Select the operating system used by the developer machine: macOS, Linux, or Windows.
  3. Review the values displayed under Values.
  4. Copy the configuration generated by LinearB for the selected operating system and connection method.
  5. Apply the generated configuration to Codex.
  6. Restart Codex.
The values displayed under Values are used to populate the configuration snippets. Editing these values does not save them in LinearB.

Configure an Individual User

For an individual Codex user, add the configuration generated by LinearB to:

~/.codex/config.toml

Restart Codex after applying the configuration.

Configure Codex Organization-Wide

For an organization-wide managed configuration, add the configuration to:

/etc/codex/managed_config.toml

IT administrators can distribute the managed configuration to developer machines using an MDM solution.

macOS verification: Organization-wide deployment using MDM has currently been verified on macOS only.

Restart Codex on each developer machine after the configuration is applied.


Using an OpenTelemetry Collector

When using the recommended Collector method, an OpenTelemetry Collector runs on each developer machine. The Collector filters Codex telemetry locally and forwards the required telemetry to LinearB.

Use the Collector configuration generated by LinearB when setting up the integration.

Why use a Collector? The Collector filters Codex telemetry on the developer machine before it is sent to LinearB. This includes removing apply_patch arguments so that code changes contained in those events remain in your environment.

Data Collection

Codex begins sending telemetry after the OpenTelemetry configuration is active and Codex has been restarted.

No historical backfill: The OpenTelemetry integration collects data from the time the configuration becomes active. Historical Codex telemetry from before the integration was configured is not collected.

The integration's Last used value typically updates within minutes after LinearB receives telemetry. Usage data and metrics typically appear in LinearB within a few hours.


Manage the Ingest Token

LinearB generates a write-only ingest token for the Codex OpenTelemetry integration. The token authenticates telemetry sent to LinearB.

The ingest token is shown when it is issued. If the token was not saved, rotate it to generate a new token.

Rotate the Ingest Token

  1. Go to Settings → Company Settings → AI Tools → Integrations.
  2. Open the Codex OpenTelemetry integration.
  3. Under Main Settings, locate the Ingest Token.
  4. Click Rotate.
  5. Save the new token securely.
  6. Update your OpenTelemetry configuration to use the new token.
  7. Restart Codex after applying the updated configuration.
After rotating the token, configurations that use the previous token must be updated with the new value.

Verify the Connection

  1. Complete the OpenTelemetry configuration for Codex.
  2. Restart Codex.
  3. Use the Codex CLI or IDE extension to generate activity.
  4. In LinearB, go to Settings → Company Settings → AI Tools → Integrations.
  5. Open the Codex OpenTelemetry integration.
  6. Check Last used to confirm that telemetry has reached LinearB.

Last used typically updates within minutes. Usage data and metrics typically appear in LinearB within a few hours.


Edit the Integration

Open the Codex OpenTelemetry integration to review its current configuration. Use the available controls under Main Settings to update supported settings or rotate the ingest token.

The provider and connection type cannot be changed when editing an integration. To use a different Codex connection type, add a new Codex integration.

Troubleshooting

Last Used Does Not Update

If Last used does not update after generating Codex activity:

  • Confirm that you generated activity using the Codex CLI or IDE extension. Codex on the web does not send telemetry.
  • Confirm that the current LinearB ingest token is used by the OpenTelemetry configuration.
  • Verify that the generated configuration was added to the correct Codex configuration file.
  • Confirm that Codex was restarted after the configuration was applied.
  • For Collector-based configurations, confirm that the OpenTelemetry Collector is running on the developer machine.
  • Confirm that telemetry can reach the configured LinearB endpoint.

Last Used Updates but Metrics Do Not Appear

If Last used is updating, LinearB is receiving telemetry from Codex. Usage data and metrics are processed separately and typically appear within a few hours.

Ingest Token Was Not Saved

If the ingest token is no longer available, click Rotate to generate a new token and update the OpenTelemetry configuration with the new value.

Integration Shows an Error

Open the integration and review the connection status and configuration. Verify the ingest token and OpenTelemetry configuration before retrying the connection.

How did we do?

Connect Claude Code using the Analytics API

Connect Codex to LinearB using the Analytics API

Contact