From 1d71253653846ed3b92fe05fb0c9c8d183a729bc Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Fri, 15 May 2020 17:35:59 +0300 Subject: [PATCH] app/vmagent/remotewrite: allow ingesting time series with multiple samples at once Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/481 --- app/vmagent/remotewrite/pendingseries.go | 9 ++------- app/vmagent/remotewrite/remotewrite.go | 2 -- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/app/vmagent/remotewrite/pendingseries.go b/app/vmagent/remotewrite/pendingseries.go index 9d51ec653d..469c9d9447 100644 --- a/app/vmagent/remotewrite/pendingseries.go +++ b/app/vmagent/remotewrite/pendingseries.go @@ -150,13 +150,8 @@ func (wr *writeRequest) copyTimeSeries(dst, src *prompbmarshal.TimeSeries) { } dst.Labels = labelsDst[labelsLen:] - samplesDst = append(samplesDst, prompbmarshal.Sample{}) - dstSample := &samplesDst[len(samplesDst)-1] - if len(src.Samples) != 1 { - logger.Panicf("BUG: unexpected number of samples in time series; got %d; want 1", len(src.Samples)) - } - *dstSample = src.Samples[0] - dst.Samples = samplesDst[len(samplesDst)-1:] + samplesDst = append(samplesDst, src.Samples...) + dst.Samples = samplesDst[len(samplesDst)-len(src.Samples):] wr.samples = samplesDst wr.labels = labelsDst diff --git a/app/vmagent/remotewrite/remotewrite.go b/app/vmagent/remotewrite/remotewrite.go index a15308996c..c6390cc817 100644 --- a/app/vmagent/remotewrite/remotewrite.go +++ b/app/vmagent/remotewrite/remotewrite.go @@ -86,8 +86,6 @@ func Stop() { // Push sends wr to remote storage systems set via `-remoteWrite.url`. // -// Each timeseries in wr.Timeseries must contain one sample. -// // Note that wr may be modified by Push due to relabeling. func Push(wr *prompbmarshal.WriteRequest) { var rctx *relabelCtx