From 5f49322c2638b25a9e3f4c1a75e8d389ebcc7873 Mon Sep 17 00:00:00 2001 From: BominRahmani Date: Wed, 29 Jan 2025 08:25:49 -0500 Subject: [PATCH] fixed test --- connector/loganomalyconnector/connector.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/connector/loganomalyconnector/connector.go b/connector/loganomalyconnector/connector.go index 1a319c247..b607d351e 100644 --- a/connector/loganomalyconnector/connector.go +++ b/connector/loganomalyconnector/connector.go @@ -101,7 +101,10 @@ func (d *Detector) processLogBatch(batch logBatch) { } // Add counts to current window - logCount := batch.logs.LogRecordCount() + var logCount int + if batch.logs != (plog.Logs{}) { // Check if logs is not empty + logCount = batch.logs.LogRecordCount() + } d.counts[len(d.counts)-1] += int64(logCount) // Check for anomalies using the fixed window counts