**PR Summary**
This PR adds the OpenTelemetry `host.name` resource attribute to Codex
OTEL exports so every OTEL log (and trace, via the shared resource)
carries the machine hostname.
**What changed**
- Added `host.name` to the shared OTEL `Resource` in
`/Users/michael.mcgrew/code/codex/codex-rs/otel/src/otel_provider.rs`
- This applies to both:
- OTEL logs (`SdkLoggerProvider`)
- OTEL traces (`SdkTracerProvider`)
- Hostname is now resolved via `gethostname::gethostname()`
(best-effort)
- Value is trimmed
- Empty values are omitted (non-fatal)
- Added focused unit tests for:
- including `host.name` when present
- omitting `host.name` when missing/empty
**Why**
- `host.name` is host/process metadata and belongs on the OTEL
`resource`, not per-event attributes.
- Attaching it in the shared resource is the smallest change that
guarantees coverage across all exported OTEL logs/traces.
**Scope / Non-goals**
- No public API changes
- No changes to metrics behavior (this PR only updates log/trace
resource metadata)
**Dependency updates**
- Added `gethostname` as a workspace dependency and `codex-otel`
dependency
- `Cargo.lock` updated accordingly
- `MODULE.bazel.lock` unchanged after refresh/check
**Validation**
- `just fmt`
- `cargo test -p codex-otel`
- `just bazel-lock-update`
- `just bazel-lock-check`
71 lines
1.9 KiB
TOML
71 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
|
|
|
|
[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_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 }
|