minimally-tested exemplar support for rw 1.1

Signed-off-by: Nicolás Pazos <npazosmendez@gmail.com>
This commit is contained in:
Nicolás Pazos 2023-11-09 16:57:16 -03:00
parent 8426752e0f
commit 8353c337b4
3 changed files with 8 additions and 19 deletions

View file

@ -1620,21 +1620,13 @@ func populateMinimizedTimeSeries(symbolTable *rwSymbolTable, batch []timeSeries,
Timestamp: d.timestamp, Timestamp: d.timestamp,
}) })
nPendingSamples++ nPendingSamples++
// TODO: handle all types case tExemplar:
//case tExemplar: pendingData[nPending].Exemplars = append(pendingData[nPending].Exemplars, prompb.Exemplar{
// // TODO(npazosmendez) optimize? Labels: labelsToLabelsProto(d.exemplarLabels, nil),
// l := make([]prompb.LabelRef, 0, d.exemplarLabels.Len()) Value: d.value,
// d.exemplarLabels.Range(func(el labels.Label) { Timestamp: d.timestamp,
// nRef := pool.intern(el.Name) })
// vRef := pool.intern(el.Value) nPendingExemplars++
// 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 tHistogram: case tHistogram:
pendingData[nPending].Histograms = append(pendingData[nPending].Histograms, HistogramToHistogramProto(d.timestamp, d.histogram)) pendingData[nPending].Histograms = append(pendingData[nPending].Histograms, HistogramToHistogramProto(d.timestamp, d.histogram))
nPendingHistograms++ nPendingHistograms++

View file

@ -1503,11 +1503,9 @@ func BenchmarkBuildMinimizedWriteRequest(b *testing.B) {
symbolTable := newRwSymbolTable() symbolTable := newRwSymbolTable()
buff := make([]byte, 0) buff := make([]byte, 0)
seriesBuff := make([]prompb.MinimizedTimeSeries, len(tc.batch)) seriesBuff := make([]prompb.MinimizedTimeSeries, len(tc.batch))
//total := 0
for i := range seriesBuff { for i := range seriesBuff {
seriesBuff[i].Samples = []prompb.Sample{{}} seriesBuff[i].Samples = []prompb.Sample{{}}
// todo: add other types seriesBuff[i].Exemplars = []prompb.Exemplar{{}}
//seriesBuff[i].Exemplars = []prompb.Exemplar{{}}
} }
pBuf := []byte{} pBuf := []byte{}

View file

@ -308,7 +308,6 @@ func (h *writeHandler) writeMin(ctx context.Context, req *prompb.MinimizedWriteR
for _, ep := range ts.Exemplars { for _, ep := range ts.Exemplars {
e := exemplarProtoToExemplar(ep) e := exemplarProtoToExemplar(ep)
//e := exemplarRefProtoToExemplar(req.StringSymbolTable, ep)
h.appendExemplar(app, e, ls, &outOfOrderExemplarErrs) h.appendExemplar(app, e, ls, &outOfOrderExemplarErrs)
} }