fix(telemetry): console logs to WARN+ while logs go out over OTLP (#579)
CI / Check (push) Skipped
CI / Detect Changes (push) Successful in 5s
CI / Deploy Docs (push) Skipped
CI / Deploy MCP (push) Successful in 3m28s
CI / Deploy Dashboard (push) Successful in 4m17s
CI / Deploy Agent (push) Successful in 6m0s

This commit was merged in pull request #579.
This commit is contained in:
sharang committed 2026-10-29 11:58:25 +00:00
1 parent fad23c20a9
commit 24001850ec
1 file changed
+9 -1
+9 -1
View File
@@ -13,6 +13,7 @@
//! | `OTEL_EXPORTER_OTLP_ENDPOINT` | OTLP collector endpoint (e.g. `https://otel.example.com`) | *(disabled)* |
//! | `OTEL_SERVICE_NAME` | Service name for resource | `service_name` param |
//! | `RUST_LOG` / standard `EnvFilter` | Log level filter | `info` |
//! | `LOG_CONSOLE` | Console (stdout) filter while OTLP export is on; the logs reach SigNoz via OTLP, so the console copy is only a fallback | `warn` |
use opentelemetry::global;
use opentelemetry::trace::TracerProvider as _;
@@ -123,9 +124,16 @@ pub fn init_telemetry(service_name: &str) -> TelemetryGuard {
.add_directive("h2=off".parse().unwrap_or_default())
.add_directive("reqwest=off".parse().unwrap_or_default());
// The OTLP log records are the copy SigNoz uses (structured, with
// severity and trace context). The node agent also ships stdout, so
// a full console copy would store every line twice; keep it to
// warnings and errors unless LOG_CONSOLE says otherwise.
let console_filter =
EnvFilter::try_from_env("LOG_CONSOLE").unwrap_or_else(|_| EnvFilter::new("warn"));
tracing_subscriber::registry()
.with(env_filter)
.with(fmt_layer)
.with(fmt_layer.with_filter(console_filter))
.with(otel_trace_layer)
.with(otel_log_layer.with_filter(otel_filter))
.init();