## Summary This PR fixes OTLP HTTP trace export in runtimes where the previous exporter setup was unreliable, especially around app-server usage. It also removes the old `codex_otel::otel_provider` compatibility shim and switches remaining call sites over to the crate-root `codex_otel::OtelProvider` export. ## What changed - Use a runtime-safe OTLP HTTP trace exporter path for Tokio runtimes. - Add an async HTTP client path for trace export when we are already inside a multi-thread Tokio runtime. - Make provider shutdown flush traces before tearing down the tracer provider. - Add loopback coverage that verifies traces are actually sent to `/v1/traces`: - outside Tokio - inside a multi-thread Tokio runtime - inside a current-thread Tokio runtime - Remove the `codex_otel::otel_provider` shim and update remaining imports. ## Why I hit cases where spans were being created correctly but never made it to the collector. The issue turned out to be in exporter/runtime behavior rather than the span plumbing itself. This PR narrows that gap and gives us regression coverage for the actual export path.
72 lines
2 KiB
TOML
72 lines
2 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-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 }
|