Describe the Bug
statsItem.samplingInHour() in consumer/statistics.go appends a snapshot to csListDay but trims csListHour:
si.csListDay.PushBack(callSnapshot{...})
if si.csListDay.Len() > 25 {
si.csListHour.Remove(si.csListDay.Front()) // wrong list
}
container/list.Remove(e) is a no-op when e does not belong to that list, so nothing is ever removed: csListDay grows by one snapshot per hour per statsItem forever. The sibling methods samplingInSeconds/samplingInMinutes push and trim the same list, which shows this is a copy-paste slip.
Steps to Reproduce
Call samplingInHour() 30 times on a fresh statsItem; csListDay.Len() is 30 instead of the intended cap 25.
What Did You Expect to See?
csListDay capped at 25 entries (a ~25-hour sliding window for the day-level stats).
What Did You See Instead?
Unbounded growth (slow memory leak, one snapshot per hour per topic/group statsItem), and getStatsDataInDay() computes over an ever-growing window instead of the intended ~25-hour one, skewing day-level TPS/AVGPT.
Additional Context
Fix incoming: si.csListDay.Remove(si.csListDay.Front()), aligning with the sibling sampling methods; includes a regression test.
Describe the Bug
statsItem.samplingInHour()inconsumer/statistics.goappends a snapshot tocsListDaybut trimscsListHour:container/list.Remove(e)is a no-op whenedoes not belong to that list, so nothing is ever removed:csListDaygrows by one snapshot per hour per statsItem forever. The sibling methodssamplingInSeconds/samplingInMinutespush and trim the same list, which shows this is a copy-paste slip.Steps to Reproduce
Call
samplingInHour()30 times on a freshstatsItem;csListDay.Len()is 30 instead of the intended cap 25.What Did You Expect to See?
csListDaycapped at 25 entries (a ~25-hour sliding window for the day-level stats).What Did You See Instead?
Unbounded growth (slow memory leak, one snapshot per hour per topic/group statsItem), and
getStatsDataInDay()computes over an ever-growing window instead of the intended ~25-hour one, skewing day-level TPS/AVGPT.Additional Context
Fix incoming:
si.csListDay.Remove(si.csListDay.Front()), aligning with the sibling sampling methods; includes a regression test.