Browse Source

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
commit
7d8f9b0978
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      storage/remote/write_handler.go

3
storage/remote/write_handler.go

@ -119,8 +119,9 @@ func (h *writeHandler) write(ctx context.Context, req *prompb.WriteRequest) (err
samplesWithInvalidLabels++
continue
}
var ref storage.SeriesRef
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 {
unwrappedErr := errors.Unwrap(err)
if unwrappedErr == nil {

Loading…
Cancel
Save