From 8a079a0d6d6a290c0672e51c2392d0a0a52f9adb Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Tue, 2 Jan 2024 13:41:15 +0800 Subject: [PATCH] allow disabling with env var Signed-off-by: Bugen Zhao --- src/utils/runtime/src/logger.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/utils/runtime/src/logger.rs b/src/utils/runtime/src/logger.rs index f0b6bb5cbfda..11e82150de4a 100644 --- a/src/utils/runtime/src/logger.rs +++ b/src/utils/runtime/src/logger.rs @@ -18,6 +18,7 @@ use std::path::PathBuf; use either::Either; use risingwave_common::metrics::MetricsLayer; use risingwave_common::util::deployment::Deployment; +use risingwave_common::util::env_var::env_var_is_true; use risingwave_common::util::query_log::*; use thiserror_ext::AsReport; use tracing::level_filters::LevelFilter as Level; @@ -59,10 +60,12 @@ impl LoggerSettings { /// /// If env var `RW_TRACING_ENDPOINT` is not set, the meta address will be used /// as the default tracing endpoint, which means that the embedded tracing - /// collector will be used. + /// collector will be used. This can be disabled by setting env var + /// `RW_DISABLE_EMBEDDED_TRACING` to `true`. pub fn from_opts(opts: &O) -> Self { let mut settings = Self::new(O::name()); - if settings.tracing_endpoint.is_none() // no explicit env var is set + if settings.tracing_endpoint.is_none() // no explicit endpoint + && !env_var_is_true("RW_DISABLE_EMBEDDED_TRACING") // not disabled by env var && let Some(addr) = opts.meta_addr().exactly_one() // meta address is valid && !Deployment::current().is_ci() // not in CI