From 67b30ded87a4d7c9b2c028b42443bfa56e7aa481 Mon Sep 17 00:00:00 2001 From: Bill Date: Tue, 17 Dec 2024 08:49:22 -0800 Subject: [PATCH] Trim host-id whitespace on Linux (#141) Co-authored-by: Cijo Thomas --- opentelemetry-resource-detectors/src/host.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/opentelemetry-resource-detectors/src/host.rs b/opentelemetry-resource-detectors/src/host.rs index 64aeff36..febed0d0 100644 --- a/opentelemetry-resource-detectors/src/host.rs +++ b/opentelemetry-resource-detectors/src/host.rs @@ -52,6 +52,7 @@ fn host_id_detect() -> Option { let dbus_machine_id_path = Path::new("/var/lib/dbus/machine-id"); read_to_string(machine_id_path) .or_else(|_| read_to_string(dbus_machine_id_path)) + .map(|id| id.trim().to_string()) .ok() }