diff --git a/lib/streamaggr/streamaggr.go b/lib/streamaggr/streamaggr.go index 19e0be433..d975f9406 100644 --- a/lib/streamaggr/streamaggr.go +++ b/lib/streamaggr/streamaggr.go @@ -674,6 +674,7 @@ func (a *aggregator) flush(pushFunc PushFunc) { ctx := getFlushCtx(a, pushFunc) as.flushState(ctx) ctx.flushSeries() + ctx.resetSeries() putFlushCtx(ctx) }(as) } @@ -925,8 +926,6 @@ func (ctx *flushCtx) flushSeries() { } auxLabels.Labels = dstLabels promutils.PutLabels(auxLabels) - - ctx.resetSeries() } func (ctx *flushCtx) appendSeries(key, suffix string, timestamp int64, value float64) { @@ -948,6 +947,7 @@ func (ctx *flushCtx) appendSeries(key, suffix string, timestamp int64, value flo // Limit the maximum length of ctx.tss in order to limit memory usage. if len(ctx.tss) >= 10_000 { ctx.flushSeries() + ctx.resetSeries() } }