From d9ba0bc5fad898c8aab8fa325e49fda2a174a27f Mon Sep 17 00:00:00 2001 From: Junchao-Mellanox Date: Wed, 17 Dec 2025 12:27:53 +0200 Subject: [PATCH 1/2] Ignore invalid output from docker stats command Signed-off-by: Junchao-Mellanox --- crates/procdockerstatsd-rs/src/main.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/procdockerstatsd-rs/src/main.rs b/crates/procdockerstatsd-rs/src/main.rs index 99cc11a7..510d9dd1 100644 --- a/crates/procdockerstatsd-rs/src/main.rs +++ b/crates/procdockerstatsd-rs/src/main.rs @@ -9,12 +9,13 @@ use std::fs; use std::collections::HashMap; use std::sync::LazyLock; use procfs; -use tracing::{error, info}; +use tracing::{error, info, warn}; use syslog_tracing; use std::ffi::CString; use serde::Deserialize; const UPDATE_INTERVAL: u64 = 120; // 2 minutes +const INVALID_CONTAINER_NAME: &str = "—-"; // invalid container name returned by docker stats command #[derive(Debug, Deserialize)] #[serde(rename_all = "PascalCase")] @@ -98,11 +99,18 @@ fn parse_docker_json_output(json_output: &str) -> HashMap s, Err(e) => { - error!("Failed to parse docker stats JSON: {}", e); + error!("Failed to parse docker stats JSON for output {} with error {}", line, e); continue; } }; + if stats.name.is_empty() || stats.name == INVALID_CONTAINER_NAME { + // If a container stops suddenly after we send the docker stats command, + // it might return with a container name "—-". We should ignore such output. + warn!("Skipping docker stats JSON for container {} with output: {}", stats.id, line); + continue; + } + let key = format!("DOCKER_STATS|{}", stats.id); let mut container_data = HashMap::new(); From 56c575d9fd2594a3177aecf060cc3891ea6a02a5 Mon Sep 17 00:00:00 2001 From: Junchao-Mellanox Date: Tue, 23 Dec 2025 07:46:57 +0200 Subject: [PATCH 2/2] Fix checker failure Signed-off-by: Junchao-Mellanox --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index fa5a6db0..18d76f17 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -27,7 +27,7 @@ stages: vmImage: ubuntu-24.04 container: - image: sonicdev-microsoft.azurecr.io:443/sonic-slave-bookworm:$(BUILD_BRANCH) + image: sonicdev-microsoft.azurecr.io:443/sonic-slave-bookworm-amd64:$(BUILD_BRANCH) steps: - checkout: self