update remote write path proto so that Labels/Timeseries can't be nil (#4957)

Signed-off-by: Callum Styan <callumstyan@gmail.com>
This commit is contained in:
Callum Styan 2019-01-15 11:13:39 -08:00 committed by Tom Wilkie
parent 375ad1185c
commit 5358f76c5c
8 changed files with 93 additions and 91 deletions

View file

@ -224,8 +224,8 @@ func concatLabels(labels map[string]string) string {
return strings.Join(pairs, separator)
}
func tagsToLabelPairs(name string, tags map[string]string) []*prompb.Label {
pairs := make([]*prompb.Label, 0, len(tags))
func tagsToLabelPairs(name string, tags map[string]string) []prompb.Label {
pairs := make([]prompb.Label, 0, len(tags))
for k, v := range tags {
if v == "" {
// If we select metrics with different sets of labels names,
@ -236,12 +236,12 @@ func tagsToLabelPairs(name string, tags map[string]string) []*prompb.Label {
// to make the result correct.
continue
}
pairs = append(pairs, &prompb.Label{
pairs = append(pairs, prompb.Label{
Name: k,
Value: v,
})
}
pairs = append(pairs, &prompb.Label{
pairs = append(pairs, prompb.Label{
Name: model.MetricNameLabel,
Value: name,
})

View file

@ -21,17 +21,17 @@ var _ = math.Inf
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
type WriteRequest struct {
Timeseries []*TimeSeries `protobuf:"bytes,1,rep,name=timeseries,proto3" json:"timeseries,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Timeseries []TimeSeries `protobuf:"bytes,1,rep,name=timeseries,proto3" json:"timeseries"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *WriteRequest) Reset() { *m = WriteRequest{} }
func (m *WriteRequest) String() string { return proto.CompactTextString(m) }
func (*WriteRequest) ProtoMessage() {}
func (*WriteRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_remote_6a8e15c27c79f707, []int{0}
return fileDescriptor_remote_007cb64b4d8cdf66, []int{0}
}
func (m *WriteRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -60,7 +60,7 @@ func (m *WriteRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_WriteRequest proto.InternalMessageInfo
func (m *WriteRequest) GetTimeseries() []*TimeSeries {
func (m *WriteRequest) GetTimeseries() []TimeSeries {
if m != nil {
return m.Timeseries
}
@ -78,7 +78,7 @@ func (m *ReadRequest) Reset() { *m = ReadRequest{} }
func (m *ReadRequest) String() string { return proto.CompactTextString(m) }
func (*ReadRequest) ProtoMessage() {}
func (*ReadRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_remote_6a8e15c27c79f707, []int{1}
return fileDescriptor_remote_007cb64b4d8cdf66, []int{1}
}
func (m *ReadRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -126,7 +126,7 @@ func (m *ReadResponse) Reset() { *m = ReadResponse{} }
func (m *ReadResponse) String() string { return proto.CompactTextString(m) }
func (*ReadResponse) ProtoMessage() {}
func (*ReadResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_remote_6a8e15c27c79f707, []int{2}
return fileDescriptor_remote_007cb64b4d8cdf66, []int{2}
}
func (m *ReadResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -176,7 +176,7 @@ func (m *Query) Reset() { *m = Query{} }
func (m *Query) String() string { return proto.CompactTextString(m) }
func (*Query) ProtoMessage() {}
func (*Query) Descriptor() ([]byte, []int) {
return fileDescriptor_remote_6a8e15c27c79f707, []int{3}
return fileDescriptor_remote_007cb64b4d8cdf66, []int{3}
}
func (m *Query) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -245,7 +245,7 @@ func (m *QueryResult) Reset() { *m = QueryResult{} }
func (m *QueryResult) String() string { return proto.CompactTextString(m) }
func (*QueryResult) ProtoMessage() {}
func (*QueryResult) Descriptor() ([]byte, []int) {
return fileDescriptor_remote_6a8e15c27c79f707, []int{4}
return fileDescriptor_remote_007cb64b4d8cdf66, []int{4}
}
func (m *QueryResult) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -650,7 +650,7 @@ func (m *WriteRequest) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Timeseries = append(m.Timeseries, &TimeSeries{})
m.Timeseries = append(m.Timeseries, TimeSeries{})
if err := m.Timeseries[len(m.Timeseries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
@ -1181,28 +1181,29 @@ var (
ErrIntOverflowRemote = fmt.Errorf("proto: integer overflow")
)
func init() { proto.RegisterFile("remote.proto", fileDescriptor_remote_6a8e15c27c79f707) }
func init() { proto.RegisterFile("remote.proto", fileDescriptor_remote_007cb64b4d8cdf66) }
var fileDescriptor_remote_6a8e15c27c79f707 = []byte{
// 308 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x91, 0x4f, 0x4b, 0xf3, 0x40,
0x10, 0xc6, 0xd9, 0xb7, 0x6f, 0x5b, 0x99, 0x14, 0xa9, 0x8b, 0x7f, 0x82, 0x87, 0x52, 0x72, 0x0a,
0x54, 0x0a, 0x56, 0xf1, 0xe0, 0x4d, 0x41, 0xf1, 0x60, 0x0f, 0xae, 0x05, 0xc1, 0x4b, 0x49, 0xed,
0x40, 0x03, 0xdd, 0x64, 0xbb, 0x33, 0x39, 0xf4, 0xeb, 0x79, 0xf2, 0xe8, 0x47, 0x90, 0x7c, 0x12,
0xc9, 0x86, 0xe8, 0x8a, 0x37, 0xcf, 0xbf, 0xdf, 0xf3, 0xf0, 0x0c, 0x03, 0x3d, 0x8b, 0x3a, 0x67,
0x1c, 0x1b, 0x9b, 0x73, 0x2e, 0xc1, 0xd8, 0x5c, 0x23, 0xaf, 0xb0, 0xa0, 0xe3, 0x80, 0xb7, 0x06,
0xa9, 0x06, 0xd1, 0x2d, 0xf4, 0x9e, 0x6c, 0xca, 0xa8, 0x70, 0x53, 0x20, 0xb1, 0xbc, 0x00,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, 0x00, 0x00, 0x00, 0xff, 0xff, 0x81, 0x1e, 0xc0, 0x24,
0x18, 0x02, 0x00, 0x00,
var fileDescriptor_remote_007cb64b4d8cdf66 = []byte{
// 333 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xbf, 0x4a, 0x2b, 0x41,
0x14, 0xc6, 0xef, 0xdc, 0xfc, 0xbb, 0x9c, 0x0d, 0x97, 0xdc, 0x21, 0x57, 0x97, 0x14, 0x31, 0x6c,
0xb5, 0x10, 0x89, 0x18, 0xc5, 0x42, 0x6c, 0x0c, 0x08, 0x16, 0x49, 0xe1, 0x18, 0x10, 0x6c, 0xc2,
0xc6, 0x1c, 0x92, 0x85, 0xcc, 0xce, 0x66, 0xe6, 0x6c, 0x91, 0xd7, 0xb3, 0x4a, 0xe9, 0x13, 0x88,
0xe4, 0x49, 0x64, 0x67, 0x59, 0x1d, 0xb1, 0xb1, 0x1b, 0xe6, 0xf7, 0xfb, 0x3e, 0xce, 0xe1, 0x40,
0x53, 0xa3, 0x54, 0x84, 0x83, 0x54, 0x2b, 0x52, 0x1c, 0x52, 0xad, 0x24, 0xd2, 0x0a, 0x33, 0xd3,
0xf1, 0x68, 0x9b, 0xa2, 0x29, 0x40, 0xa7, 0xbd, 0x54, 0x4b, 0x65, 0x9f, 0x27, 0xf9, 0xab, 0xf8,
0x0d, 0xc6, 0xd0, 0x7c, 0xd0, 0x31, 0xa1, 0xc0, 0x4d, 0x86, 0x86, 0xf8, 0x15, 0x00, 0xc5, 0x12,
0x0d, 0xea, 0x18, 0x8d, 0xcf, 0x7a, 0x95, 0xd0, 0x1b, 0x1e, 0x0c, 0x3e, 0x3b, 0x07, 0xd3, 0x58,
0xe2, 0xbd, 0xa5, 0xa3, 0xea, 0xee, 0xf5, 0xe8, 0x97, 0x70, 0xfc, 0xe0, 0x12, 0x3c, 0x81, 0xd1,
0xa2, 0x2c, 0xeb, 0x43, 0x63, 0x93, 0xb9, 0x4d, 0xff, 0xdc, 0xa6, 0xbb, 0x0c, 0xf5, 0x56, 0x94,
0x46, 0x70, 0x0d, 0xcd, 0x22, 0x6b, 0x52, 0x95, 0x18, 0xe4, 0xa7, 0xd0, 0xd0, 0x68, 0xb2, 0x35,
0x95, 0xe1, 0xc3, 0xef, 0x61, 0xcb, 0x45, 0xe9, 0x05, 0xcf, 0x0c, 0x6a, 0x16, 0xf0, 0x63, 0xe0,
0x86, 0x22, 0x4d, 0x33, 0x3b, 0x1c, 0x45, 0x32, 0x9d, 0xc9, 0xbc, 0x87, 0x85, 0x15, 0xd1, 0xb2,
0x64, 0x5a, 0x82, 0x89, 0xe1, 0x21, 0xb4, 0x30, 0x59, 0x7c, 0x75, 0x7f, 0x5b, 0xf7, 0x2f, 0x26,
0x0b, 0xd7, 0x3c, 0x87, 0x3f, 0x32, 0xa2, 0xa7, 0x15, 0x6a, 0xe3, 0x57, 0xec, 0x54, 0xbe, 0x3b,
0xd5, 0x38, 0x9a, 0xe3, 0x7a, 0x52, 0x08, 0xe2, 0xc3, 0xe4, 0x7d, 0xa8, 0xad, 0xe2, 0x84, 0x8c,
0x5f, 0xed, 0xb1, 0xd0, 0x1b, 0xfe, 0x77, 0x23, 0xf9, 0xce, 0xb7, 0x39, 0x14, 0x85, 0x13, 0xdc,
0x80, 0xe7, 0x2c, 0xc7, 0x2f, 0x7e, 0x7e, 0x10, 0xf7, 0x14, 0xa3, 0xf6, 0x6e, 0xdf, 0x65, 0x2f,
0xfb, 0x2e, 0x7b, 0xdb, 0x77, 0xd9, 0x63, 0x3d, 0x0f, 0xa4, 0xf3, 0x79, 0xdd, 0x5e, 0xfd, 0xec,
0x3d, 0x00, 0x00, 0xff, 0xff, 0x9e, 0xb6, 0x05, 0x1c, 0x34, 0x02, 0x00, 0x00,
}

View file

@ -17,9 +17,10 @@ package prometheus;
option go_package = "prompb";
import "types.proto";
import "gogoproto/gogo.proto";
message WriteRequest {
repeated prometheus.TimeSeries timeseries = 1;
repeated prometheus.TimeSeries timeseries = 1 [(gogoproto.nullable) = false];
}
message ReadRequest {

View file

@ -48,7 +48,7 @@ func (x LabelMatcher_Type) String() string {
return proto.EnumName(LabelMatcher_Type_name, int32(x))
}
func (LabelMatcher_Type) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_types_065bd8df07daeaf9, []int{4, 0}
return fileDescriptor_types_38f70661e771add3, []int{4, 0}
}
type Sample struct {
@ -63,7 +63,7 @@ func (m *Sample) Reset() { *m = Sample{} }
func (m *Sample) String() string { return proto.CompactTextString(m) }
func (*Sample) ProtoMessage() {}
func (*Sample) Descriptor() ([]byte, []int) {
return fileDescriptor_types_065bd8df07daeaf9, []int{0}
return fileDescriptor_types_38f70661e771add3, []int{0}
}
func (m *Sample) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -107,7 +107,7 @@ func (m *Sample) GetTimestamp() int64 {
}
type TimeSeries struct {
Labels []*Label `protobuf:"bytes,1,rep,name=labels,proto3" json:"labels,omitempty"`
Labels []Label `protobuf:"bytes,1,rep,name=labels,proto3" json:"labels"`
Samples []Sample `protobuf:"bytes,2,rep,name=samples,proto3" json:"samples"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@ -118,7 +118,7 @@ func (m *TimeSeries) Reset() { *m = TimeSeries{} }
func (m *TimeSeries) String() string { return proto.CompactTextString(m) }
func (*TimeSeries) ProtoMessage() {}
func (*TimeSeries) Descriptor() ([]byte, []int) {
return fileDescriptor_types_065bd8df07daeaf9, []int{1}
return fileDescriptor_types_38f70661e771add3, []int{1}
}
func (m *TimeSeries) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -147,7 +147,7 @@ func (m *TimeSeries) XXX_DiscardUnknown() {
var xxx_messageInfo_TimeSeries proto.InternalMessageInfo
func (m *TimeSeries) GetLabels() []*Label {
func (m *TimeSeries) GetLabels() []Label {
if m != nil {
return m.Labels
}
@ -173,7 +173,7 @@ func (m *Label) Reset() { *m = Label{} }
func (m *Label) String() string { return proto.CompactTextString(m) }
func (*Label) ProtoMessage() {}
func (*Label) Descriptor() ([]byte, []int) {
return fileDescriptor_types_065bd8df07daeaf9, []int{2}
return fileDescriptor_types_38f70661e771add3, []int{2}
}
func (m *Label) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -227,7 +227,7 @@ func (m *Labels) Reset() { *m = Labels{} }
func (m *Labels) String() string { return proto.CompactTextString(m) }
func (*Labels) ProtoMessage() {}
func (*Labels) Descriptor() ([]byte, []int) {
return fileDescriptor_types_065bd8df07daeaf9, []int{3}
return fileDescriptor_types_38f70661e771add3, []int{3}
}
func (m *Labels) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -277,7 +277,7 @@ func (m *LabelMatcher) Reset() { *m = LabelMatcher{} }
func (m *LabelMatcher) String() string { return proto.CompactTextString(m) }
func (*LabelMatcher) ProtoMessage() {}
func (*LabelMatcher) Descriptor() ([]byte, []int) {
return fileDescriptor_types_065bd8df07daeaf9, []int{4}
return fileDescriptor_types_38f70661e771add3, []int{4}
}
func (m *LabelMatcher) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -341,7 +341,7 @@ func (m *ReadHints) Reset() { *m = ReadHints{} }
func (m *ReadHints) String() string { return proto.CompactTextString(m) }
func (*ReadHints) ProtoMessage() {}
func (*ReadHints) Descriptor() ([]byte, []int) {
return fileDescriptor_types_065bd8df07daeaf9, []int{5}
return fileDescriptor_types_38f70661e771add3, []int{5}
}
func (m *ReadHints) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -916,7 +916,7 @@ func (m *TimeSeries) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Labels = append(m.Labels, &Label{})
m.Labels = append(m.Labels, Label{})
if err := m.Labels[len(m.Labels)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
@ -1535,32 +1535,32 @@ var (
ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow")
)
func init() { proto.RegisterFile("types.proto", fileDescriptor_types_065bd8df07daeaf9) }
func init() { proto.RegisterFile("types.proto", fileDescriptor_types_38f70661e771add3) }
var fileDescriptor_types_065bd8df07daeaf9 = []byte{
// 383 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xcf, 0xca, 0xd3, 0x40,
0x14, 0xc5, 0xbf, 0x49, 0xd2, 0x89, 0xbd, 0x9f, 0x48, 0x1c, 0x2a, 0x46, 0xd1, 0x5a, 0xb2, 0x8a,
0x9b, 0x94, 0xd6, 0x95, 0xe0, 0xaa, 0x10, 0x70, 0xd1, 0x08, 0x9d, 0x76, 0xe5, 0x46, 0xa6, 0xed,
0xb5, 0x8d, 0xe6, 0xcf, 0x90, 0x99, 0x0a, 0x7d, 0x10, 0xdf, 0xa9, 0x4b, 0x9f, 0x40, 0xa4, 0x4f,
0x22, 0x33, 0x49, 0x6d, 0x41, 0xc1, 0xdd, 0x3d, 0xe7, 0xfe, 0x6e, 0xce, 0x49, 0x08, 0xdc, 0xeb,
0xa3, 0x44, 0x95, 0xc8, 0xa6, 0xd6, 0x35, 0x03, 0xd9, 0xd4, 0x25, 0xea, 0x3d, 0x1e, 0xd4, 0xf3,
0xc1, 0xae, 0xde, 0xd5, 0xd6, 0x1e, 0x9b, 0xa9, 0x25, 0xa2, 0x77, 0x40, 0x97, 0xa2, 0x94, 0x05,
0xb2, 0x01, 0xf4, 0xbe, 0x89, 0xe2, 0x80, 0x21, 0x19, 0x91, 0x98, 0xf0, 0x56, 0xb0, 0x17, 0xd0,
0xd7, 0x79, 0x89, 0x4a, 0x8b, 0x52, 0x86, 0xce, 0x88, 0xc4, 0x2e, 0xbf, 0x1a, 0xd1, 0x57, 0x80,
0x55, 0x5e, 0xe2, 0x12, 0x9b, 0x1c, 0x15, 0x7b, 0x0d, 0xb4,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, 0xb6, 0x66, 0xe1, 0xd9, 0x45, 0x0f, 0xab, 0x6d, 0xa6, 0x66, 0x83, 0xd3, 0x79, 0x48,
0x7e, 0x9c, 0x87, 0xe4, 0xd7, 0x79, 0x48, 0x3e, 0x52, 0xf3, 0xc6, 0x72, 0xbd, 0xa6, 0xf6, 0xcf,
0x79, 0xf3, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x44, 0x38, 0x1e, 0x5b, 0x6a, 0x02, 0x00, 0x00,
var fileDescriptor_types_38f70661e771add3 = []byte{
// 379 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0x4f, 0xef, 0xd2, 0x40,
0x14, 0x64, 0xdb, 0xb2, 0x95, 0x87, 0x31, 0x75, 0x83, 0xb1, 0x1a, 0x45, 0xd2, 0x53, 0x4f, 0x25,
0xe0, 0xc9, 0xc4, 0x13, 0x49, 0x13, 0x0f, 0xd4, 0x84, 0x85, 0x93, 0x17, 0xb3, 0xc0, 0x13, 0x6a,
0xfa, 0x67, 0xed, 0x2e, 0x26, 0x7c, 0x10, 0xbf, 0x13, 0x47, 0x3f, 0x81, 0x31, 0x7c, 0x12, 0xb3,
0x5b, 0x10, 0x12, 0xbd, 0xfc, 0x6e, 0x6f, 0xe6, 0xcd, 0x74, 0xe6, 0x35, 0x0b, 0x7d, 0x7d, 0x94,
0xa8, 0x12, 0xd9, 0xd4, 0xba, 0x66, 0x20, 0x9b, 0xba, 0x44, 0xbd, 0xc7, 0x83, 0x7a, 0x39, 0xd8,
0xd5, 0xbb, 0xda, 0xd2, 0x63, 0x33, 0xb5, 0x8a, 0xe8, 0x3d, 0xd0, 0xa5, 0x28, 0x65, 0x81, 0x6c,
0x00, 0xdd, 0xef, 0xa2, 0x38, 0x60, 0x48, 0x46, 0x24, 0x26, 0xbc, 0x05, 0xec, 0x15, 0xf4, 0x74,
0x5e, 0xa2, 0xd2, 0xa2, 0x94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 0xcc, 0x5e, 0xc0, 0x23,
0xa5, 0x45, 0xa3, 0x8d, 0xda, 0xb5, 0x6a, 0xdf, 0xe2, 0x4c, 0xb1, 0x67, 0x40, 0xb1, 0xda, 0x9a,
0x85, 0x67, 0x17, 0x5d, 0xac, 0xb6, 0x99, 0x9a, 0x0d, 0x4e, 0xe7, 0x21, 0xf9, 0x79, 0x1e, 0x92,
0xdf, 0xe7, 0x21, 0xf9, 0x44, 0xcd, 0xc5, 0x72, 0xbd, 0xa6, 0xf6, 0xfd, 0xbc, 0xfd, 0x13, 0x00,
0x00, 0xff, 0xff, 0xe3, 0x8a, 0x88, 0x84, 0x70, 0x02, 0x00, 0x00,
}

View file

@ -24,7 +24,7 @@ message Sample {
}
message TimeSeries {
repeated Label labels = 1;
repeated Label labels = 1 [(gogoproto.nullable) = false];
repeated Sample samples = 2 [(gogoproto.nullable) = false];
}

View file

@ -83,7 +83,7 @@ func EncodeReadResponse(resp *prompb.ReadResponse, w http.ResponseWriter) error
// ToWriteRequest converts an array of samples into a WriteRequest proto.
func ToWriteRequest(samples []*model.Sample) *prompb.WriteRequest {
req := &prompb.WriteRequest{
Timeseries: make([]*prompb.TimeSeries, 0, len(samples)),
Timeseries: make([]prompb.TimeSeries, 0, len(samples)),
}
for _, s := range samples {
@ -96,7 +96,7 @@ func ToWriteRequest(samples []*model.Sample) *prompb.WriteRequest {
},
},
}
req.Timeseries = append(req.Timeseries, &ts)
req.Timeseries = append(req.Timeseries, ts)
}
return req
@ -365,10 +365,10 @@ func fromLabelMatchers(matchers []*prompb.LabelMatcher) ([]*labels.Matcher, erro
}
// MetricToLabelProtos builds a []*prompb.Label from a model.Metric
func MetricToLabelProtos(metric model.Metric) []*prompb.Label {
labels := make([]*prompb.Label, 0, len(metric))
func MetricToLabelProtos(metric model.Metric) []prompb.Label {
labels := make([]prompb.Label, 0, len(metric))
for k, v := range metric {
labels = append(labels, &prompb.Label{
labels = append(labels, prompb.Label{
Name: string(k),
Value: string(v),
})
@ -388,7 +388,7 @@ func LabelProtosToMetric(labelPairs []*prompb.Label) model.Metric {
return metric
}
func labelProtosToLabels(labelPairs []*prompb.Label) labels.Labels {
func labelProtosToLabels(labelPairs []prompb.Label) labels.Labels {
result := make(labels.Labels, 0, len(labelPairs))
for _, l := range labelPairs {
result = append(result, labels.Label{
@ -400,10 +400,10 @@ func labelProtosToLabels(labelPairs []*prompb.Label) labels.Labels {
return result
}
func labelsToLabelsProto(labels labels.Labels) []*prompb.Label {
result := make([]*prompb.Label, 0, len(labels))
func labelsToLabelsProto(labels labels.Labels) []prompb.Label {
result := make([]prompb.Label, 0, len(labels))
for _, l := range labels {
result = append(result, &prompb.Label{
result = append(result, prompb.Label{
Name: l.Name,
Value: l.Value,
})

View file

@ -899,9 +899,9 @@ func (api *API) remoteRead(w http.ResponseWriter, r *http.Request) {
}
// Add external labels back in, in sorted order.
sortedExternalLabels := make([]*prompb.Label, 0, len(externalLabels))
sortedExternalLabels := make([]prompb.Label, 0, len(externalLabels))
for name, value := range externalLabels {
sortedExternalLabels = append(sortedExternalLabels, &prompb.Label{
sortedExternalLabels = append(sortedExternalLabels, prompb.Label{
Name: string(name),
Value: string(value),
})
@ -1060,8 +1060,8 @@ func convertMatcher(m *labels.Matcher) tsdbLabels.Matcher {
// mergeLabels merges two sets of sorted proto labels, preferring those in
// primary to those in secondary when there is an overlap.
func mergeLabels(primary, secondary []*prompb.Label) []*prompb.Label {
result := make([]*prompb.Label, 0, len(primary)+len(secondary))
func mergeLabels(primary, secondary []prompb.Label) []prompb.Label {
result := make([]prompb.Label, 0, len(primary)+len(secondary))
i, j := 0, 0
for i < len(primary) && j < len(secondary) {
if primary[i].Name < secondary[j].Name {

View file

@ -987,7 +987,7 @@ func TestReadEndpoint(t *testing.T) {
expected := &prompb.QueryResult{
Timeseries: []*prompb.TimeSeries{
{
Labels: []*prompb.Label{
Labels: []prompb.Label{
{Name: "__name__", Value: "test_metric1"},
{Name: "b", Value: "c"},
{Name: "baz", Value: "qux"},