Files
codex/codex-rs/otel/Cargo.toml
Felipe Coury d7d526b81d Prepare the telemetry shutdown worker during initialization (#39050)
## Why

Creating the telemetry shutdown thread during shutdown can fail under resource
pressure, including when the native thread guard page cannot be allocated.

## What changed

- Start and verify a dedicated shutdown worker when `OtelProvider` is created.
- Send the provider to the prepared worker for bounded shutdown, while preserving
  timeout behavior and avoiding a potentially blocking destructor if worker
  preparation failed.
- Rename the fallible provider constructor to `try_new`.

## Testing

Add Unix regression coverage that injects guard-page allocation failures, plus
coverage for worker preparation failure, successful shutdown, and timeouts.

GitOrigin-RevId: 3656298078a800a7fa392437c2ee4a68753092e3
2026-08-17 19:06:53 +00:00

72 lines
1.9 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
[dependencies]
chrono = { workspace = true }
codex-utils-absolute-path = { workspace = true }
codex-utils-string = { workspace = true }
codex-api = { workspace = true }
codex-protocol = { workspace = true }
eventsource-stream = { workspace = true }
gethostname = { 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_trace_batch_span_processor_with_async_runtime",
"experimental_metrics_custom_reader",
"logs",
"metrics",
"rt-tokio",
"testing",
"trace",
] }
http = { workspace = true }
os_info = { 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 }
tokio-tungstenite = { 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 }
[target.'cfg(unix)'.dev-dependencies]
libc = { workspace = true }
[target.'cfg(target_os = "linux")'.dev-dependencies]
seccompiler = { workspace = true }