remote-write receiver: reuse 'ref' to optimize multiple samples for same series (#12580)

reuse 'ref' to optimize multi samples processing efficiency

Signed-off-by: changlin.shi <changlin.shi@ly.com>
pull/12595/head
LHHDZ 1 year ago committed by GitHub
parent 0e12f11d61
commit 7d8f9b0978
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -119,8 +119,9 @@ func (h *writeHandler) write(ctx context.Context, req *prompb.WriteRequest) (err
samplesWithInvalidLabels++ samplesWithInvalidLabels++
continue continue
} }
var ref storage.SeriesRef
for _, s := range ts.Samples { for _, s := range ts.Samples {
_, err = app.Append(0, labels, s.Timestamp, s.Value) ref, err = app.Append(ref, labels, s.Timestamp, s.Value)
if err != nil { if err != nil {
unwrappedErr := errors.Unwrap(err) unwrappedErr := errors.Unwrap(err)
if unwrappedErr == nil { if unwrappedErr == nil {

Loading…
Cancel
Save