vmagent: fixed premature release of the context (after #4247 / #4824) (#4849)

Follow-up after a27c2f3773

https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4247

Signed-off-by: Alexander Marshalov <_@marshalov.org>
This commit is contained in:
Alexander Marshalov 2023-08-17 12:15:03 +02:00 committed by GitHub
parent 39623ae428
commit 1e1a30ed7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -721,9 +721,10 @@ func dropAggregatedSeries(src []prompbmarshal.TimeSeries, matchIdxs []byte, drop
func (rwctx *remoteWriteCtx) pushInternal(tss []prompbmarshal.TimeSeries) { func (rwctx *remoteWriteCtx) pushInternal(tss []prompbmarshal.TimeSeries) {
if len(labelsGlobal) > 0 { if len(labelsGlobal) > 0 {
rctx := getRelabelCtx() rctx := getRelabelCtx()
defer putRelabelCtx(rctx)
tss = rctx.appendExtraLabels(tss, labelsGlobal) tss = rctx.appendExtraLabels(tss, labelsGlobal)
putRelabelCtx(rctx)
} }
pss := rwctx.pss pss := rwctx.pss
idx := atomic.AddUint64(&rwctx.pssNextIdx, 1) % uint64(len(pss)) idx := atomic.AddUint64(&rwctx.pssNextIdx, 1) % uint64(len(pss))
pss[idx].Push(tss) pss[idx].Push(tss)