This PR attempts to solve two problems by introducing a `AbsolutePathBuf` type with a special deserializer: - `AbsolutePathBuf` attempts to be a generally useful abstraction, as it ensures, by constructing, that it represents a value that is an absolute, normalized path, which is a stronger guarantee than an arbitrary `PathBuf`. - Values in `config.toml` that can be either an absolute or relative path should be resolved against the folder containing the `config.toml` in the relative path case. This PR makes this easy to support: the main cost is ensuring `AbsolutePathBufGuard` is used inside `deserialize_config_toml_with_base()`. While `AbsolutePathBufGuard` may seem slightly distasteful because it relies on thread-local storage, this seems much cleaner to me than using than my various experiments with https://docs.rs/serde/latest/serde/de/trait.DeserializeSeed.html. Further, since the `deserialize()` method from the `Deserialize` trait is not async, we do not really have to worry about the deserialization work being spread across multiple threads in a way that would interfere with `AbsolutePathBufGuard`. To start, this PR introduces the use of `AbsolutePathBuf` in `OtelTlsConfig`. Note how this simplifies `otel_provider.rs` because it no longer requires `settings.codex_home` to be threaded through. Furthermore, this sets us up better for a world where multiple `config.toml` files from different folders could be loaded and then merged together, as the absolutifying of the paths must be done against the correct parent folder.
54 lines
1.5 KiB
TOML
54 lines
1.5 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]
|
|
# Compile-time gate for OTLP support; disabled by default.
|
|
# Downstream crates can enable via `features = ["otel"]`.
|
|
default = []
|
|
otel = ["opentelemetry", "opentelemetry_sdk", "opentelemetry-otlp", "tonic"]
|
|
|
|
[dependencies]
|
|
chrono = { workspace = true }
|
|
codex-app-server-protocol = { workspace = true }
|
|
codex-utils-absolute-path = { workspace = true }
|
|
codex-protocol = { workspace = true }
|
|
eventsource-stream = { workspace = true }
|
|
opentelemetry = { workspace = true, features = ["logs"], optional = true }
|
|
opentelemetry-otlp = { workspace = true, features = [
|
|
"grpc-tonic",
|
|
"http-proto",
|
|
"http-json",
|
|
"logs",
|
|
"reqwest-blocking-client",
|
|
"reqwest-rustls",
|
|
"tls",
|
|
"tls-roots",
|
|
], optional = true }
|
|
opentelemetry-semantic-conventions = { workspace = true }
|
|
opentelemetry_sdk = { workspace = true, features = [
|
|
"logs",
|
|
"rt-tokio",
|
|
], optional = true }
|
|
http = { workspace = true }
|
|
reqwest = { workspace = true, features = ["blocking", "rustls-tls"] }
|
|
serde = { workspace = true, features = ["derive"] }
|
|
serde_json = { workspace = true }
|
|
strum_macros = { workspace = true }
|
|
tokio = { workspace = true }
|
|
tonic = { workspace = true, optional = true, features = [
|
|
"transport",
|
|
"tls-native-roots",
|
|
"tls-ring",
|
|
] }
|
|
tracing = { workspace = true }
|