mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
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>
This commit is contained in:
parent
0e12f11d61
commit
7d8f9b0978
|
@ -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…
Reference in a new issue