From 04fd66870530c98098926e8053724c0a5d2c7e5d Mon Sep 17 00:00:00 2001 From: Andrei Date: Fri, 3 Jul 2026 16:28:30 +0200 Subject: [PATCH] =?UTF-8?q?fix(collector):=20C#=20log=20quality=20?= =?UTF-8?q?=E2=80=94=20quiet=20graceful-stop=20discard,=20HTTP=20code=20in?= =?UTF-8?q?=20single-command=20failure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mirror of the native log-quality fixes (#1225) for the two issues that also exist in C#: DataProcessor.LogDiscardedItems logs graceful-shutdown discards at Info, not Error (expected/contracted, fired on every stop); CommandHandler single-command failure now includes the HTTP StatusCode, matching the batch path. Logging-only, no behavior change. net6.0 builds clean; 27 shutdown/command tests pass (net48). Registration resilience (native #5) is already better in C# (persistent queue retries connection failures); runtime-registration Info verbosity (native #1) deferred. Co-Authored-By: Claude Opus 4.8 --- .../Client/HttpsClient/RequestHandlers/CommandHandlers.cs | 2 +- src/collector/HSMDataCollector/Core/DataProcessor.cs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/collector/HSMDataCollector/Client/HttpsClient/RequestHandlers/CommandHandlers.cs b/src/collector/HSMDataCollector/Client/HttpsClient/RequestHandlers/CommandHandlers.cs index e69e46192a..a22e0e27fe 100644 --- a/src/collector/HSMDataCollector/Client/HttpsClient/RequestHandlers/CommandHandlers.cs +++ b/src/collector/HSMDataCollector/Client/HttpsClient/RequestHandlers/CommandHandlers.cs @@ -92,7 +92,7 @@ internal override async ValueTask HandleRequestResultAsync(HttpResponseMessage r var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); var error = await JsonSerializer.DeserializeAsync(stream, cancellationToken: token).ConfigureAwait(false); - _logger.Error($"Command request for {value.Path} has been faulted. {error}."); + _logger.Error($"Command request for {value.Path} has been faulted. Status Code: {response.StatusCode}, Status Text: {error}."); } else { diff --git a/src/collector/HSMDataCollector/Core/DataProcessor.cs b/src/collector/HSMDataCollector/Core/DataProcessor.cs index 90ebb73491..24536f5975 100644 --- a/src/collector/HSMDataCollector/Core/DataProcessor.cs +++ b/src/collector/HSMDataCollector/Core/DataProcessor.cs @@ -392,8 +392,10 @@ private void EmitOverflowDrops(string queueName, int droppedCount) private void LogDiscardedItems(int count, string queueName) { + // Info, not Error: discarding still-buffered values on a graceful shutdown is expected and + // contracted (a stop must not block on a dead/slow transport) — it is not a fault. if (count > 0) - _logger.Error($"{queueName} queue discarded {count} item(s) during collector shutdown."); + _logger.Info($"{queueName} queue discarded {count} item(s) during collector shutdown."); } private void RollbackStartedQueues(bool dataStarted, bool priorityStarted, bool fileStarted, bool commandStarted)