From d97935723d16497d4ce8e44d20b5cd0f320a5634 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= <mail@jkroepke.de> Date: Fri, 27 Dec 2024 22:02:23 +0100 Subject: [PATCH] performancecounter: fix panic with counter names having brackets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de> --- .../performancecounter/performancecounter_test_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/collector/performancecounter/performancecounter_test_test.go b/internal/collector/performancecounter/performancecounter_test_test.go index e15e5f103..a9c541950 100644 --- a/internal/collector/performancecounter/performancecounter_test_test.go +++ b/internal/collector/performancecounter/performancecounter_test_test.go @@ -129,10 +129,10 @@ windows_performancecounter_processor_information_processor_time\{core="0,0",stat }, { name: "counter with spaces and brackets", - object: "User Input Delay per Session", + object: "invalid", instances: nil, - buildErr: pdh.NewPdhError(pdh.CstatusNoCounter).Error(), - counters: []performancecounter.Counter{{Name: "Max Session Input Delay (ms)", Type: "counter"}}, + buildErr: pdh.NewPdhError(pdh.CstatusNoObject).Error(), + counters: []performancecounter.Counter{{Name: "Total Memory Usage --- Non-Paged Pool", Type: "counter"}, {Name: "Max Session Input Delay (ms)", Type: "counter"}}, expectedMetrics: nil, }, } {