Skip to content

Export turn cost as an OTEL metric - #40488

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/e60587079f097f10cc1b6d1bf889d3f7a0dc3d5f
Aug 24, 2026
Merged

Export turn cost as an OTEL metric#40488
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/e60587079f097f10cc1b6d1bf889d3f7a0dc3d5f

Conversation

@copyberry

@copyberry copyberry Bot commented Aug 24, 2026

Copy link
Copy Markdown

Export turn cost as an OTEL metric

What changed

  • Emit codex.turn.cost_microusd as a counter with turn, conversation,
    interruption, speed, and reasoning-effort attributes. Convert the estimated
    USD string to microdollars, rounding to the nearest microdollar and skipping
    values that cannot be represented safely.
  • Start turn-cost collection when an OTLP metrics exporter is configured, even
    when the OTEL log exporter is disabled.

Testing

  • Verify cost conversion, rounding, and metric attributes with an in-memory
    metrics snapshot.
  • Verify that a metrics-only OTLP configuration starts the turn-cost worker.

## What changed

- Emit `codex.turn.cost_microusd` as a counter with turn, conversation,
  interruption, speed, and reasoning-effort attributes. Convert the estimated
  USD string to microdollars, rounding to the nearest microdollar and skipping
  values that cannot be represented safely.
- Start turn-cost collection when an OTLP metrics exporter is configured, even
  when the OTEL log exporter is disabled.

## Testing

- Verify cost conversion, rounding, and metric attributes with an in-memory
  metrics snapshot.
- Verify that a metrics-only OTLP configuration starts the turn-cost worker.

GitOrigin-RevId: e60587079f097f10cc1b6d1bf889d3f7a0dc3d5f
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/e60587079f097f10cc1b6d1bf889d3f7a0dc3d5f branch from 0cce6d9 to 2497518 Compare August 24, 2026 22:45
@copyberry
copyberry Bot merged commit 2497518 into main Aug 24, 2026
27 of 32 checks passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/e60587079f097f10cc1b6d1bf889d3f7a0dc3d5f branch August 24, 2026 22:46
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant