From 8353c337b4ebab1fb68320c71476f2ac0a5e790f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Pazos?= Date: Thu, 9 Nov 2023 16:57:16 -0300 Subject: [PATCH] minimally-tested exemplar support for rw 1.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolás Pazos --- storage/remote/queue_manager.go | 22 +++++++--------------- storage/remote/queue_manager_test.go | 4 +--- storage/remote/write_handler.go | 1 - 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/storage/remote/queue_manager.go b/storage/remote/queue_manager.go index 43c83b4ce..0d24ee72d 100644 --- a/storage/remote/queue_manager.go +++ b/storage/remote/queue_manager.go @@ -1620,21 +1620,13 @@ func populateMinimizedTimeSeries(symbolTable *rwSymbolTable, batch []timeSeries, Timestamp: d.timestamp, }) nPendingSamples++ - // TODO: handle all types - //case tExemplar: - // // TODO(npazosmendez) optimize? - // l := make([]prompb.LabelRef, 0, d.exemplarLabels.Len()) - // d.exemplarLabels.Range(func(el labels.Label) { - // nRef := pool.intern(el.Name) - // vRef := pool.intern(el.Value) - // l = append(l, prompb.LabelRef{NameRef: nRef, ValueRef: vRef}) - // }) - // pendingData[nPending].Exemplars = append(pendingData[nPending].Exemplars, prompb.ExemplarRef{ - // Labels: l, - // Value: d.value, - // Timestamp: d.timestamp, - // }) - // nPendingExemplars++ + case tExemplar: + pendingData[nPending].Exemplars = append(pendingData[nPending].Exemplars, prompb.Exemplar{ + Labels: labelsToLabelsProto(d.exemplarLabels, nil), + Value: d.value, + Timestamp: d.timestamp, + }) + nPendingExemplars++ case tHistogram: pendingData[nPending].Histograms = append(pendingData[nPending].Histograms, HistogramToHistogramProto(d.timestamp, d.histogram)) nPendingHistograms++ diff --git a/storage/remote/queue_manager_test.go b/storage/remote/queue_manager_test.go index a05a35d16..4b3af8504 100644 --- a/storage/remote/queue_manager_test.go +++ b/storage/remote/queue_manager_test.go @@ -1503,11 +1503,9 @@ func BenchmarkBuildMinimizedWriteRequest(b *testing.B) { symbolTable := newRwSymbolTable() buff := make([]byte, 0) seriesBuff := make([]prompb.MinimizedTimeSeries, len(tc.batch)) - //total := 0 for i := range seriesBuff { seriesBuff[i].Samples = []prompb.Sample{{}} - // todo: add other types - //seriesBuff[i].Exemplars = []prompb.Exemplar{{}} + seriesBuff[i].Exemplars = []prompb.Exemplar{{}} } pBuf := []byte{} diff --git a/storage/remote/write_handler.go b/storage/remote/write_handler.go index 40afc73fa..814e82f47 100644 --- a/storage/remote/write_handler.go +++ b/storage/remote/write_handler.go @@ -308,7 +308,6 @@ func (h *writeHandler) writeMin(ctx context.Context, req *prompb.MinimizedWriteR for _, ep := range ts.Exemplars { e := exemplarProtoToExemplar(ep) - //e := exemplarRefProtoToExemplar(req.StringSymbolTable, ep) h.appendExemplar(app, e, ls, &outOfOrderExemplarErrs) }