Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
qorus
prometheus
Commits
5358f76c
Commit
5358f76c
authored
Jan 15, 2019
by
Callum Styan
Committed by
Tom Wilkie
Jan 15, 2019
Browse files
update remote write path proto so that Labels/Timeseries can't be nil (#4957)
Signed-off-by:
Callum Styan
<
callumstyan@gmail.com
>
parent
375ad118
Changes
8
Hide whitespace changes
Inline
Side-by-side
documentation/examples/remote_storage/remote_storage_adapter/influxdb/client.go
View file @
5358f76c
...
...
@@ -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
,
})
...
...
prompb/remote.pb.go
View file @
5358f76c
...
...
@@ -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
,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0x54
,
0xb5
,
0x13
,
0xdd
,
0x40
,
0xe0
,
0x1d
,
0xf7
,
0xd7
,
0x57
,
0x5c
,
0xef
,
0xbf
,
0x95
,
0x03
,
0xf1
,
0x5e
,
0x0e
,
0xc4
,
0x47
,
0x39
,
0x10
,
0xcf
,
0x9d
,
0x2a
,
0x60
,
0x16
,
0x8b
,
0x8e
,
0xfb
,
0xf7
,
0xd9
,
0x67
,
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
,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a
,
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
,
}
prompb/remote.proto
View file @
5358f76c
...
...
@@ -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
{
...
...
prompb/types.pb.go
View file @
5358f76c
...
...
@@ -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
)
}
var
fileDescriptor_types_
065bd8df07daeaf9
=
[]
byte
{
// 3
83
bytes of a gzipped FileDescriptorProto
0x1f
,
0x8b
,
0x08
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x02
,
0xff
,
0x
8
4
,
0x
9
2
,
0x
c
f
,
0x
ca
,
0xd
3
,
0x40
,
0x14
,
0x
c5
,
0xb
f
,
0x
49
,
0x
d2
,
0x8
9
,
0x
bd
,
0x
9f
,
0x
4
8
,
0x1
c
,
0x
2
a
,
0x4
6
,
0xd
1
,
0x5
a
,
0x
b2
,
0x
8a
,
0x
9b
,
0x9
4
,
0x
d6
,
0x
95
,
0x
e0
,
0x
aa
,
0x
1
0
,
0x
70
,
0x
d1
,
0x
0
8
,
0x9
d
,
0x7
6
,
0x
e5
,
0x
46
,
0x
a6
,
0x
ed
,
0x
b5
,
0x
8d
,
0xe
6
,
0x
cf
,
0x
90
,
0x
99
,
0x0
a
,
0x
7d
,
0x1
0
,
0x
df
,
0x
a9
,
0x
4b
,
0x
9f
,
0x
40
,
0x
a4
,
0x
4f
,
0x
22
,
0x
33
,
0x
49
,
0x
6
d
,
0x
41
,
0x
c1
,
0x
dd
,
0x
3d
,
0x
e7
,
0x
fe
,
0x
6
e
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
0x
a6
,
0x
66
,
0x
83
,
0x
d3
,
0x79
,
0x
48
,
0x
7e
,
0x
9c
,
0x
87
,
0x
e4
,
0x
d7
,
0x
79
,
0x
48
,
0x
3e
,
0x
52
,
0x
f3
,
0x
c
6
,
0x
72
,
0xb
d
,
0x
a6
,
0x
f6
,
0x
cf
,
0x79
,
0xf3
,
0x3b
,
0x00
,
0x00
,
0xff
,
0xff
,
0x
44
,
0x
3
8
,
0x
1e
,
0x
5b
,
0x
6a
,
0x02
,
0x00
,
0x00
,
func
init
()
{
proto
.
RegisterFile
(
"types.proto"
,
fileDescriptor_types_
38f70661e771add3
)
}
var
fileDescriptor_types_
38f70661e771add3
=
[]
byte
{
// 3
79
bytes of a gzipped FileDescriptorProto
0x1f
,
0x8b
,
0x08
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x02
,
0xff
,
0x
9
4
,
0x
5
2
,
0x
4
f
,
0x
ef
,
0xd
2
,
0x40
,
0x14
,
0x
64
,
0x
d
b
,
0x
b2
,
0x
95
,
0x8
7
,
0x
31
,
0x
75
,
0x8
3
,
0x
b
1
,
0x
1
a
,
0x4
5
,
0xd
2
,
0x5
3
,
0x
4f
,
0x
25
,
0x
e0
,
0x
c
9
,
0x
c4
,
0x
13
,
0x
49
,
0x
13
,
0x0
f
,
0x
d4
,
0x
84
,
0x8
5
,
0x9
3
,
0x
1
7
,
0x
b3
,
0x
c0
,
0x
13
,
0x
6a
,
0x
fa
,
0x
67
,
0xe
d
,
0x
2e
,
0x
26
,
0x
7c
,
0x
1
0
,
0x
bf
,
0x1
3
,
0x
47
,
0x
3f
,
0x
81
,
0x
31
,
0x
7c
,
0x
12
,
0x
b3
,
0x
5b
,
0x
10
,
0x
12
,
0x
b
d
,
0x
fc
,
0x
6e
,
0x
6f
,
0x
e6
,
0x
cd
,
0x
74
,
0xe
6
,
0x
35
,
0x
0b
,
0x
7d
,
0x
7
d
,
0x
94
,
0xa
8
,
0x
12
,
0x
d
9
,
0x
d4
,
0x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df
,
0x
e7
,
0x
21
,
0x
f9
,
0x
44
,
0x
cd
,
0x
c5
,
0x
72
,
0x
bd
,
0x
a6
,
0x
f
6
,
0x
fd
,
0xb
c
,
0x
fd
,
0x
13
,
0x
00
,
0x00
,
0xff
,
0xff
,
0x
e3
,
0x8
a
,
0x
88
,
0x
84
,
0x
70
,
0x02
,
0x00
,
0x00
,
}
prompb/types.proto
View file @
5358f76c
...
...
@@ -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
];
}
...
...
storage/remote/codec.go
View file @
5358f76c
...
...
@@ -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
,
})
...
...
web/api/v1/api.go
View file @
5358f76c
...
...
@@ -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
{
...
...
web/api/v1/api_test.go
View file @
5358f76c
...
...
@@ -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"
},
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment