From 25ac979a58e442142db0ffe13012adbe9f3e0fc9 Mon Sep 17 00:00:00 2001 From: Morgan Creekmore Date: Mon, 19 Aug 2024 15:02:11 -0500 Subject: [PATCH] Don't log all injector names if there are more than 25 unused injectors --- .../Reactions/Matching/MatchInjectorsHandler.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Contrast.K8s.AgentOperator/Core/Reactions/Matching/MatchInjectorsHandler.cs b/src/Contrast.K8s.AgentOperator/Core/Reactions/Matching/MatchInjectorsHandler.cs index c07facfe..31208b06 100644 --- a/src/Contrast.K8s.AgentOperator/Core/Reactions/Matching/MatchInjectorsHandler.cs +++ b/src/Contrast.K8s.AgentOperator/Core/Reactions/Matching/MatchInjectorsHandler.cs @@ -74,11 +74,19 @@ private async ValueTask Handle(CancellationToken cancellationToken = default) if (unusedInjectors.Any()) { - Logger.Info(() => + var unusedCount = unusedInjectors.Count; + if(unusedCount >= 25) { - var unusedInjectorsStr = string.Join(", ", unusedInjectors.Select(x => $"'{x.Identity}'")); - return $"A total of {unusedInjectors.Count} valid injectors do not match any known entities. (Unused injectors: [{unusedInjectorsStr}])"; - }); + Logger.Info(() => $"A total of {unusedCount} valid injectors do not match any known entities."); + } + else + { + Logger.Info(() => + { + var unusedInjectorsStr = string.Join(", ", unusedInjectors.Select(x => $"'{x.Identity}'")); + return $"A total of {unusedCount} valid injectors do not match any known entities. (Unused injectors: [{unusedInjectorsStr}])"; + }); + } } }