Refactor: Add observability enable flag, improve comments, remove unused config params, and enhance run function error logging. (#689)

* improve code for dns log

* fix

* Improve comments, remove unused parameters in config.rs (opt), add observability enable flag, and enhance error logging in run function execution.
This commit is contained in:
houseme
2025-10-23 13:59:57 +08:00
committed by GitHub
parent f30698ec7f
commit 416d3ad5b7
12 changed files with 190 additions and 126 deletions
+3
View File
@@ -13,6 +13,7 @@
// limitations under the License.
use crate::config::OtelConfig;
use crate::global::{IS_OBSERVABILITY_ENABLED, OBSERVABILITY_METER_NAME};
use flexi_logger::{
Age, Cleanup, Criterion, DeferredNow, FileSpec, LogSpecification, Naming, Record, WriteMode,
WriteMode::{AsyncWith, BufferAndFlush},
@@ -302,6 +303,8 @@ pub(crate) fn init_telemetry(config: &OtelConfig) -> OtelGuard {
logger_level,
env::var("RUST_LOG").unwrap_or_else(|_| "Not set".to_string())
);
IS_OBSERVABILITY_ENABLED.set(true).ok();
OBSERVABILITY_METER_NAME.set(service_name.to_string()).ok();
}
}