Skip to content

[codex] Add second-based OTEL duration histograms#27058

Open
richardopenai wants to merge 1 commit into
mainfrom
codex/otel-duration-seconds
Open

[codex] Add second-based OTEL duration histograms#27058
richardopenai wants to merge 1 commit into
mainfrom
codex/otel-duration-seconds

Conversation

@richardopenai

@richardopenai richardopenai commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Why

Exec-server request and connection latencies need fractional-second histograms. The existing duration API records integer milliseconds and uses millisecond-scale buckets.

What changed

  • Adds a described duration API that records Duration values as fractional seconds.
  • Uses second-scale explicit histogram boundaries.
  • Rejects reuse of a metric name with conflicting unit or description metadata.
  • Covers exact boundaries, representative bucket placement, fractional sums, and metadata conflicts.

This PR only adds the duration primitive. It does not add exec-server adoption.

Stack

  1. [codex] Add OTEL counter descriptions #26091: counter descriptions
  2. [codex] Add reusable OTEL gauge instruments #27057: gauge instruments
  3. [codex] Add second-based OTEL duration histograms #27058: second-based duration histograms
  4. [codex] Initialize exec-server OpenTelemetry at startup #25019: initialize exec-server OpenTelemetry at startup

Related independent coverage: #27059 tests OTLP HTTP log and trace event export.

Validation

  • just test -p codex-otel
  • just fix -p codex-otel
  • just fmt

name: &str,
value: f64,
unit: &'static str,
description: &str,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The other changes have both bare metrics and those with descriptions -- it seems like this change will require descriptions for duration histograms. Is that intentional?

@richardopenai richardopenai force-pushed the codex/otel-duration-seconds branch from c81e483 to a848c75 Compare June 8, 2026 21:19
richardopenai added a commit that referenced this pull request Jun 8, 2026
## Why

Metric descriptions should be declared with reusable OTEL instruments
instead of being coupled to individual consumers. Counter descriptions
are the smallest API primitive needed by the exec-server observability
work.

## What changed

- Adds `counter_with_description` while preserving the existing counter
API.
- Caches counters by name and description so instrument metadata remains
part of the declaration identity.
- Covers the exported description together with the existing value and
attribute contract.

This PR only adds counter descriptions. It does not add gauges,
second-based durations, or exec-server adoption.

## Stack

1. **#26091: counter descriptions**
2. #27057: gauge instruments
3. #27058: second-based duration histograms

Related independent coverage: #27059 tests OTLP HTTP log and trace event
export.

The `codex-exec-server` bounded service tag now stays with the
exec-server adoption change instead of this reusable infrastructure
stack.

## Validation

- `just test -p codex-otel`
- `just fix -p codex-otel`
- `just fmt`
dkropachev pushed a commit to dkropachev/codex that referenced this pull request Jun 9, 2026
## Why

Metric descriptions should be declared with reusable OTEL instruments
instead of being coupled to individual consumers. Counter descriptions
are the smallest API primitive needed by the exec-server observability
work.

## What changed

- Adds `counter_with_description` while preserving the existing counter
API.
- Caches counters by name and description so instrument metadata remains
part of the declaration identity.
- Covers the exported description together with the existing value and
attribute contract.

This PR only adds counter descriptions. It does not add gauges,
second-based durations, or exec-server adoption.

## Stack

1. **openai#26091: counter descriptions**
2. openai#27057: gauge instruments
3. openai#27058: second-based duration histograms

Related independent coverage: openai#27059 tests OTLP HTTP log and trace event
export.

The `codex-exec-server` bounded service tag now stays with the
exec-server adoption change instead of this reusable infrastructure
stack.

## Validation

- `just test -p codex-otel`
- `just fix -p codex-otel`
- `just fmt`
dkropachev pushed a commit to dkropachev/codex that referenced this pull request Jun 9, 2026
## Why

Metric descriptions should be declared with reusable OTEL instruments
instead of being coupled to individual consumers. Counter descriptions
are the smallest API primitive needed by the exec-server observability
work.

## What changed

- Adds `counter_with_description` while preserving the existing counter
API.
- Caches counters by name and description so instrument metadata remains
part of the declaration identity.
- Covers the exported description together with the existing value and
attribute contract.

This PR only adds counter descriptions. It does not add gauges,
second-based durations, or exec-server adoption.

## Stack

1. **openai#26091: counter descriptions**
2. openai#27057: gauge instruments
3. openai#27058: second-based duration histograms

Related independent coverage: openai#27059 tests OTLP HTTP log and trace event
export.

The `codex-exec-server` bounded service tag now stays with the
exec-server adoption change instead of this reusable infrastructure
stack.

## Validation

- `just test -p codex-otel`
- `just fix -p codex-otel`
- `just fmt`
dkropachev pushed a commit to dkropachev/codex that referenced this pull request Jun 9, 2026
## Why

Metric descriptions should be declared with reusable OTEL instruments
instead of being coupled to individual consumers. Counter descriptions
are the smallest API primitive needed by the exec-server observability
work.

## What changed

- Adds `counter_with_description` while preserving the existing counter
API.
- Caches counters by name and description so instrument metadata remains
part of the declaration identity.
- Covers the exported description together with the existing value and
attribute contract.

This PR only adds counter descriptions. It does not add gauges,
second-based durations, or exec-server adoption.

## Stack

1. **openai#26091: counter descriptions**
2. openai#27057: gauge instruments
3. openai#27058: second-based duration histograms

Related independent coverage: openai#27059 tests OTLP HTTP log and trace event
export.

The `codex-exec-server` bounded service tag now stays with the
exec-server adoption change instead of this reusable infrastructure
stack.

## Validation

- `just test -p codex-otel`
- `just fix -p codex-otel`
- `just fmt`
dkropachev pushed a commit to dkropachev/codex that referenced this pull request Jun 9, 2026
## Why

Metric descriptions should be declared with reusable OTEL instruments
instead of being coupled to individual consumers. Counter descriptions
are the smallest API primitive needed by the exec-server observability
work.

## What changed

- Adds `counter_with_description` while preserving the existing counter
API.
- Caches counters by name and description so instrument metadata remains
part of the declaration identity.
- Covers the exported description together with the existing value and
attribute contract.

This PR only adds counter descriptions. It does not add gauges,
second-based durations, or exec-server adoption.

## Stack

1. **openai#26091: counter descriptions**
2. openai#27057: gauge instruments
3. openai#27058: second-based duration histograms

Related independent coverage: openai#27059 tests OTLP HTTP log and trace event
export.

The `codex-exec-server` bounded service tag now stays with the
exec-server adoption change instead of this reusable infrastructure
stack.

## Validation

- `just test -p codex-otel`
- `just fix -p codex-otel`
- `just fmt`
dkropachev pushed a commit to dkropachev/codex that referenced this pull request Jun 9, 2026
## Why

Metric descriptions should be declared with reusable OTEL instruments
instead of being coupled to individual consumers. Counter descriptions
are the smallest API primitive needed by the exec-server observability
work.

## What changed

- Adds `counter_with_description` while preserving the existing counter
API.
- Caches counters by name and description so instrument metadata remains
part of the declaration identity.
- Covers the exported description together with the existing value and
attribute contract.

This PR only adds counter descriptions. It does not add gauges,
second-based durations, or exec-server adoption.

## Stack

1. **openai#26091: counter descriptions**
2. openai#27057: gauge instruments
3. openai#27058: second-based duration histograms

Related independent coverage: openai#27059 tests OTLP HTTP log and trace event
export.

The `codex-exec-server` bounded service tag now stays with the
exec-server adoption change instead of this reusable infrastructure
stack.

## Validation

- `just test -p codex-otel`
- `just fix -p codex-otel`
- `just fmt`
dkropachev pushed a commit to dkropachev/codex that referenced this pull request Jun 9, 2026
## Why

Metric descriptions should be declared with reusable OTEL instruments
instead of being coupled to individual consumers. Counter descriptions
are the smallest API primitive needed by the exec-server observability
work.

## What changed

- Adds `counter_with_description` while preserving the existing counter
API.
- Caches counters by name and description so instrument metadata remains
part of the declaration identity.
- Covers the exported description together with the existing value and
attribute contract.

This PR only adds counter descriptions. It does not add gauges,
second-based durations, or exec-server adoption.

## Stack

1. **openai#26091: counter descriptions**
2. openai#27057: gauge instruments
3. openai#27058: second-based duration histograms

Related independent coverage: openai#27059 tests OTLP HTTP log and trace event
export.

The `codex-exec-server` bounded service tag now stays with the
exec-server adoption change instead of this reusable infrastructure
stack.

## Validation

- `just test -p codex-otel`
- `just fix -p codex-otel`
- `just fmt`
dkropachev pushed a commit to dkropachev/codex that referenced this pull request Jun 9, 2026
## Why

Metric descriptions should be declared with reusable OTEL instruments
instead of being coupled to individual consumers. Counter descriptions
are the smallest API primitive needed by the exec-server observability
work.

## What changed

- Adds `counter_with_description` while preserving the existing counter
API.
- Caches counters by name and description so instrument metadata remains
part of the declaration identity.
- Covers the exported description together with the existing value and
attribute contract.

This PR only adds counter descriptions. It does not add gauges,
second-based durations, or exec-server adoption.

## Stack

1. **openai#26091: counter descriptions**
2. openai#27057: gauge instruments
3. openai#27058: second-based duration histograms

Related independent coverage: openai#27059 tests OTLP HTTP log and trace event
export.

The `codex-exec-server` bounded service tag now stays with the
exec-server adoption change instead of this reusable infrastructure
stack.

## Validation

- `just test -p codex-otel`
- `just fix -p codex-otel`
- `just fmt`
dkropachev pushed a commit to dkropachev/codex that referenced this pull request Jun 9, 2026
## Why

Metric descriptions should be declared with reusable OTEL instruments
instead of being coupled to individual consumers. Counter descriptions
are the smallest API primitive needed by the exec-server observability
work.

## What changed

- Adds `counter_with_description` while preserving the existing counter
API.
- Caches counters by name and description so instrument metadata remains
part of the declaration identity.
- Covers the exported description together with the existing value and
attribute contract.

This PR only adds counter descriptions. It does not add gauges,
second-based durations, or exec-server adoption.

## Stack

1. **openai#26091: counter descriptions**
2. openai#27057: gauge instruments
3. openai#27058: second-based duration histograms

Related independent coverage: openai#27059 tests OTLP HTTP log and trace event
export.

The `codex-exec-server` bounded service tag now stays with the
exec-server adoption change instead of this reusable infrastructure
stack.

## Validation

- `just test -p codex-otel`
- `just fix -p codex-otel`
- `just fmt`
dkropachev pushed a commit to dkropachev/codex that referenced this pull request Jun 9, 2026
## Why

Metric descriptions should be declared with reusable OTEL instruments
instead of being coupled to individual consumers. Counter descriptions
are the smallest API primitive needed by the exec-server observability
work.

## What changed

- Adds `counter_with_description` while preserving the existing counter
API.
- Caches counters by name and description so instrument metadata remains
part of the declaration identity.
- Covers the exported description together with the existing value and
attribute contract.

This PR only adds counter descriptions. It does not add gauges,
second-based durations, or exec-server adoption.

## Stack

1. **openai#26091: counter descriptions**
2. openai#27057: gauge instruments
3. openai#27058: second-based duration histograms

Related independent coverage: openai#27059 tests OTLP HTTP log and trace event
export.

The `codex-exec-server` bounded service tag now stays with the
exec-server adoption change instead of this reusable infrastructure
stack.

## Validation

- `just test -p codex-otel`
- `just fix -p codex-otel`
- `just fmt`
richardopenai added a commit that referenced this pull request Jun 10, 2026
## Why

Exec-server observability needs current-value measurements in addition
to counters. The reusable OTEL client should expose that primitive
without coupling it to exec-server runtime behavior.

## What changed

- Adds integer gauge instruments, with optional descriptions.
- Caches gauges by name and description so instrument metadata remains
part of the declaration identity.
- Covers gauge values, descriptions, merged attributes, and OTLP HTTP
export.

This PR only adds the gauge primitive. It does not add second-based
duration histograms or exec-server adoption.

## Stack

1. #26091: counter descriptions
2. **#27057: gauge instruments**
3. #27058: second-based duration histograms

Related independent coverage: #27059 tests OTLP HTTP log and trace event
export.

## Validation

- `just test -p codex-otel`
- `just fix -p codex-otel`
- `just fmt`
Base automatically changed from codex/otel-gauges to main June 10, 2026 21:36
@richardopenai richardopenai marked this pull request as ready for review June 10, 2026 21:38
@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Review source: Codex Cloud Agents (CCA)

Codex Cloud Agents (CCA) couldn't complete this review. The original Codex Review is unaffected.

@richardopenai richardopenai force-pushed the codex/otel-duration-seconds branch from a848c75 to 7530ed6 Compare June 10, 2026 21:48
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.

2 participants