Skip to content

Commit 2268095

Browse files
committed
refactor(rw2): delete unused functions
Signed-off-by: György Krajcsovits <[email protected]>
1 parent 1a5ec1d commit 2268095

File tree

2 files changed

+0
-40
lines changed

2 files changed

+0
-40
lines changed

pkg/mimirpb/compat_rw2.go

-8
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,6 @@ var (
2222
invalidUnitRefError = errors.New("proto: Remote Write 2.0 invalid unit reference")
2323
)
2424

25-
// getRW2Symbol resolves the symbol reference to a string.
26-
func getRW2Symbol(ref uint32, symbols []string) (string, error) {
27-
if ref < uint32(len(symbols)) {
28-
return symbols[ref], nil
29-
}
30-
return "", fmt.Errorf("symbol reference %d is out of bounds", ref)
31-
}
32-
3325
// rw2SymbolPageSize is the size of each page in bits.
3426
const rw2SymbolPageSize = 16
3527

pkg/mimirpb/timeseries.go

-32
Original file line numberDiff line numberDiff line change
@@ -79,27 +79,6 @@ func (p *PreallocWriteRequest) Unmarshal(dAtA []byte) error {
7979
return p.WriteRequest.Unmarshal(dAtA)
8080
}
8181

82-
// labelRefsToLabelAdapter converts a slice of label references to a slice
83-
// of LabelAdapter.
84-
func labelRefsToLabelAdapter(refs []uint32, symbols []string) ([]LabelAdapter, error) {
85-
if len(refs)%2 != 0 {
86-
return nil, fmt.Errorf("invalid number of label references: %d", len(refs))
87-
}
88-
labels := make([]LabelAdapter, 0, len(refs)/2)
89-
for i := 0; i < len(refs); i += 2 {
90-
name, err := getRW2Symbol(refs[i], symbols)
91-
if err != nil {
92-
return nil, err
93-
}
94-
value, err := getRW2Symbol(refs[i+1], symbols)
95-
if err != nil {
96-
return nil, err
97-
}
98-
labels = append(labels, LabelAdapter{Name: name, Value: value})
99-
}
100-
return labels, nil
101-
}
102-
10382
// getMetricName cuts the mandatory OpenMetrics suffix from the
10483
// seriesName and returns the metric name and whether it cut the suffix.
10584
// Based on https://github.com/prometheus/OpenMetrics/blob/main/specification/OpenMetrics.md#suffixes
@@ -141,17 +120,6 @@ func getMetricName(seriesName string, metricType MetadataRW2_MetricType) (string
141120
}
142121
}
143122

144-
// getSeriesName finds and returns the __name__ label value from the given
145-
// labels.
146-
func getSeriesName(lbls []LabelAdapter) string {
147-
for i := 0; i < len(lbls); i += 2 {
148-
if lbls[i].Name == labels.MetricName {
149-
return lbls[i].Value
150-
}
151-
}
152-
return ""
153-
}
154-
155123
func (p *WriteRequest) ClearTimeseriesUnmarshalData() {
156124
for idx := range p.Timeseries {
157125
p.Timeseries[idx].clearUnmarshalData()

0 commit comments

Comments
 (0)