diff --git a/model/labels/labels.go b/model/labels/labels.go index 74e5a5764..b6663dad2 100644 --- a/model/labels/labels.go +++ b/model/labels/labels.go @@ -412,12 +412,8 @@ func (b *ScratchBuilder) Reset() { // Add a name/value pair. // Note if you Add the same name twice you will get a duplicate label, which is invalid. -func (b *ScratchBuilder) Add(name, value string, identifyingLabels ...string) { - identifying := false - if len(identifyingLabels) > 0 && slices.Contains(identifyingLabels, name) { - identifying = true - } - b.add = append(b.add, Label{Name: name, Value: value, Identifying: identifying}) +func (b *ScratchBuilder) Add(name, value string) { + b.add = append(b.add, Label{Name: name, Value: value}) } // Add a name/value pair, using []byte instead of string. diff --git a/model/labels/labels_common.go b/model/labels/labels_common.go index cf9d1a61e..2a722b84c 100644 --- a/model/labels/labels_common.go +++ b/model/labels/labels_common.go @@ -16,7 +16,6 @@ package labels import ( "bytes" "encoding/json" - "fmt" "strconv" "github.com/prometheus/common/model" @@ -37,13 +36,6 @@ var seps = []byte{'\xff'} // Label is a key/value pair of strings. type Label struct { Name, Value string - // Identifying signifies whether this is an identifying label for an info metric. - Identifying bool -} - -// String returns l's string representation. -func (l Label) String() string { - return fmt.Sprintf("%s=%s", l.Name, l.Value) } func (ls Labels) String() string { diff --git a/model/labels/labels_stringlabels.go b/model/labels/labels_stringlabels.go index 54c25b8b5..f53c3b2d0 100644 --- a/model/labels/labels_stringlabels.go +++ b/model/labels/labels_stringlabels.go @@ -620,12 +620,8 @@ func (b *ScratchBuilder) Reset() { // Add a name/value pair. // Note if you Add the same name twice you will get a duplicate label, which is invalid. -func (b *ScratchBuilder) Add(name, value string, identifyingLabels ...string) { - identifying := false - if len(identifyingLabels) > 0 && slices.Contains(identifyingLabels, name) { - identifying = true - } - b.add = append(b.add, Label{Name: name, Value: value, Identifying: identifying}) +func (b *ScratchBuilder) Add(name, value string) { + b.add = append(b.add, Label{Name: name, Value: value}) } // Add a name/value pair, using []byte instead of string to reduce memory allocations. diff --git a/model/labels/labels_test.go b/model/labels/labels_test.go index 8d6088419..8bade5851 100644 --- a/model/labels/labels_test.go +++ b/model/labels/labels_test.go @@ -582,7 +582,7 @@ func TestBuilder(t *testing.T) { }, { base: FromStrings("aaa", "111", "bbb", "222", "ccc", "333"), - set: []Label{{Name: "aaa", Value: "444"}, {Name: "bbb", Value: "555"}, {Name: "ccc", Value: "666"}}, + set: []Label{{"aaa", "444"}, {"bbb", "555"}, {"ccc", "666"}}, want: FromStrings("aaa", "444", "bbb", "555", "ccc", "666"), }, { diff --git a/prompb/types.pb.go b/prompb/types.pb.go index 4088c52d2..fa9553ae1 100644 --- a/prompb/types.pb.go +++ b/prompb/types.pb.go @@ -666,7 +666,7 @@ type TimeSeries struct { Samples []Sample `protobuf:"bytes,2,rep,name=samples,proto3" json:"samples"` Exemplars []Exemplar `protobuf:"bytes,3,rep,name=exemplars,proto3" json:"exemplars"` Histograms []Histogram `protobuf:"bytes,4,rep,name=histograms,proto3" json:"histograms"` - IdentifyingLabels []string `protobuf:"bytes,5,rep,name=identifyingLabels,proto3" json:"identifyingLabels,omitempty"` + DataLabels []string `protobuf:"bytes,5,rep,name=dataLabels,proto3" json:"dataLabels,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -733,9 +733,9 @@ func (m *TimeSeries) GetHistograms() []Histogram { return nil } -func (m *TimeSeries) GetIdentifyingLabels() []string { +func (m *TimeSeries) GetDataLabels() []string { if m != nil { - return m.IdentifyingLabels + return m.DataLabels } return nil } @@ -1154,77 +1154,76 @@ func init() { func init() { proto.RegisterFile("types.proto", fileDescriptor_d938547f84707355) } var fileDescriptor_d938547f84707355 = []byte{ - // 1107 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xdd, 0x8e, 0xdb, 0x44, - 0x14, 0x5e, 0xdb, 0x89, 0x13, 0x9f, 0xfc, 0xac, 0x77, 0xd8,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0x06, 0xab, 0x58, 0xbf, 0x5e, 0xc9, 0xdd, 0x63, 0xc2, - 0xe6, 0x54, 0x6e, 0x52, 0x49, 0x76, 0x57, 0xb6, 0xcb, 0x9d, 0x3f, 0x35, 0x28, 0x9f, 0x2c, 0x96, - 0xec, 0x15, 0xda, 0x87, 0x5a, 0xe0, 0xb1, 0xb1, 0x1c, 0xbc, 0x5c, 0xb3, 0x15, 0x78, 0x4c, 0x76, - 0xbc, 0xcb, 0x95, 0x9f, 0xdc, 0xac, 0xfd, 0xe9, 0xcb, 0x14, 0x90, 0x9b, 0xd4, 0xdf, 0x4d, 0x8b, - 0x60, 0xa8, 0x22, 0xec, 0x15, 0x8b, 0xa0, 0x12, 0x74, 0x7b, 0x6c, 0x12, 0x4e, 0x3d, 0x36, 0xcf, - 0x2b, 0x20, 0x5f, 0x7c, 0xf5, 0x55, 0x75, 0xac, 0xd6, 0xce, 0x73, 0xa8, 0x66, 0xac, 0x3b, 0xa3, - 0xfe, 0xfd, 0x40, 0x3e, 0xc8, 0x1b, 0xaf, 0xb0, 0x8e, 0x3e, 0x80, 0xed, 0xd3, 0xcb, 0xc1, 0xd1, - 0x68, 0x5c, 0x78, 0x9a, 0x9d, 0x1f, 0xa1, 0xa1, 0x32, 0xd2, 0xe9, 0xff, 0x1d, 0xd4, 0x03, 0x30, - 0x27, 0x72, 0x87, 0x6c, 0x4e, 0x77, 0xee, 0x7c, 0x4d, 0x16, 0x90, 0xd0, 0x8e, 0x77, 0xdf, 0xdc, - 0xee, 0x6b, 0x7f, 0xdc, 0xee, 0x6b, 0x7f, 0xdf, 0xee, 0x6b, 0x3f, 0x98, 0x92, 0x1d, 0x5d, 0x5f, - 0x9b, 0xea, 0x87, 0xe8, 0x8b, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x87, 0xea, 0x24, 0x91, 0x41, - 0x09, 0x00, 0x00, + // 1100 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 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} func (m *MetricMetadata) Marshal() (dAtA []byte, err error) { @@ -1639,11 +1638,11 @@ func (m *TimeSeries) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if len(m.IdentifyingLabels) > 0 { - for iNdEx := len(m.IdentifyingLabels) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.IdentifyingLabels[iNdEx]) - copy(dAtA[i:], m.IdentifyingLabels[iNdEx]) - i = encodeVarintTypes(dAtA, i, uint64(len(m.IdentifyingLabels[iNdEx]))) + if len(m.DataLabels) > 0 { + for iNdEx := len(m.DataLabels) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.DataLabels[iNdEx]) + copy(dAtA[i:], m.DataLabels[iNdEx]) + i = encodeVarintTypes(dAtA, i, uint64(len(m.DataLabels[iNdEx]))) i-- dAtA[i] = 0x2a } @@ -2241,8 +2240,8 @@ func (m *TimeSeries) Size() (n int) { n += 1 + l + sovTypes(uint64(l)) } } - if len(m.IdentifyingLabels) > 0 { - for _, s := range m.IdentifyingLabels { + if len(m.DataLabels) > 0 { + for _, s := range m.DataLabels { l = len(s) n += 1 + l + sovTypes(uint64(l)) } @@ -3552,7 +3551,7 @@ func (m *TimeSeries) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IdentifyingLabels", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DataLabels", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3580,7 +3579,7 @@ func (m *TimeSeries) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.IdentifyingLabels = append(m.IdentifyingLabels, string(dAtA[iNdEx:postIndex])) + m.DataLabels = append(m.DataLabels, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex diff --git a/prompb/types.proto b/prompb/types.proto index 8df7af1c6..17b68d9a4 100644 --- a/prompb/types.proto +++ b/prompb/types.proto @@ -127,7 +127,8 @@ message TimeSeries { repeated Sample samples = 2 [(gogoproto.nullable) = false]; repeated Exemplar exemplars = 3 [(gogoproto.nullable) = false]; repeated Histogram histograms = 4 [(gogoproto.nullable) = false]; - repeated string identifyingLabels = 5; + // data labels for target_info metrics. + repeated string dataLabels = 5; } message Label { diff --git a/storage/remote/codec.go b/storage/remote/codec.go index 47f8e3ef5..9cf1ed871 100644 --- a/storage/remote/codec.go +++ b/storage/remote/codec.go @@ -760,10 +760,10 @@ func LabelProtosToMetric(labelPairs []*prompb.Label) model.Metric { return metric } -func labelProtosToLabels(labelPairs []prompb.Label, identifyingLabels ...string) labels.Labels { +func labelProtosToLabels(labelPairs []prompb.Label) labels.Labels { b := labels.ScratchBuilder{} for _, l := range labelPairs { - b.Add(l.Name, l.Value, identifyingLabels...) + b.Add(l.Name, l.Value) } b.Sort() return b.Labels() diff --git a/storage/remote/otlptranslator/prometheusremotewrite/helper.go b/storage/remote/otlptranslator/prometheusremotewrite/helper.go index 19bba9d4a..718d4140f 100644 --- a/storage/remote/otlptranslator/prometheusremotewrite/helper.go +++ b/storage/remote/otlptranslator/prometheusremotewrite/helper.go @@ -72,8 +72,7 @@ func (a ByLabelName) Swap(i, j int) { a[i], a[j] = a[j], a[i] } // creates a new TimeSeries in the map if not found and returns the time series signature. // tsMap will be unmodified if either labels or sample is nil, but can still be modified if the exemplar is nil. func addSample(tsMap map[string]*prompb.TimeSeries, sample *prompb.Sample, labels []prompb.Label, - datatype string, isTargetMetric bool) string { - + datatype string) string { if sample == nil || labels == nil || tsMap == nil { return "" } @@ -84,18 +83,9 @@ func addSample(tsMap map[string]*prompb.TimeSeries, sample *prompb.Sample, label if ok { ts.Samples = append(ts.Samples, *sample) } else { - var identifyingLabels []string - if isTargetMetric { - identifyingLabels = []string{ - model.InstanceLabel, - model.JobLabel, - } - slices.Sort(identifyingLabels) - } newTs := &prompb.TimeSeries{ - Labels: labels, - Samples: []prompb.Sample{*sample}, - IdentifyingLabels: identifyingLabels, + Labels: labels, + Samples: []prompb.Sample{*sample}, } tsMap[sig] = newTs } @@ -300,7 +290,7 @@ func addSingleHistogramDataPoint(pt pmetric.HistogramDataPoint, resource pcommon } sumlabels := createLabels(sumStr) - addSample(tsMap, sum, sumlabels, metric.Type().String(), false) + addSample(tsMap, sum, sumlabels, metric.Type().String()) } @@ -314,7 +304,7 @@ func addSingleHistogramDataPoint(pt pmetric.HistogramDataPoint, resource pcommon } countlabels := createLabels(countStr) - addSample(tsMap, count, countlabels, metric.Type().String(), false) + addSample(tsMap, count, countlabels, metric.Type().String()) // cumulative count for conversion to cumulative histogram var cumulativeCount uint64 @@ -336,7 +326,7 @@ func addSingleHistogramDataPoint(pt pmetric.HistogramDataPoint, resource pcommon } boundStr := strconv.FormatFloat(bound, 'f', -1, 64) labels := createLabels(bucketStr, leStr, boundStr) - sig := addSample(tsMap, bucket, labels, metric.Type().String(), false) + sig := addSample(tsMap, bucket, labels, metric.Type().String()) bucketBounds = append(bucketBounds, bucketBoundsData{sig: sig, bound: bound}) } @@ -350,7 +340,7 @@ func addSingleHistogramDataPoint(pt pmetric.HistogramDataPoint, resource pcommon infBucket.Value = float64(pt.Count()) } infLabels := createLabels(bucketStr, leStr, pInfStr) - sig := addSample(tsMap, infBucket, infLabels, metric.Type().String(), false) + sig := addSample(tsMap, infBucket, infLabels, metric.Type().String()) bucketBounds = append(bucketBounds, bucketBoundsData{sig: sig, bound: math.Inf(1)}) addExemplars(tsMap, promExemplars, bucketBounds) @@ -496,7 +486,7 @@ func addSingleSummaryDataPoint(pt pmetric.SummaryDataPoint, resource pcommon.Res sum.Value = math.Float64frombits(value.StaleNaN) } sumlabels := createLabels(baseName + sumStr) - addSample(tsMap, sum, sumlabels, metric.Type().String(), false) + addSample(tsMap, sum, sumlabels, metric.Type().String()) // treat count as a sample in an individual TimeSeries count := &prompb.Sample{ @@ -507,7 +497,7 @@ func addSingleSummaryDataPoint(pt pmetric.SummaryDataPoint, resource pcommon.Res count.Value = math.Float64frombits(value.StaleNaN) } countlabels := createLabels(baseName + countStr) - addSample(tsMap, count, countlabels, metric.Type().String(), false) + addSample(tsMap, count, countlabels, metric.Type().String()) // process each percentile/quantile for i := 0; i < pt.QuantileValues().Len(); i++ { @@ -521,7 +511,7 @@ func addSingleSummaryDataPoint(pt pmetric.SummaryDataPoint, resource pcommon.Res } percentileStr := strconv.FormatFloat(qt.Quantile(), 'f', -1, 64) qtlabels := createLabels(baseName, quantileStr, percentileStr) - addSample(tsMap, quantile, qtlabels, metric.Type().String(), false) + addSample(tsMap, quantile, qtlabels, metric.Type().String()) } // add _created time series if needed @@ -586,7 +576,16 @@ func addResourceTargetInfo(resource pcommon.Resource, settings Settings, timesta // convert ns to ms Timestamp: convertTimeStamp(timestamp), } - addSample(tsMap, sample, labels, infoType, true) + sig := addSample(tsMap, sample, labels, infoType) + + dataLabels := make([]string, 0, len(labels)) + for _, l := range labels { + if l.Name != model.InstanceLabel && l.Name != model.JobLabel { + dataLabels = append(dataLabels, l.Name) + } + } + slices.Sort(dataLabels) + tsMap[sig].DataLabels = dataLabels } // convertTimeStamp converts OTLP timestamp in ns to timestamp in ms diff --git a/storage/remote/otlptranslator/prometheusremotewrite/number_data_points.go b/storage/remote/otlptranslator/prometheusremotewrite/number_data_points.go index 4d9d09cfe..85684ad6d 100644 --- a/storage/remote/otlptranslator/prometheusremotewrite/number_data_points.go +++ b/storage/remote/otlptranslator/prometheusremotewrite/number_data_points.go @@ -47,7 +47,7 @@ func addSingleGaugeNumberDataPoint( if pt.Flags().NoRecordedValue() { sample.Value = math.Float64frombits(value.StaleNaN) } - addSample(series, sample, labels, metric.Type().String(), false) + addSample(series, sample, labels, metric.Type().String()) } // addSingleSumNumberDataPoint converts the Sum metric data point to a Prometheus @@ -80,7 +80,7 @@ func addSingleSumNumberDataPoint( if pt.Flags().NoRecordedValue() { sample.Value = math.Float64frombits(value.StaleNaN) } - sig := addSample(series, sample, labels, metric.Type().String(), false) + sig := addSample(series, sample, labels, metric.Type().String()) if ts, ok := series[sig]; sig != "" && ok { exemplars := getPromExemplars[pmetric.NumberDataPoint](pt) diff --git a/storage/remote/write_handler.go b/storage/remote/write_handler.go index 718f0c635..b592002fa 100644 --- a/storage/remote/write_handler.go +++ b/storage/remote/write_handler.go @@ -114,7 +114,7 @@ func (h *writeHandler) write(ctx context.Context, req *prompb.WriteRequest) (err var exemplarErr error for _, ts := range req.Timeseries { - labels := labelProtosToLabels(ts.Labels, ts.IdentifyingLabels...) + labels := labelProtosToLabels(ts.Labels) if !labels.IsValid() { level.Warn(h.logger).Log("msg", "Invalid metric names or labels", "got", labels.String()) samplesWithInvalidLabels++ @@ -122,8 +122,6 @@ func (h *writeHandler) write(ctx context.Context, req *prompb.WriteRequest) (err } var ref storage.SeriesRef for _, s := range ts.Samples { - // When recording a sample for an info type metric with identifying labels, - // make sure also to persist which of the labels are identifying ref, err = app.Append(ref, labels, s.Timestamp, s.Value) if err != nil { unwrappedErr := errors.Unwrap(err) @@ -135,7 +133,6 @@ func (h *writeHandler) write(ctx context.Context, req *prompb.WriteRequest) (err } return err } - } for _, ep := range ts.Exemplars { @@ -170,6 +167,13 @@ func (h *writeHandler) write(ctx context.Context, req *prompb.WriteRequest) (err return err } } + + if len(ts.DataLabels) > 0 { + // Info type metric with metadata represented as data labels + if err := app.AppendDataLabels(ts.DataLabels, ts.Samples[0].Timestamp); err != nil { + return err + } + } } if outOfOrderExemplarErrs > 0 {