From 7a59d2d80a257c4fd9e7b243245afe985d5afab2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9E=D1=87=D0=B5=D1=80=D0=B5=D1=82=D0=BE=D0=B2=D0=B8?= =?UTF-8?q?=D1=87=20=D0=9E=D0=BA=D1=81=D0=B0=D0=BD=D0=B0?= Date: Sat, 20 Dec 2025 19:27:09 +0200 Subject: [PATCH] Avoid panic when Datadog telemetry client initialization fails --- update-agent/core/src/telemetry.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/update-agent/core/src/telemetry.rs b/update-agent/core/src/telemetry.rs index 24c69ae86..5a4e1ade4 100644 --- a/update-agent/core/src/telemetry.rs +++ b/update-agent/core/src/telemetry.rs @@ -9,7 +9,16 @@ pub const NO_TAGS: &[&str] = &[]; fn init_datadog_client() -> Client { let datadog_options = Options::default(); - Client::new(datadog_options).unwrap() + + match Client::new(datadog_options) { + Ok(client) => client, + Err(err) => { + tracing::error!( + "failed to initialize datadog telemetry client: {err:?}" + ); + Client::disabled() + } + } } /// A trait for logging errors instead of propagating the error with `?`.