fix(telemetry): console logs to WARN+ while logs go out over OTLP
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 14m28s
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 14m28s
With OTLP export on, SigNoz got every Prüfwerk line twice: the OTLP record (structured, severity, trace context) and the node agent's copy of stdout (plain text, often without severity). The console layer now filters with LOG_CONSOLE (default warn) in that mode; INFO reaches SigNoz over OTLP only. Without OTLP the console is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KYcAAeTw22GE9QPzDM8yc4
This commit is contained in:
1 parent
fad23c20a9
commit
3ae6b808d8
1 file changed
+9
-1
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user