Skip to content

Commit

Permalink
fix build and small bugfix
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolás Pazos <npazosmendez@gmail.com>
  • Loading branch information
npazosmendez committed Dec 21, 2023
1 parent 7dff2c9 commit 5fc3ac0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion storage/remote/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ func exemplarProtoToExemplar(ep prompb.Exemplar) exemplar.Exemplar {
}
}

func minMetadataProtoToMetadata(mp *writev2.Metadata, symbols []string) metadata.Metadata {
func minMetadataProtoToMetadata(mp writev2.Metadata, symbols []string) metadata.Metadata {
return metadata.Metadata{
Type: metricTypeFromProtoEquivalent(mp.Type),
Unit: symbols[mp.UnitRef], // TODO: check for overflow
Expand Down
4 changes: 2 additions & 2 deletions storage/remote/codec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,14 @@ var writeRequestMinimizedFixture = func() *writev2.WriteRequest {
Samples: []writev2.Sample{{Value: 1, Timestamp: 0}},
Exemplars: []writev2.Exemplar{{LabelsRefs: []uint32{10, 11}, Value: 1, Timestamp: 0}},
Histograms: []writev2.Histogram{HistogramToMinHistogramProto(0, &testHistogram), FloatHistogramToMinHistogramProto(1, testHistogram.ToFloat(nil))},
Metadata: &writev2.Metadata{Type: writev2.Metadata_COUNTER, HelpRef: 14, UnitRef: 15},
Metadata: writev2.Metadata{Type: writev2.Metadata_COUNTER, HelpRef: 14, UnitRef: 15},
},
{
LabelsRefs: labels,
Samples: []writev2.Sample{{Value: 2, Timestamp: 1}},
Exemplars: []writev2.Exemplar{{LabelsRefs: []uint32{12, 13}, Value: 2, Timestamp: 1}},
Histograms: []writev2.Histogram{HistogramToMinHistogramProto(2, &testHistogram), FloatHistogramToMinHistogramProto(3, testHistogram.ToFloat(nil))},
Metadata: &writev2.Metadata{Type: writev2.Metadata_GAUGE, HelpRef: 16, UnitRef: 17},
Metadata: writev2.Metadata{Type: writev2.Metadata_GAUGE, HelpRef: 16, UnitRef: 17},
},
},
Symbols: st.LabelsStrings(),
Expand Down
8 changes: 3 additions & 5 deletions storage/remote/queue_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -1663,17 +1663,15 @@ func populateMinimizedTimeSeriesStr(symbolTable *rwSymbolTable, batch []timeSeri
if sendNativeHistograms {
pendingData[nPending].Histograms = pendingData[nPending].Histograms[:0]
}
if sendMetadata {
pendingData[nPending].Metadata = &writev2.Metadata{}
}

// Number of pending samples is limited by the fact that sendSamples (via sendSamplesWithBackoff)
// retries endlessly, so once we reach max samples, if we can never send to the endpoint we'll
// stop reading from the queue. This makes it safe to reference pendingSamples by index.
// pendingData[nPending].Labels = labelsToLabelsProto(d.seriesLabels, pendingData[nPending].Labels)

pendingData[nPending].LabelsRefs = labelsToUint32SliceStr(d.seriesLabels, symbolTable, pendingData[nPending].LabelsRefs)
if sendMetadata {
pendingData[nPending].Metadata = &writev2.Metadata{
if sendMetadata && d.metadata != nil {
pendingData[nPending].Metadata = writev2.Metadata{
Type: metricTypeToProtoEquivalent(d.metadata.Type),
HelpRef: symbolTable.RefStr(d.metadata.Help),
UnitRef: symbolTable.RefStr(d.metadata.Unit),
Expand Down

0 comments on commit 5fc3ac0

Please sign in to comment.