mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
Summary of changes:
- Adds a new feature flag: runtime_metrics
- Declared in core/src/features.rs
- Added to core/config.schema.json
- Wired into OTEL init in core/src/otel_init.rs
- Enables on-demand runtime metric snapshots in OTEL
- Adds runtime_metrics: bool to otel/src/config.rs
- Enables experimental custom reader features in otel/Cargo.toml
- Adds snapshot/reset/summary APIs in:
- otel/src/lib.rs
- otel/src/metrics/client.rs
- otel/src/metrics/config.rs
- otel/src/metrics/error.rs
- Defines metric names and a runtime summary builder
- New files:
- otel/src/metrics/names.rs
- otel/src/metrics/runtime_metrics.rs
- Summarizes totals for:
- Tool calls
- API requests
- SSE/streaming events
- Instruments metrics collection in OTEL manager
- otel/src/traces/otel_manager.rs now records:
- API call counts + durations
- SSE event counts + durations (success/failure)
- Tool call metrics now use shared constants
- Surfaces runtime metrics in the TUI
- Resets runtime metrics at turn start in tui/src/chatwidget.rs
- Displays metrics in the final separator line in
tui/src/history_cell.rs
- Adds tests
- New OTEL tests:
- otel/tests/suite/snapshot.rs
- otel/tests/suite/runtime_summary.rs
- New TUI test:
- final_message_separator_includes_runtime_metrics in
tui/src/history_cell.rs
Scope:
- 19 files changed
- ~652 insertions, 38 deletions
<img width="922" height="169" alt="Screenshot 2026-01-30 at 4 11 34 PM"
src="https://github.com/user-attachments/assets/1efd754d-a16d-4564-83a5-f4442fd2f998"
/>
69 lines
1.8 KiB
TOML
69 lines
1.8 KiB
TOML
[package]
|
|
name = "codex-otel"
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
|
|
[lib]
|
|
doctest = false
|
|
name = "codex_otel"
|
|
path = "src/lib.rs"
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[features]
|
|
## Disables the built-in default metrics exporter.
|
|
##
|
|
## Intended for use from `dev-dependencies` so unit/integration tests never
|
|
## attempt to export metrics over the network.
|
|
disable-default-metrics-exporter = []
|
|
|
|
[dependencies]
|
|
chrono = { workspace = true }
|
|
codex-app-server-protocol = { workspace = true }
|
|
codex-utils-absolute-path = { workspace = true }
|
|
codex-api = { workspace = true }
|
|
codex-protocol = { workspace = true }
|
|
eventsource-stream = { workspace = true }
|
|
opentelemetry = { workspace = true, features = ["logs", "metrics", "trace"] }
|
|
opentelemetry-appender-tracing = { workspace = true }
|
|
opentelemetry-otlp = { workspace = true, features = [
|
|
"grpc-tonic",
|
|
"http-proto",
|
|
"http-json",
|
|
"logs",
|
|
"metrics",
|
|
"trace",
|
|
"reqwest-blocking-client",
|
|
"reqwest-rustls",
|
|
"tls",
|
|
"tls-roots",
|
|
]}
|
|
opentelemetry-semantic-conventions = { workspace = true }
|
|
opentelemetry_sdk = { workspace = true, features = [
|
|
"experimental_metrics_custom_reader",
|
|
"logs",
|
|
"metrics",
|
|
"rt-tokio",
|
|
"testing",
|
|
"trace",
|
|
] }
|
|
http = { workspace = true }
|
|
reqwest = { workspace = true, features = ["blocking", "rustls-tls"] }
|
|
serde = { workspace = true, features = ["derive"] }
|
|
serde_json = { workspace = true }
|
|
strum_macros = { workspace = true }
|
|
thiserror = { workspace = true }
|
|
tokio = { workspace = true }
|
|
tracing = { workspace = true }
|
|
tracing-opentelemetry = { workspace = true }
|
|
tracing-subscriber = { workspace = true }
|
|
|
|
[dev-dependencies]
|
|
opentelemetry_sdk = { workspace = true, features = [
|
|
"experimental_metrics_custom_reader",
|
|
"testing",
|
|
] }
|
|
pretty_assertions = { workspace = true }
|