feat(otel): export logs through the tracing pipeline, correlated with traces (#147)
Logs were a separate pipeline: env_logger in debug (never exported) and opentelemetry-appender-log in release (exported without trace context, so SigNoz could not link logs to traces). - tracing-subscriber `tracing-log` feature: try_init installs LogTracer, so log:: records become tracing events: one console format, and RUST_LOG per-module directives still apply to them. - opentelemetry-appender-tracing exports events as OTel log records when OTLP_OTLS_ENDPOINT is set (any build), stamped with the enclosing span's trace_id/span_id. A per-layer filter drops the exporter's own crates. - The OTel span layer keeps only WARN/ERROR events as span events; the info/debug copies duplicated the correlated logs. - Remove env_logger init in the server, init_logs, and the unused opentelemetry-appender-log / opentelemetry-stdout deps. - tests/otel_log_correlation.rs pins correlation (native + bridged), the span-event filter, and per-module filtering of bridged records. - Constitution 1.2.0 (Principle V logging rule), CLAUDE.md, README, .env.example. Closes #147 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
79b339a2a6
commit
3b3e6bdb39
9 files changed
+284
-106
No files matched your search
+8
-6
@@ -39,11 +39,11 @@ rayon = "1.5"
|
||||
path-absolutize = "3.1"
|
||||
log = "0.4"
|
||||
env_logger = "0.11.5"
|
||||
# default-features = false keeps the `tracing-log` bridge OFF so the console
|
||||
# fmt layer prints tracing spans only; `log` records stay on their existing
|
||||
# path (env_logger in debug, OTel logs in release) without double-printing.
|
||||
# `tracing-log` is ON: `try_init` installs the LogTracer bridge, so `log::`
|
||||
# records become tracing events and share the one console format + OTel
|
||||
# log export (#147 spike).
|
||||
tracing = "0.1"
|
||||
tracing-subscriber = { version = "0.3", default-features = false, features = ["std", "registry", "env-filter", "fmt", "ansi"] }
|
||||
tracing-subscriber = { version = "0.3", default-features = false, features = ["std", "registry", "env-filter", "fmt", "ansi", "tracing-log"] }
|
||||
tracing-opentelemetry = "0.32"
|
||||
tracing-actix-web = { version = "0.7", features = ["opentelemetry_0_31"] }
|
||||
actix-web-prom = "0.9.0"
|
||||
@@ -54,8 +54,6 @@ rand = "0.8.5"
|
||||
opentelemetry = { version = "0.31.0", features = ["default", "metrics", "tracing"] }
|
||||
opentelemetry_sdk = { version = "0.31.0", features = ["default", "rt-tokio-current-thread", "metrics", "testing"] }
|
||||
opentelemetry-otlp = { version = "0.31.0", features = ["default", "metrics", "tracing", "grpc-tonic"] }
|
||||
opentelemetry-stdout = "0.31.0"
|
||||
opentelemetry-appender-log = "0.31.0"
|
||||
tempfile = "3.20.0"
|
||||
regex = "1.11.1"
|
||||
exif = { package = "kamadak-exif", version = "0.6.1" }
|
||||
@@ -76,8 +74,12 @@ indicatif = "0.17"
|
||||
uuid = { version = "1.10", features = ["v4", "serde"] }
|
||||
chrono-tz = "0.10"
|
||||
tzf-rs = "2.1.2"
|
||||
opentelemetry-appender-tracing = { version = "0.31", features = ["experimental_use_tracing_span_context", "experimental_metadata_attributes"] }
|
||||
|
||||
# Windows lacks system sqlite3, so re-enable the bundled C build there.
|
||||
# Linux/macOS use the system library (faster builds, smaller binary).
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
libsqlite3-sys = { version = "0.35", features = ["bundled"] }
|
||||
|
||||
[dev-dependencies]
|
||||
tracing-log = "0.2"
|
||||
Reference in new issue
Block a user