aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Kochie <superq@gmail.com>2018-10-15 20:40:34 +0200
committerGitHub <noreply@github.com>2018-10-15 20:40:34 +0200
commitef7a02dfa82daa26ac94356ff0fb3afb091552da (patch)
tree49aca79811b1ad76e5c14e6e0f24770284bebf5e
parent7057c64f45de6e4b2f1ae82d9b809dbd7250dfb8 (diff)
downloadprometheus_node_collector-ef7a02dfa82daa26ac94356ff0fb3afb091552da.tar.bz2
prometheus_node_collector-ef7a02dfa82daa26ac94356ff0fb3afb091552da.tar.xz
prometheus_node_collector-ef7a02dfa82daa26ac94356ff0fb3afb091552da.zip
Update vendor github.com/prometheus/client_golang/...@v0.9.0 (#1111)
* Update vendor github.com/prometheus/client_golang/...@v0.9.0 * Update vendor github.com/prometheus/common/... Signed-off-by: Ben Kochie <superq@gmail.com>
-rw-r--r--vendor/github.com/prometheus/client_model/go/metrics.pb.go381
-rw-r--r--vendor/github.com/prometheus/common/expfmt/decode.go4
-rw-r--r--vendor/github.com/prometheus/common/expfmt/text_create.go379
-rw-r--r--vendor/github.com/prometheus/common/expfmt/text_parse.go6
-rw-r--r--vendor/github.com/prometheus/common/model/silence.go4
-rw-r--r--vendor/github.com/prometheus/common/model/value.go4
-rw-r--r--vendor/vendor.json48
7 files changed, 638 insertions, 188 deletions
diff --git a/vendor/github.com/prometheus/client_model/go/metrics.pb.go b/vendor/github.com/prometheus/client_model/go/metrics.pb.go
index b065f86..9805432 100644
--- a/vendor/github.com/prometheus/client_model/go/metrics.pb.go
+++ b/vendor/github.com/prometheus/client_model/go/metrics.pb.go
@@ -1,34 +1,23 @@
1// Code generated by protoc-gen-go. 1// Code generated by protoc-gen-go. DO NOT EDIT.
2// source: metrics.proto 2// source: metrics.proto
3// DO NOT EDIT! 3
4 4package io_prometheus_client // import "github.com/prometheus/client_model/go"
5/*
6Package io_prometheus_client is a generated protocol buffer package.
7
8It is generated from these files:
9 metrics.proto
10
11It has these top-level messages:
12 LabelPair
13 Gauge
14 Counter
15 Quantile
16 Summary
17 Untyped
18 Histogram
19 Bucket
20 Metric
21 MetricFamily
22*/
23package io_prometheus_client
24 5
25import proto "github.com/golang/protobuf/proto" 6import proto "github.com/golang/protobuf/proto"
7import fmt "fmt"
26import math "math" 8import math "math"
27 9
28// Reference imports to suppress errors if they are not otherwise used. 10// Reference imports to suppress errors if they are not otherwise used.
29var _ = proto.Marshal 11var _ = proto.Marshal
12var _ = fmt.Errorf
30var _ = math.Inf 13var _ = math.Inf
31 14
15// This is a compile-time assertion to ensure that this generated file
16// is compatible with the proto package it is being compiled against.
17// A compilation error at this line likely means your copy of the
18// proto package needs to be updated.
19const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
20
32type MetricType int32 21type MetricType int32
33 22
34const ( 23const (
@@ -70,16 +59,41 @@ func (x *MetricType) UnmarshalJSON(data []byte) error {
70 *x = MetricType(value) 59 *x = MetricType(value)
71 return nil 60 return nil
72} 61}
62func (MetricType) EnumDescriptor() ([]byte, []int) {
63 return fileDescriptor_metrics_c97c9a2b9560cb8f, []int{0}
64}
73 65
74type LabelPair struct { 66type LabelPair struct {
75 Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` 67 Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
76 Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` 68 Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
77 XXX_unrecognized []byte `json:"-"` 69 XXX_NoUnkeyedLiteral struct{} `json:"-"`
70 XXX_unrecognized []byte `json:"-"`
71 XXX_sizecache int32 `json:"-"`
78} 72}
79 73
80func (m *LabelPair) Reset() { *m = LabelPair{} } 74func (m *LabelPair) Reset() { *m = LabelPair{} }
81func (m *LabelPair) String() string { return proto.CompactTextString(m) } 75func (m *LabelPair) String() string { return proto.CompactTextString(m) }
82func (*LabelPair) ProtoMessage() {} 76func (*LabelPair) ProtoMessage() {}
77func (*LabelPair) Descriptor() ([]byte, []int) {
78 return fileDescriptor_metrics_c97c9a2b9560cb8f, []int{0}
79}
80func (m *LabelPair) XXX_Unmarshal(b []byte) error {
81 return xxx_messageInfo_LabelPair.Unmarshal(m, b)
82}
83func (m *LabelPair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
84 return xxx_messageInfo_LabelPair.Marshal(b, m, deterministic)
85}
86func (dst *LabelPair) XXX_Merge(src proto.Message) {
87 xxx_messageInfo_LabelPair.Merge(dst, src)
88}
89func (m *LabelPair) XXX_Size() int {
90 return xxx_messageInfo_LabelPair.Size(m)
91}
92func (m *LabelPair) XXX_DiscardUnknown() {
93 xxx_messageInfo_LabelPair.DiscardUnknown(m)
94}
95
96var xxx_messageInfo_LabelPair proto.InternalMessageInfo
83 97
84func (m *LabelPair) GetName() string { 98func (m *LabelPair) GetName() string {
85 if m != nil && m.Name != nil { 99 if m != nil && m.Name != nil {
@@ -96,13 +110,35 @@ func (m *LabelPair) GetValue() string {
96} 110}
97 111
98type Gauge struct { 112type Gauge struct {
99 Value *float64 `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"` 113 Value *float64 `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"`
100 XXX_unrecognized []byte `json:"-"` 114 XXX_NoUnkeyedLiteral struct{} `json:"-"`
115 XXX_unrecognized []byte `json:"-"`
116 XXX_sizecache int32 `json:"-"`
101} 117}
102 118
103func (m *Gauge) Reset() { *m = Gauge{} } 119func (m *Gauge) Reset() { *m = Gauge{} }
104func (m *Gauge) String() string { return proto.CompactTextString(m) } 120func (m *Gauge) String() string { return proto.CompactTextString(m) }
105func (*Gauge) ProtoMessage() {} 121func (*Gauge) ProtoMessage() {}
122func (*Gauge) Descriptor() ([]byte, []int) {
123 return fileDescriptor_metrics_c97c9a2b9560cb8f, []int{1}
124}
125func (m *Gauge) XXX_Unmarshal(b []byte) error {
126 return xxx_messageInfo_Gauge.Unmarshal(m, b)
127}
128func (m *Gauge) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
129 return xxx_messageInfo_Gauge.Marshal(b, m, deterministic)
130}
131func (dst *Gauge) XXX_Merge(src proto.Message) {
132 xxx_messageInfo_Gauge.Merge(dst, src)
133}
134func (m *Gauge) XXX_Size() int {
135 return xxx_messageInfo_Gauge.Size(m)
136}
137func (m *Gauge) XXX_DiscardUnknown() {
138 xxx_messageInfo_Gauge.DiscardUnknown(m)
139}
140
141var xxx_messageInfo_Gauge proto.InternalMessageInfo
106 142
107func (m *Gauge) GetValue() float64 { 143func (m *Gauge) GetValue() float64 {
108 if m != nil && m.Value != nil { 144 if m != nil && m.Value != nil {
@@ -112,13 +148,35 @@ func (m *Gauge) GetValue() float64 {
112} 148}
113 149
114type Counter struct { 150type Counter struct {
115 Value *float64 `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"` 151 Value *float64 `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"`
116 XXX_unrecognized []byte `json:"-"` 152 XXX_NoUnkeyedLiteral struct{} `json:"-"`
153 XXX_unrecognized []byte `json:"-"`
154 XXX_sizecache int32 `json:"-"`
117} 155}
118 156
119func (m *Counter) Reset() { *m = Counter{} } 157func (m *Counter) Reset() { *m = Counter{} }
120func (m *Counter) String() string { return proto.CompactTextString(m) } 158func (m *Counter) String() string { return proto.CompactTextString(m) }
121func (*Counter) ProtoMessage() {} 159func (*Counter) ProtoMessage() {}
160func (*Counter) Descriptor() ([]byte, []int) {
161 return fileDescriptor_metrics_c97c9a2b9560cb8f, []int{2}
162}
163func (m *Counter) XXX_Unmarshal(b []byte) error {
164 return xxx_messageInfo_Counter.Unmarshal(m, b)
165}
166func (m *Counter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
167 return xxx_messageInfo_Counter.Marshal(b, m, deterministic)
168}
169func (dst *Counter) XXX_Merge(src proto.Message) {
170 xxx_messageInfo_Counter.Merge(dst, src)
171}
172func (m *Counter) XXX_Size() int {
173 return xxx_messageInfo_Counter.Size(m)
174}
175func (m *Counter) XXX_DiscardUnknown() {
176 xxx_messageInfo_Counter.DiscardUnknown(m)
177}
178
179var xxx_messageInfo_Counter proto.InternalMessageInfo
122 180
123func (m *Counter) GetValue() float64 { 181func (m *Counter) GetValue() float64 {
124 if m != nil && m.Value != nil { 182 if m != nil && m.Value != nil {
@@ -128,14 +186,36 @@ func (m *Counter) GetValue() float64 {
128} 186}
129 187
130type Quantile struct { 188type Quantile struct {
131 Quantile *float64 `protobuf:"fixed64,1,opt,name=quantile" json:"quantile,omitempty"` 189 Quantile *float64 `protobuf:"fixed64,1,opt,name=quantile" json:"quantile,omitempty"`
132 Value *float64 `protobuf:"fixed64,2,opt,name=value" json:"value,omitempty"` 190 Value *float64 `protobuf:"fixed64,2,opt,name=value" json:"value,omitempty"`
133 XXX_unrecognized []byte `json:"-"` 191 XXX_NoUnkeyedLiteral struct{} `json:"-"`
192 XXX_unrecognized []byte `json:"-"`
193 XXX_sizecache int32 `json:"-"`
134} 194}
135 195
136func (m *Quantile) Reset() { *m = Quantile{} } 196func (m *Quantile) Reset() { *m = Quantile{} }
137func (m *Quantile) String() string { return proto.CompactTextString(m) } 197func (m *Quantile) String() string { return proto.CompactTextString(m) }
138func (*Quantile) ProtoMessage() {} 198func (*Quantile) ProtoMessage() {}
199func (*Quantile) Descriptor() ([]byte, []int) {
200 return fileDescriptor_metrics_c97c9a2b9560cb8f, []int{3}
201}
202func (m *Quantile) XXX_Unmarshal(b []byte) error {
203 return xxx_messageInfo_Quantile.Unmarshal(m, b)
204}
205func (m *Quantile) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
206 return xxx_messageInfo_Quantile.Marshal(b, m, deterministic)
207}
208func (dst *Quantile) XXX_Merge(src proto.Message) {
209 xxx_messageInfo_Quantile.Merge(dst, src)
210}
211func (m *Quantile) XXX_Size() int {
212 return xxx_messageInfo_Quantile.Size(m)
213}
214func (m *Quantile) XXX_DiscardUnknown() {
215 xxx_messageInfo_Quantile.DiscardUnknown(m)
216}
217
218var xxx_messageInfo_Quantile proto.InternalMessageInfo
139 219
140func (m *Quantile) GetQuantile() float64 { 220func (m *Quantile) GetQuantile() float64 {
141 if m != nil && m.Quantile != nil { 221 if m != nil && m.Quantile != nil {
@@ -152,15 +232,37 @@ func (m *Quantile) GetValue() float64 {
152} 232}
153 233
154type Summary struct { 234type Summary struct {
155 SampleCount *uint64 `protobuf:"varint,1,opt,name=sample_count" json:"sample_count,omitempty"` 235 SampleCount *uint64 `protobuf:"varint,1,opt,name=sample_count,json=sampleCount" json:"sample_count,omitempty"`
156 SampleSum *float64 `protobuf:"fixed64,2,opt,name=sample_sum" json:"sample_sum,omitempty"` 236 SampleSum *float64 `protobuf:"fixed64,2,opt,name=sample_sum,json=sampleSum" json:"sample_sum,omitempty"`
157 Quantile []*Quantile `protobuf:"bytes,3,rep,name=quantile" json:"quantile,omitempty"` 237 Quantile []*Quantile `protobuf:"bytes,3,rep,name=quantile" json:"quantile,omitempty"`
158 XXX_unrecognized []byte `json:"-"` 238 XXX_NoUnkeyedLiteral struct{} `json:"-"`
239 XXX_unrecognized []byte `json:"-"`
240 XXX_sizecache int32 `json:"-"`
159} 241}
160 242
161func (m *Summary) Reset() { *m = Summary{} } 243func (m *Summary) Reset() { *m = Summary{} }
162func (m *Summary) String() string { return proto.CompactTextString(m) } 244func (m *Summary) String() string { return proto.CompactTextString(m) }
163func (*Summary) ProtoMessage() {} 245func (*Summary) ProtoMessage() {}
246func (*Summary) Descriptor() ([]byte, []int) {
247 return fileDescriptor_metrics_c97c9a2b9560cb8f, []int{4}
248}
249func (m *Summary) XXX_Unmarshal(b []byte) error {
250 return xxx_messageInfo_Summary.Unmarshal(m, b)
251}
252func (m *Summary) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
253 return xxx_messageInfo_Summary.Marshal(b, m, deterministic)
254}
255func (dst *Summary) XXX_Merge(src proto.Message) {
256 xxx_messageInfo_Summary.Merge(dst, src)
257}
258func (m *Summary) XXX_Size() int {
259 return xxx_messageInfo_Summary.Size(m)
260}
261func (m *Summary) XXX_DiscardUnknown() {
262 xxx_messageInfo_Summary.DiscardUnknown(m)
263}
264
265var xxx_messageInfo_Summary proto.InternalMessageInfo
164 266
165func (m *Summary) GetSampleCount() uint64 { 267func (m *Summary) GetSampleCount() uint64 {
166 if m != nil && m.SampleCount != nil { 268 if m != nil && m.SampleCount != nil {
@@ -184,13 +286,35 @@ func (m *Summary) GetQuantile() []*Quantile {
184} 286}
185 287
186type Untyped struct { 288type Untyped struct {
187 Value *float64 `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"` 289 Value *float64 `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"`
188 XXX_unrecognized []byte `json:"-"` 290 XXX_NoUnkeyedLiteral struct{} `json:"-"`
291 XXX_unrecognized []byte `json:"-"`
292 XXX_sizecache int32 `json:"-"`
189} 293}
190 294
191func (m *Untyped) Reset() { *m = Untyped{} } 295func (m *Untyped) Reset() { *m = Untyped{} }
192func (m *Untyped) String() string { return proto.CompactTextString(m) } 296func (m *Untyped) String() string { return proto.CompactTextString(m) }
193func (*Untyped) ProtoMessage() {} 297func (*Untyped) ProtoMessage() {}
298func (*Untyped) Descriptor() ([]byte, []int) {
299 return fileDescriptor_metrics_c97c9a2b9560cb8f, []int{5}
300}
301func (m *Untyped) XXX_Unmarshal(b []byte) error {
302 return xxx_messageInfo_Untyped.Unmarshal(m, b)
303}
304func (m *Untyped) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
305 return xxx_messageInfo_Untyped.Marshal(b, m, deterministic)
306}
307func (dst *Untyped) XXX_Merge(src proto.Message) {
308 xxx_messageInfo_Untyped.Merge(dst, src)
309}
310func (m *Untyped) XXX_Size() int {
311 return xxx_messageInfo_Untyped.Size(m)
312}
313func (m *Untyped) XXX_DiscardUnknown() {
314 xxx_messageInfo_Untyped.DiscardUnknown(m)
315}
316
317var xxx_messageInfo_Untyped proto.InternalMessageInfo
194 318
195func (m *Untyped) GetValue() float64 { 319func (m *Untyped) GetValue() float64 {
196 if m != nil && m.Value != nil { 320 if m != nil && m.Value != nil {
@@ -200,15 +324,37 @@ func (m *Untyped) GetValue() float64 {
200} 324}
201 325
202type Histogram struct { 326type Histogram struct {
203 SampleCount *uint64 `protobuf:"varint,1,opt,name=sample_count" json:"sample_count,omitempty"` 327 SampleCount *uint64 `protobuf:"varint,1,opt,name=sample_count,json=sampleCount" json:"sample_count,omitempty"`
204 SampleSum *float64 `protobuf:"fixed64,2,opt,name=sample_sum" json:"sample_sum,omitempty"` 328 SampleSum *float64 `protobuf:"fixed64,2,opt,name=sample_sum,json=sampleSum" json:"sample_sum,omitempty"`
205 Bucket []*Bucket `protobuf:"bytes,3,rep,name=bucket" json:"bucket,omitempty"` 329 Bucket []*Bucket `protobuf:"bytes,3,rep,name=bucket" json:"bucket,omitempty"`
206 XXX_unrecognized []byte `json:"-"` 330 XXX_NoUnkeyedLiteral struct{} `json:"-"`
331 XXX_unrecognized []byte `json:"-"`
332 XXX_sizecache int32 `json:"-"`
207} 333}
208 334
209func (m *Histogram) Reset() { *m = Histogram{} } 335func (m *Histogram) Reset() { *m = Histogram{} }
210func (m *Histogram) String() string { return proto.CompactTextString(m) } 336func (m *Histogram) String() string { return proto.CompactTextString(m) }
211func (*Histogram) ProtoMessage() {} 337func (*Histogram) ProtoMessage() {}
338func (*Histogram) Descriptor() ([]byte, []int) {
339 return fileDescriptor_metrics_c97c9a2b9560cb8f, []int{6}
340}
341func (m *Histogram) XXX_Unmarshal(b []byte) error {
342 return xxx_messageInfo_Histogram.Unmarshal(m, b)
343}
344func (m *Histogram) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
345 return xxx_messageInfo_Histogram.Marshal(b, m, deterministic)
346}
347func (dst *Histogram) XXX_Merge(src proto.Message) {
348 xxx_messageInfo_Histogram.Merge(dst, src)
349}
350func (m *Histogram) XXX_Size() int {
351 return xxx_messageInfo_Histogram.Size(m)
352}
353func (m *Histogram) XXX_DiscardUnknown() {
354 xxx_messageInfo_Histogram.DiscardUnknown(m)
355}
356
357var xxx_messageInfo_Histogram proto.InternalMessageInfo
212 358
213func (m *Histogram) GetSampleCount() uint64 { 359func (m *Histogram) GetSampleCount() uint64 {
214 if m != nil && m.SampleCount != nil { 360 if m != nil && m.SampleCount != nil {
@@ -232,14 +378,36 @@ func (m *Histogram) GetBucket() []*Bucket {
232} 378}
233 379
234type Bucket struct { 380type Bucket struct {
235 CumulativeCount *uint64 `protobuf:"varint,1,opt,name=cumulative_count" json:"cumulative_count,omitempty"` 381 CumulativeCount *uint64 `protobuf:"varint,1,opt,name=cumulative_count,json=cumulativeCount" json:"cumulative_count,omitempty"`
236 UpperBound *float64 `protobuf:"fixed64,2,opt,name=upper_bound" json:"upper_bound,omitempty"` 382 UpperBound *float64 `protobuf:"fixed64,2,opt,name=upper_bound,json=upperBound" json:"upper_bound,omitempty"`
237 XXX_unrecognized []byte `json:"-"` 383 XXX_NoUnkeyedLiteral struct{} `json:"-"`
384 XXX_unrecognized []byte `json:"-"`
385 XXX_sizecache int32 `json:"-"`
238} 386}
239 387
240func (m *Bucket) Reset() { *m = Bucket{} } 388func (m *Bucket) Reset() { *m = Bucket{} }
241func (m *Bucket) String() string { return proto.CompactTextString(m) } 389func (m *Bucket) String() string { return proto.CompactTextString(m) }
242func (*Bucket) ProtoMessage() {} 390func (*Bucket) ProtoMessage() {}
391func (*Bucket) Descriptor() ([]byte, []int) {
392 return fileDescriptor_metrics_c97c9a2b9560cb8f, []int{7}
393}
394func (m *Bucket) XXX_Unmarshal(b []byte) error {
395 return xxx_messageInfo_Bucket.Unmarshal(m, b)
396}
397func (m *Bucket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
398 return xxx_messageInfo_Bucket.Marshal(b, m, deterministic)
399}
400func (dst *Bucket) XXX_Merge(src proto.Message) {
401 xxx_messageInfo_Bucket.Merge(dst, src)
402}
403func (m *Bucket) XXX_Size() int {
404 return xxx_messageInfo_Bucket.Size(m)
405}
406func (m *Bucket) XXX_DiscardUnknown() {
407 xxx_messageInfo_Bucket.DiscardUnknown(m)
408}
409
410var xxx_messageInfo_Bucket proto.InternalMessageInfo
243 411
244func (m *Bucket) GetCumulativeCount() uint64 { 412func (m *Bucket) GetCumulativeCount() uint64 {
245 if m != nil && m.CumulativeCount != nil { 413 if m != nil && m.CumulativeCount != nil {
@@ -256,19 +424,41 @@ func (m *Bucket) GetUpperBound() float64 {
256} 424}
257 425
258type Metric struct { 426type Metric struct {
259 Label []*LabelPair `protobuf:"bytes,1,rep,name=label" json:"label,omitempty"` 427 Label []*LabelPair `protobuf:"bytes,1,rep,name=label" json:"label,omitempty"`
260 Gauge *Gauge `protobuf:"bytes,2,opt,name=gauge" json:"gauge,omitempty"` 428 Gauge *Gauge `protobuf:"bytes,2,opt,name=gauge" json:"gauge,omitempty"`
261 Counter *Counter `protobuf:"bytes,3,opt,name=counter" json:"counter,omitempty"` 429 Counter *Counter `protobuf:"bytes,3,opt,name=counter" json:"counter,omitempty"`
262 Summary *Summary `protobuf:"bytes,4,opt,name=summary" json:"summary,omitempty"` 430 Summary *Summary `protobuf:"bytes,4,opt,name=summary" json:"summary,omitempty"`
263 Untyped *Untyped `protobuf:"bytes,5,opt,name=untyped" json:"untyped,omitempty"` 431 Untyped *Untyped `protobuf:"bytes,5,opt,name=untyped" json:"untyped,omitempty"`
264 Histogram *Histogram `protobuf:"bytes,7,opt,name=histogram" json:"histogram,omitempty"` 432 Histogram *Histogram `protobuf:"bytes,7,opt,name=histogram" json:"histogram,omitempty"`
265 TimestampMs *int64 `protobuf:"varint,6,opt,name=timestamp_ms" json:"timestamp_ms,omitempty"` 433 TimestampMs *int64 `protobuf:"varint,6,opt,name=timestamp_ms,json=timestampMs" json:"timestamp_ms,omitempty"`
266 XXX_unrecognized []byte `json:"-"` 434 XXX_NoUnkeyedLiteral struct{} `json:"-"`
435 XXX_unrecognized []byte `json:"-"`
436 XXX_sizecache int32 `json:"-"`
267} 437}
268 438
269func (m *Metric) Reset() { *m = Metric{} } 439func (m *Metric) Reset() { *m = Metric{} }
270func (m *Metric) String() string { return proto.CompactTextString(m) } 440func (m *Metric) String() string { return proto.CompactTextString(m) }
271func (*Metric) ProtoMessage() {} 441func (*Metric) ProtoMessage() {}
442func (*Metric) Descriptor() ([]byte, []int) {
443 return fileDescriptor_metrics_c97c9a2b9560cb8f, []int{8}
444}
445func (m *Metric) XXX_Unmarshal(b []byte) error {
446 return xxx_messageInfo_Metric.Unmarshal(m, b)
447}
448func (m *Metric) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
449 return xxx_messageInfo_Metric.Marshal(b, m, deterministic)
450}
451func (dst *Metric) XXX_Merge(src proto.Message) {
452 xxx_messageInfo_Metric.Merge(dst, src)
453}
454func (m *Metric) XXX_Size() int {
455 return xxx_messageInfo_Metric.Size(m)
456}
457func (m *Metric) XXX_DiscardUnknown() {
458 xxx_messageInfo_Metric.DiscardUnknown(m)
459}
460
461var xxx_messageInfo_Metric proto.InternalMessageInfo
272 462
273func (m *Metric) GetLabel() []*LabelPair { 463func (m *Metric) GetLabel() []*LabelPair {
274 if m != nil { 464 if m != nil {
@@ -320,16 +510,38 @@ func (m *Metric) GetTimestampMs() int64 {
320} 510}
321 511
322type MetricFamily struct { 512type MetricFamily struct {
323 Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` 513 Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
324 Help *string `protobuf:"bytes,2,opt,name=help" json:"help,omitempty"` 514 Help *string `protobuf:"bytes,2,opt,name=help" json:"help,omitempty"`
325 Type *MetricType `protobuf:"varint,3,opt,name=type,enum=io.prometheus.client.MetricType" json:"type,omitempty"` 515 Type *MetricType `protobuf:"varint,3,opt,name=type,enum=io.prometheus.client.MetricType" json:"type,omitempty"`
326 Metric []*Metric `protobuf:"bytes,4,rep,name=metric" json:"metric,omitempty"` 516 Metric []*Metric `protobuf:"bytes,4,rep,name=metric" json:"metric,omitempty"`
327 XXX_unrecognized []byte `json:"-"` 517 XXX_NoUnkeyedLiteral struct{} `json:"-"`
518 XXX_unrecognized []byte `json:"-"`
519 XXX_sizecache int32 `json:"-"`
328} 520}
329 521
330func (m *MetricFamily) Reset() { *m = MetricFamily{} } 522func (m *MetricFamily) Reset() { *m = MetricFamily{} }
331func (m *MetricFamily) String() string { return proto.CompactTextString(m) } 523func (m *MetricFamily) String() string { return proto.CompactTextString(m) }
332func (*MetricFamily) ProtoMessage() {} 524func (*MetricFamily) ProtoMessage() {}
525func (*MetricFamily) Descriptor() ([]byte, []int) {
526 return fileDescriptor_metrics_c97c9a2b9560cb8f, []int{9}
527}
528func (m *MetricFamily) XXX_Unmarshal(b []byte) error {
529 return xxx_messageInfo_MetricFamily.Unmarshal(m, b)
530}
531func (m *MetricFamily) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
532 return xxx_messageInfo_MetricFamily.Marshal(b, m, deterministic)
533}
534func (dst *MetricFamily) XXX_Merge(src proto.Message) {
535 xxx_messageInfo_MetricFamily.Merge(dst, src)
536}
537func (m *MetricFamily) XXX_Size() int {
538 return xxx_messageInfo_MetricFamily.Size(m)
539}
540func (m *MetricFamily) XXX_DiscardUnknown() {
541 xxx_messageInfo_MetricFamily.DiscardUnknown(m)
542}
543
544var xxx_messageInfo_MetricFamily proto.InternalMessageInfo
333 545
334func (m *MetricFamily) GetName() string { 546func (m *MetricFamily) GetName() string {
335 if m != nil && m.Name != nil { 547 if m != nil && m.Name != nil {
@@ -360,5 +572,58 @@ func (m *MetricFamily) GetMetric() []*Metric {
360} 572}
361 573
362func init() { 574func init() {
575 proto.RegisterType((*LabelPair)(nil), "io.prometheus.client.LabelPair")
576 proto.RegisterType((*Gauge)(nil), "io.prometheus.client.Gauge")
577 proto.RegisterType((*Counter)(nil), "io.prometheus.client.Counter")
578 proto.RegisterType((*Quantile)(nil), "io.prometheus.client.Quantile")
579 proto.RegisterType((*Summary)(nil), "io.prometheus.client.Summary")
580 proto.RegisterType((*Untyped)(nil), "io.prometheus.client.Untyped")
581 proto.RegisterType((*Histogram)(nil), "io.prometheus.client.Histogram")
582 proto.RegisterType((*Bucket)(nil), "io.prometheus.client.Bucket")
583 proto.RegisterType((*Metric)(nil), "io.prometheus.client.Metric")
584 proto.RegisterType((*MetricFamily)(nil), "io.prometheus.client.MetricFamily")
363 proto.RegisterEnum("io.prometheus.client.MetricType", MetricType_name, MetricType_value) 585 proto.RegisterEnum("io.prometheus.client.MetricType", MetricType_name, MetricType_value)
364} 586}
587
588func init() { proto.RegisterFile("metrics.proto", fileDescriptor_metrics_c97c9a2b9560cb8f) }
589
590var fileDescriptor_metrics_c97c9a2b9560cb8f = []byte{
591 // 591 bytes of a gzipped FileDescriptorProto
592 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x4f, 0x4f, 0xdb, 0x4e,
593 0x14, 0xfc, 0x99, 0xd8, 0x09, 0x7e, 0x86, 0x5f, 0xad, 0x15, 0x07, 0xab, 0x2d, 0x25, 0xcd, 0x89,
594 0xf6, 0x10, 0x54, 0x04, 0xaa, 0x44, 0xdb, 0x03, 0x50, 0x1a, 0x2a, 0xd5, 0x40, 0x37, 0xc9, 0x81,
595 0x5e, 0xac, 0x8d, 0x59, 0x25, 0x56, 0xbd, 0xb6, 0x6b, 0xef, 0x22, 0xe5, 0xdc, 0x43, 0xbf, 0x47,
596 0xbf, 0x68, 0xab, 0xfd, 0xe3, 0x18, 0x24, 0xc3, 0xa9, 0xb7, 0xb7, 0xf3, 0x66, 0xde, 0x8e, 0x77,
597 0xc7, 0x0b, 0x9b, 0x8c, 0xf2, 0x32, 0x89, 0xab, 0x61, 0x51, 0xe6, 0x3c, 0x47, 0x5b, 0x49, 0x2e,
598 0x2b, 0x46, 0xf9, 0x82, 0x8a, 0x6a, 0x18, 0xa7, 0x09, 0xcd, 0xf8, 0xe0, 0x10, 0xdc, 0x2f, 0x64,
599 0x46, 0xd3, 0x2b, 0x92, 0x94, 0x08, 0x81, 0x9d, 0x11, 0x46, 0x03, 0xab, 0x6f, 0xed, 0xba, 0x58,
600 0xd5, 0x68, 0x0b, 0x9c, 0x5b, 0x92, 0x0a, 0x1a, 0xac, 0x29, 0x50, 0x2f, 0x06, 0xdb, 0xe0, 0x8c,
601 0x88, 0x98, 0xdf, 0x69, 0x4b, 0x8d, 0x55, 0xb7, 0x77, 0xa0, 0x77, 0x9a, 0x8b, 0x8c, 0xd3, 0xf2,
602 0x01, 0xc2, 0x7b, 0x58, 0xff, 0x2a, 0x48, 0xc6, 0x93, 0x94, 0xa2, 0xa7, 0xb0, 0xfe, 0xc3, 0xd4,
603 0x86, 0xb4, 0x5a, 0xdf, 0xdf, 0x7d, 0xa5, 0xfe, 0x65, 0x41, 0x6f, 0x2c, 0x18, 0x23, 0xe5, 0x12,
604 0xbd, 0x84, 0x8d, 0x8a, 0xb0, 0x22, 0xa5, 0x51, 0x2c, 0x77, 0x54, 0x13, 0x6c, 0xec, 0x69, 0x4c,
605 0x99, 0x40, 0xdb, 0x00, 0x86, 0x52, 0x09, 0x66, 0x26, 0xb9, 0x1a, 0x19, 0x0b, 0x86, 0x8e, 0xee,
606 0xec, 0xdf, 0xe9, 0x77, 0x76, 0xbd, 0xfd, 0x17, 0xc3, 0xb6, 0xb3, 0x1a, 0xd6, 0x8e, 0x1b, 0x7f,
607 0xf2, 0x43, 0xa7, 0x19, 0x5f, 0x16, 0xf4, 0xe6, 0x81, 0x0f, 0xfd, 0x69, 0x81, 0x7b, 0x9e, 0x54,
608 0x3c, 0x9f, 0x97, 0x84, 0xfd, 0x03, 0xb3, 0x07, 0xd0, 0x9d, 0x89, 0xf8, 0x3b, 0xe5, 0xc6, 0xea,
609 0xf3, 0x76, 0xab, 0x27, 0x8a, 0x83, 0x0d, 0x77, 0x30, 0x81, 0xae, 0x46, 0xd0, 0x2b, 0xf0, 0x63,
610 0xc1, 0x44, 0x4a, 0x78, 0x72, 0x7b, 0xdf, 0xc5, 0x93, 0x06, 0xd7, 0x4e, 0x76, 0xc0, 0x13, 0x45,
611 0x41, 0xcb, 0x68, 0x96, 0x8b, 0xec, 0xc6, 0x58, 0x01, 0x05, 0x9d, 0x48, 0x64, 0xf0, 0x67, 0x0d,
612 0xba, 0xa1, 0xca, 0x18, 0x3a, 0x04, 0x27, 0x95, 0x31, 0x0a, 0x2c, 0xe5, 0x6a, 0xa7, 0xdd, 0xd5,
613 0x2a, 0x69, 0x58, 0xb3, 0xd1, 0x1b, 0x70, 0xe6, 0x32, 0x46, 0x6a, 0xb8, 0xb7, 0xff, 0xac, 0x5d,
614 0xa6, 0x92, 0x86, 0x35, 0x13, 0xbd, 0x85, 0x5e, 0xac, 0xa3, 0x15, 0x74, 0x94, 0x68, 0xbb, 0x5d,
615 0x64, 0xf2, 0x87, 0x6b, 0xb6, 0x14, 0x56, 0x3a, 0x33, 0x81, 0xfd, 0x98, 0xd0, 0x04, 0x0b, 0xd7,
616 0x6c, 0x29, 0x14, 0xfa, 0x8e, 0x03, 0xe7, 0x31, 0xa1, 0x09, 0x02, 0xae, 0xd9, 0xe8, 0x03, 0xb8,
617 0x8b, 0xfa, 0xea, 0x83, 0x9e, 0x92, 0x3e, 0x70, 0x30, 0xab, 0x84, 0xe0, 0x46, 0x21, 0xc3, 0xc2,
618 0x13, 0x46, 0x2b, 0x4e, 0x58, 0x11, 0xb1, 0x2a, 0xe8, 0xf6, 0xad, 0xdd, 0x0e, 0xf6, 0x56, 0x58,
619 0x58, 0x0d, 0x7e, 0x5b, 0xb0, 0xa1, 0x6f, 0xe0, 0x13, 0x61, 0x49, 0xba, 0x6c, 0xfd, 0x83, 0x11,
620 0xd8, 0x0b, 0x9a, 0x16, 0xe6, 0x07, 0x56, 0x35, 0x3a, 0x00, 0x5b, 0x7a, 0x54, 0x47, 0xf8, 0xff,
621 0x7e, 0xbf, 0xdd, 0x95, 0x9e, 0x3c, 0x59, 0x16, 0x14, 0x2b, 0xb6, 0x0c, 0x9f, 0x7e, 0x53, 0x02,
622 0xfb, 0xb1, 0xf0, 0x69, 0x1d, 0x36, 0xdc, 0xd7, 0x21, 0x40, 0x33, 0x09, 0x79, 0xd0, 0x3b, 0xbd,
623 0x9c, 0x5e, 0x4c, 0xce, 0xb0, 0xff, 0x1f, 0x72, 0xc1, 0x19, 0x1d, 0x4f, 0x47, 0x67, 0xbe, 0x25,
624 0xf1, 0xf1, 0x34, 0x0c, 0x8f, 0xf1, 0xb5, 0xbf, 0x26, 0x17, 0xd3, 0x8b, 0xc9, 0xf5, 0xd5, 0xd9,
625 0x47, 0xbf, 0x83, 0x36, 0xc1, 0x3d, 0xff, 0x3c, 0x9e, 0x5c, 0x8e, 0xf0, 0x71, 0xe8, 0xdb, 0x27,
626 0x18, 0x5a, 0x5f, 0xb2, 0x6f, 0x47, 0xf3, 0x84, 0x2f, 0xc4, 0x6c, 0x18, 0xe7, 0x6c, 0xaf, 0xe9,
627 0xee, 0xe9, 0x6e, 0xc4, 0xf2, 0x1b, 0x9a, 0xee, 0xcd, 0xf3, 0x77, 0x49, 0x1e, 0x35, 0xdd, 0x48,
628 0x77, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x45, 0x21, 0x7f, 0x64, 0x2b, 0x05, 0x00, 0x00,
629}
diff --git a/vendor/github.com/prometheus/common/expfmt/decode.go b/vendor/github.com/prometheus/common/expfmt/decode.go
index a7a42d5..c092723 100644
--- a/vendor/github.com/prometheus/common/expfmt/decode.go
+++ b/vendor/github.com/prometheus/common/expfmt/decode.go
@@ -164,9 +164,9 @@ func (sd *SampleDecoder) Decode(s *model.Vector) error {
164} 164}
165 165
166// ExtractSamples builds a slice of samples from the provided metric 166// ExtractSamples builds a slice of samples from the provided metric
167// families. If an error occurs during sample extraction, it continues to 167// families. If an error occurrs during sample extraction, it continues to
168// extract from the remaining metric families. The returned error is the last 168// extract from the remaining metric families. The returned error is the last
169// error that has occured. 169// error that has occurred.
170func ExtractSamples(o *DecodeOptions, fams ...*dto.MetricFamily) (model.Vector, error) { 170func ExtractSamples(o *DecodeOptions, fams ...*dto.MetricFamily) (model.Vector, error) {
171 var ( 171 var (
172 all model.Vector 172 all model.Vector
diff --git a/vendor/github.com/prometheus/common/expfmt/text_create.go b/vendor/github.com/prometheus/common/expfmt/text_create.go
index f11321c..46b7436 100644
--- a/vendor/github.com/prometheus/common/expfmt/text_create.go
+++ b/vendor/github.com/prometheus/common/expfmt/text_create.go
@@ -14,13 +14,44 @@
14package expfmt 14package expfmt
15 15
16import ( 16import (
17 "bytes"
17 "fmt" 18 "fmt"
18 "io" 19 "io"
19 "math" 20 "math"
20 "strings" 21 "strconv"
22 "sync"
21 23
22 dto "github.com/prometheus/client_model/go"
23 "github.com/prometheus/common/model" 24 "github.com/prometheus/common/model"
25
26 dto "github.com/prometheus/client_model/go"
27)
28
29// enhancedWriter has all the enhanced write functions needed here. bytes.Buffer
30// implements it.
31type enhancedWriter interface {
32 io.Writer
33 WriteRune(r rune) (n int, err error)
34 WriteString(s string) (n int, err error)
35 WriteByte(c byte) error
36}
37
38const (
39 initialBufSize = 512
40 initialNumBufSize = 24
41)
42
43var (
44 bufPool = sync.Pool{
45 New: func() interface{} {
46 return bytes.NewBuffer(make([]byte, 0, initialNumBufSize))
47 },
48 }
49 numBufPool = sync.Pool{
50 New: func() interface{} {
51 b := make([]byte, 0, initialNumBufSize)
52 return &b
53 },
54 }
24) 55)
25 56
26// MetricFamilyToText converts a MetricFamily proto message into text format and 57// MetricFamilyToText converts a MetricFamily proto message into text format and
@@ -32,37 +63,92 @@ import (
32// will result in invalid text format output. 63// will result in invalid text format output.
33// 64//
34// This method fulfills the type 'prometheus.encoder'. 65// This method fulfills the type 'prometheus.encoder'.
35func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (int, error) { 66func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (written int, err error) {
36 var written int
37
38 // Fail-fast checks. 67 // Fail-fast checks.
39 if len(in.Metric) == 0 { 68 if len(in.Metric) == 0 {
40 return written, fmt.Errorf("MetricFamily has no metrics: %s", in) 69 return 0, fmt.Errorf("MetricFamily has no metrics: %s", in)
41 } 70 }
42 name := in.GetName() 71 name := in.GetName()
43 if name == "" { 72 if name == "" {
44 return written, fmt.Errorf("MetricFamily has no name: %s", in) 73 return 0, fmt.Errorf("MetricFamily has no name: %s", in)
45 } 74 }
46 75
76 // Try the interface upgrade. If it doesn't work, we'll use a
77 // bytes.Buffer from the sync.Pool and write out its content to out in a
78 // single go in the end.
79 w, ok := out.(enhancedWriter)
80 if !ok {
81 b := bufPool.Get().(*bytes.Buffer)
82 b.Reset()
83 w = b
84 defer func() {
85 bWritten, bErr := out.Write(b.Bytes())
86 written = bWritten
87 if err == nil {
88 err = bErr
89 }
90 bufPool.Put(b)
91 }()
92 }
93
94 var n int
95
47 // Comments, first HELP, then TYPE. 96 // Comments, first HELP, then TYPE.
48 if in.Help != nil { 97 if in.Help != nil {
49 n, err := fmt.Fprintf( 98 n, err = w.WriteString("# HELP ")
50 out, "# HELP %s %s\n",
51 name, escapeString(*in.Help, false),
52 )
53 written += n 99 written += n
54 if err != nil { 100 if err != nil {
55 return written, err 101 return
102 }
103 n, err = w.WriteString(name)
104 written += n
105 if err != nil {
106 return
107 }
108 err = w.WriteByte(' ')
109 written++
110 if err != nil {
111 return
112 }
113 n, err = writeEscapedString(w, *in.Help, false)
114 written += n
115 if err != nil {
116 return
117 }
118 err = w.WriteByte('\n')
119 written++
120 if err != nil {
121 return
56 } 122 }
57 } 123 }
124 n, err = w.WriteString("# TYPE ")
125 written += n
126 if err != nil {
127 return
128 }
129 n, err = w.WriteString(name)
130 written += n
131 if err != nil {
132 return
133 }
58 metricType := in.GetType() 134 metricType := in.GetType()
59 n, err := fmt.Fprintf( 135 switch metricType {
60 out, "# TYPE %s %s\n", 136 case dto.MetricType_COUNTER:
61 name, strings.ToLower(metricType.String()), 137 n, err = w.WriteString(" counter\n")
62 ) 138 case dto.MetricType_GAUGE:
139 n, err = w.WriteString(" gauge\n")
140 case dto.MetricType_SUMMARY:
141 n, err = w.WriteString(" summary\n")
142 case dto.MetricType_UNTYPED:
143 n, err = w.WriteString(" untyped\n")
144 case dto.MetricType_HISTOGRAM:
145 n, err = w.WriteString(" histogram\n")
146 default:
147 return written, fmt.Errorf("unknown metric type %s", metricType.String())
148 }
63 written += n 149 written += n
64 if err != nil { 150 if err != nil {
65 return written, err 151 return
66 } 152 }
67 153
68 // Finally the samples, one line for each. 154 // Finally the samples, one line for each.
@@ -75,9 +161,8 @@ func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (int, error) {
75 ) 161 )
76 } 162 }
77 n, err = writeSample( 163 n, err = writeSample(
78 name, metric, "", "", 164 w, name, "", metric, "", 0,
79 metric.Counter.GetValue(), 165 metric.Counter.GetValue(),
80 out,
81 ) 166 )
82 case dto.MetricType_GAUGE: 167 case dto.MetricType_GAUGE:
83 if metric.Gauge == nil { 168 if metric.Gauge == nil {
@@ -86,9 +171,8 @@ func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (int, error) {
86 ) 171 )
87 } 172 }
88 n, err = writeSample( 173 n, err = writeSample(
89 name, metric, "", "", 174 w, name, "", metric, "", 0,
90 metric.Gauge.GetValue(), 175 metric.Gauge.GetValue(),
91 out,
92 ) 176 )
93 case dto.MetricType_UNTYPED: 177 case dto.MetricType_UNTYPED:
94 if metric.Untyped == nil { 178 if metric.Untyped == nil {
@@ -97,9 +181,8 @@ func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (int, error) {
97 ) 181 )
98 } 182 }
99 n, err = writeSample( 183 n, err = writeSample(
100 name, metric, "", "", 184 w, name, "", metric, "", 0,
101 metric.Untyped.GetValue(), 185 metric.Untyped.GetValue(),
102 out,
103 ) 186 )
104 case dto.MetricType_SUMMARY: 187 case dto.MetricType_SUMMARY:
105 if metric.Summary == nil { 188 if metric.Summary == nil {
@@ -109,29 +192,26 @@ func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (int, error) {
109 } 192 }
110 for _, q := range metric.Summary.Quantile { 193 for _, q := range metric.Summary.Quantile {
111 n, err = writeSample( 194 n, err = writeSample(
112 name, metric, 195 w, name, "", metric,
113 model.QuantileLabel, fmt.Sprint(q.GetQuantile()), 196 model.QuantileLabel, q.GetQuantile(),
114 q.GetValue(), 197 q.GetValue(),
115 out,
116 ) 198 )
117 written += n 199 written += n
118 if err != nil { 200 if err != nil {
119 return written, err 201 return
120 } 202 }
121 } 203 }
122 n, err = writeSample( 204 n, err = writeSample(
123 name+"_sum", metric, "", "", 205 w, name, "_sum", metric, "", 0,
124 metric.Summary.GetSampleSum(), 206 metric.Summary.GetSampleSum(),
125 out,
126 ) 207 )
208 written += n
127 if err != nil { 209 if err != nil {
128 return written, err 210 return
129 } 211 }
130 written += n
131 n, err = writeSample( 212 n, err = writeSample(
132 name+"_count", metric, "", "", 213 w, name, "_count", metric, "", 0,
133 float64(metric.Summary.GetSampleCount()), 214 float64(metric.Summary.GetSampleCount()),
134 out,
135 ) 215 )
136 case dto.MetricType_HISTOGRAM: 216 case dto.MetricType_HISTOGRAM:
137 if metric.Histogram == nil { 217 if metric.Histogram == nil {
@@ -140,46 +220,42 @@ func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (int, error) {
140 ) 220 )
141 } 221 }
142 infSeen := false 222 infSeen := false
143 for _, q := range metric.Histogram.Bucket { 223 for _, b := range metric.Histogram.Bucket {
144 n, err = writeSample( 224 n, err = writeSample(
145 name+"_bucket", metric, 225 w, name, "_bucket", metric,
146 model.BucketLabel, fmt.Sprint(q.GetUpperBound()), 226 model.BucketLabel, b.GetUpperBound(),
147 float64(q.GetCumulativeCount()), 227 float64(b.GetCumulativeCount()),
148 out,
149 ) 228 )
150 written += n 229 written += n
151 if err != nil { 230 if err != nil {
152 return written, err 231 return
153 } 232 }
154 if math.IsInf(q.GetUpperBound(), +1) { 233 if math.IsInf(b.GetUpperBound(), +1) {
155 infSeen = true 234 infSeen = true
156 } 235 }
157 } 236 }
158 if !infSeen { 237 if !infSeen {
159 n, err = writeSample( 238 n, err = writeSample(
160 name+"_bucket", metric, 239 w, name, "_bucket", metric,
161 model.BucketLabel, "+Inf", 240 model.BucketLabel, math.Inf(+1),
162 float64(metric.Histogram.GetSampleCount()), 241 float64(metric.Histogram.GetSampleCount()),
163 out,
164 ) 242 )
243 written += n
165 if err != nil { 244 if err != nil {
166 return written, err 245 return
167 } 246 }
168 written += n
169 } 247 }
170 n, err = writeSample( 248 n, err = writeSample(
171 name+"_sum", metric, "", "", 249 w, name, "_sum", metric, "", 0,
172 metric.Histogram.GetSampleSum(), 250 metric.Histogram.GetSampleSum(),
173 out,
174 ) 251 )
252 written += n
175 if err != nil { 253 if err != nil {
176 return written, err 254 return
177 } 255 }
178 written += n
179 n, err = writeSample( 256 n, err = writeSample(
180 name+"_count", metric, "", "", 257 w, name, "_count", metric, "", 0,
181 float64(metric.Histogram.GetSampleCount()), 258 float64(metric.Histogram.GetSampleCount()),
182 out,
183 ) 259 )
184 default: 260 default:
185 return written, fmt.Errorf( 261 return written, fmt.Errorf(
@@ -188,116 +264,219 @@ func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (int, error) {
188 } 264 }
189 written += n 265 written += n
190 if err != nil { 266 if err != nil {
191 return written, err 267 return
192 } 268 }
193 } 269 }
194 return written, nil 270 return
195} 271}
196 272
197// writeSample writes a single sample in text format to out, given the metric 273// writeSample writes a single sample in text format to w, given the metric
198// name, the metric proto message itself, optionally an additional label name 274// name, the metric proto message itself, optionally an additional label name
199// and value (use empty strings if not required), and the value. The function 275// with a float64 value (use empty string as label name if not required), and
200// returns the number of bytes written and any error encountered. 276// the value. The function returns the number of bytes written and any error
277// encountered.
201func writeSample( 278func writeSample(
202 name string, 279 w enhancedWriter,
280 name, suffix string,
203 metric *dto.Metric, 281 metric *dto.Metric,
204 additionalLabelName, additionalLabelValue string, 282 additionalLabelName string, additionalLabelValue float64,
205 value float64, 283 value float64,
206 out io.Writer,
207) (int, error) { 284) (int, error) {
208 var written int 285 var written int
209 n, err := fmt.Fprint(out, name) 286 n, err := w.WriteString(name)
210 written += n 287 written += n
211 if err != nil { 288 if err != nil {
212 return written, err 289 return written, err
213 } 290 }
214 n, err = labelPairsToText( 291 if suffix != "" {
215 metric.Label, 292 n, err = w.WriteString(suffix)
216 additionalLabelName, additionalLabelValue, 293 written += n
217 out, 294 if err != nil {
295 return written, err
296 }
297 }
298 n, err = writeLabelPairs(
299 w, metric.Label, additionalLabelName, additionalLabelValue,
218 ) 300 )
219 written += n 301 written += n
220 if err != nil { 302 if err != nil {
221 return written, err 303 return written, err
222 } 304 }
223 n, err = fmt.Fprintf(out, " %v", value) 305 err = w.WriteByte(' ')
306 written++
307 if err != nil {
308 return written, err
309 }
310 n, err = writeFloat(w, value)
224 written += n 311 written += n
225 if err != nil { 312 if err != nil {
226 return written, err 313 return written, err
227 } 314 }
228 if metric.TimestampMs != nil { 315 if metric.TimestampMs != nil {
229 n, err = fmt.Fprintf(out, " %v", *metric.TimestampMs) 316 err = w.WriteByte(' ')
317 written++
318 if err != nil {
319 return written, err
320 }
321 n, err = writeInt(w, *metric.TimestampMs)
230 written += n 322 written += n
231 if err != nil { 323 if err != nil {
232 return written, err 324 return written, err
233 } 325 }
234 } 326 }
235 n, err = out.Write([]byte{'\n'}) 327 err = w.WriteByte('\n')
236 written += n 328 written++
237 if err != nil { 329 if err != nil {
238 return written, err 330 return written, err
239 } 331 }
240 return written, nil 332 return written, nil
241} 333}
242 334
243// labelPairsToText converts a slice of LabelPair proto messages plus the 335// writeLabelPairs converts a slice of LabelPair proto messages plus the
244// explicitly given additional label pair into text formatted as required by the 336// explicitly given additional label pair into text formatted as required by the
245// text format and writes it to 'out'. An empty slice in combination with an 337// text format and writes it to 'w'. An empty slice in combination with an empty
246// empty string 'additionalLabelName' results in nothing being 338// string 'additionalLabelName' results in nothing being written. Otherwise, the
247// written. Otherwise, the label pairs are written, escaped as required by the 339// label pairs are written, escaped as required by the text format, and enclosed
248// text format, and enclosed in '{...}'. The function returns the number of 340// in '{...}'. The function returns the number of bytes written and any error
249// bytes written and any error encountered. 341// encountered.
250func labelPairsToText( 342func writeLabelPairs(
343 w enhancedWriter,
251 in []*dto.LabelPair, 344 in []*dto.LabelPair,
252 additionalLabelName, additionalLabelValue string, 345 additionalLabelName string, additionalLabelValue float64,
253 out io.Writer,
254) (int, error) { 346) (int, error) {
255 if len(in) == 0 && additionalLabelName == "" { 347 if len(in) == 0 && additionalLabelName == "" {
256 return 0, nil 348 return 0, nil
257 } 349 }
258 var written int 350 var (
259 separator := '{' 351 written int
352 separator byte = '{'
353 )
260 for _, lp := range in { 354 for _, lp := range in {
261 n, err := fmt.Fprintf( 355 err := w.WriteByte(separator)
262 out, `%c%s="%s"`, 356 written++
263 separator, lp.GetName(), escapeString(lp.GetValue(), true), 357 if err != nil {
264 ) 358 return written, err
359 }
360 n, err := w.WriteString(lp.GetName())
361 written += n
362 if err != nil {
363 return written, err
364 }
365 n, err = w.WriteString(`="`)
265 written += n 366 written += n
266 if err != nil { 367 if err != nil {
267 return written, err 368 return written, err
268 } 369 }
370 n, err = writeEscapedString(w, lp.GetValue(), true)
371 written += n
372 if err != nil {
373 return written, err
374 }
375 err = w.WriteByte('"')
376 written++
377 if err != nil {
378 return written, err
379 }
269 separator = ',' 380 separator = ','
270 } 381 }
271 if additionalLabelName != "" { 382 if additionalLabelName != "" {
272 n, err := fmt.Fprintf( 383 err := w.WriteByte(separator)
273 out, `%c%s="%s"`, 384 written++
274 separator, additionalLabelName, 385 if err != nil {
275 escapeString(additionalLabelValue, true), 386 return written, err
276 ) 387 }
388 n, err := w.WriteString(additionalLabelName)
277 written += n 389 written += n
278 if err != nil { 390 if err != nil {
279 return written, err 391 return written, err
280 } 392 }
393 n, err = w.WriteString(`="`)
394 written += n
395 if err != nil {
396 return written, err
397 }
398 n, err = writeFloat(w, additionalLabelValue)
399 written += n
400 if err != nil {
401 return written, err
402 }
403 err = w.WriteByte('"')
404 written++
405 if err != nil {
406 return written, err
407 }
281 } 408 }
282 n, err := out.Write([]byte{'}'}) 409 err := w.WriteByte('}')
283 written += n 410 written++
284 if err != nil { 411 if err != nil {
285 return written, err 412 return written, err
286 } 413 }
287 return written, nil 414 return written, nil
288} 415}
289 416
290var ( 417// writeEscapedString replaces '\' by '\\', new line character by '\n', and - if
291 escape = strings.NewReplacer("\\", `\\`, "\n", `\n`)
292 escapeWithDoubleQuote = strings.NewReplacer("\\", `\\`, "\n", `\n`, "\"", `\"`)
293)
294
295// escapeString replaces '\' by '\\', new line character by '\n', and - if
296// includeDoubleQuote is true - '"' by '\"'. 418// includeDoubleQuote is true - '"' by '\"'.
297func escapeString(v string, includeDoubleQuote bool) string { 419func writeEscapedString(w enhancedWriter, v string, includeDoubleQuote bool) (int, error) {
298 if includeDoubleQuote { 420 var (
299 return escapeWithDoubleQuote.Replace(v) 421 written, n int
422 err error
423 )
424 for _, r := range v {
425 switch r {
426 case '\\':
427 n, err = w.WriteString(`\\`)
428 case '\n':
429 n, err = w.WriteString(`\n`)
430 case '"':
431 if includeDoubleQuote {
432 n, err = w.WriteString(`\"`)
433 } else {
434 n, err = w.WriteRune(r)
435 }
436 default:
437 n, err = w.WriteRune(r)
438 }
439 written += n
440 if err != nil {
441 return written, err
442 }
300 } 443 }
444 return written, nil
445}
446
447// writeFloat is equivalent to fmt.Fprint with a float64 argument but hardcodes
448// a few common cases for increased efficiency. For non-hardcoded cases, it uses
449// strconv.AppendFloat to avoid allocations, similar to writeInt.
450func writeFloat(w enhancedWriter, f float64) (int, error) {
451 switch {
452 case f == 1:
453 return 1, w.WriteByte('1')
454 case f == 0:
455 return 1, w.WriteByte('0')
456 case f == -1:
457 return w.WriteString("-1")
458 case math.IsNaN(f):
459 return w.WriteString("NaN")
460 case math.IsInf(f, +1):
461 return w.WriteString("+Inf")
462 case math.IsInf(f, -1):
463 return w.WriteString("-Inf")
464 default:
465 bp := numBufPool.Get().(*[]byte)
466 *bp = strconv.AppendFloat((*bp)[:0], f, 'g', -1, 64)
467 written, err := w.Write(*bp)
468 numBufPool.Put(bp)
469 return written, err
470 }
471}
301 472
302 return escape.Replace(v) 473// writeInt is equivalent to fmt.Fprint with an int64 argument but uses
474// strconv.AppendInt with a byte slice taken from a sync.Pool to avoid
475// allocations.
476func writeInt(w enhancedWriter, i int64) (int, error) {
477 bp := numBufPool.Get().(*[]byte)
478 *bp = strconv.AppendInt((*bp)[:0], i, 10)
479 written, err := w.Write(*bp)
480 numBufPool.Put(bp)
481 return written, err
303} 482}
diff --git a/vendor/github.com/prometheus/common/expfmt/text_parse.go b/vendor/github.com/prometheus/common/expfmt/text_parse.go
index 54bcfde..ec3d86b 100644
--- a/vendor/github.com/prometheus/common/expfmt/text_parse.go
+++ b/vendor/github.com/prometheus/common/expfmt/text_parse.go
@@ -359,7 +359,7 @@ func (p *TextParser) startLabelValue() stateFn {
359 } 359 }
360 return p.readingValue 360 return p.readingValue
361 default: 361 default:
362 p.parseError(fmt.Sprintf("unexpected end of label value %q", p.currentLabelPair.Value)) 362 p.parseError(fmt.Sprintf("unexpected end of label value %q", p.currentLabelPair.GetValue()))
363 return nil 363 return nil
364 } 364 }
365} 365}
@@ -556,8 +556,8 @@ func (p *TextParser) readTokenUntilWhitespace() {
556// byte considered is the byte already read (now in p.currentByte). The first 556// byte considered is the byte already read (now in p.currentByte). The first
557// newline byte encountered is still copied into p.currentByte, but not into 557// newline byte encountered is still copied into p.currentByte, but not into
558// p.currentToken. If recognizeEscapeSequence is true, two escape sequences are 558// p.currentToken. If recognizeEscapeSequence is true, two escape sequences are
559// recognized: '\\' tranlates into '\', and '\n' into a line-feed character. All 559// recognized: '\\' translates into '\', and '\n' into a line-feed character.
560// other escape sequences are invalid and cause an error. 560// All other escape sequences are invalid and cause an error.
561func (p *TextParser) readTokenUntilNewline(recognizeEscapeSequence bool) { 561func (p *TextParser) readTokenUntilNewline(recognizeEscapeSequence bool) {
562 p.currentToken.Reset() 562 p.currentToken.Reset()
563 escaped := false 563 escaped := false
diff --git a/vendor/github.com/prometheus/common/model/silence.go b/vendor/github.com/prometheus/common/model/silence.go
index 7538e29..bb99889 100644
--- a/vendor/github.com/prometheus/common/model/silence.go
+++ b/vendor/github.com/prometheus/common/model/silence.go
@@ -59,8 +59,8 @@ func (m *Matcher) Validate() error {
59 return nil 59 return nil
60} 60}
61 61
62// Silence defines the representation of a silence definiton 62// Silence defines the representation of a silence definition in the Prometheus
63// in the Prometheus eco-system. 63// eco-system.
64type Silence struct { 64type Silence struct {
65 ID uint64 `json:"id,omitempty"` 65 ID uint64 `json:"id,omitempty"`
66 66
diff --git a/vendor/github.com/prometheus/common/model/value.go b/vendor/github.com/prometheus/common/model/value.go
index c9ed3ff..c9d8fb1 100644
--- a/vendor/github.com/prometheus/common/model/value.go
+++ b/vendor/github.com/prometheus/common/model/value.go
@@ -100,7 +100,7 @@ func (s *SamplePair) UnmarshalJSON(b []byte) error {
100} 100}
101 101
102// Equal returns true if this SamplePair and o have equal Values and equal 102// Equal returns true if this SamplePair and o have equal Values and equal
103// Timestamps. The sematics of Value equality is defined by SampleValue.Equal. 103// Timestamps. The semantics of Value equality is defined by SampleValue.Equal.
104func (s *SamplePair) Equal(o *SamplePair) bool { 104func (s *SamplePair) Equal(o *SamplePair) bool {
105 return s == o || (s.Value.Equal(o.Value) && s.Timestamp.Equal(o.Timestamp)) 105 return s == o || (s.Value.Equal(o.Value) && s.Timestamp.Equal(o.Timestamp))
106} 106}
@@ -117,7 +117,7 @@ type Sample struct {
117} 117}
118 118
119// Equal compares first the metrics, then the timestamp, then the value. The 119// Equal compares first the metrics, then the timestamp, then the value. The
120// sematics of value equality is defined by SampleValue.Equal. 120// semantics of value equality is defined by SampleValue.Equal.
121func (s *Sample) Equal(o *Sample) bool { 121func (s *Sample) Equal(o *Sample) bool {
122 if s == o { 122 if s == o {
123 return true 123 return true
diff --git a/vendor/vendor.json b/vendor/vendor.json
index 9407cf6..e5a1488 100644
--- a/vendor/vendor.json
+++ b/vendor/vendor.json
@@ -125,56 +125,62 @@
125 { 125 {
126 "checksumSHA1": "frS661rlSEZWE9CezHhnFioQK/I=", 126 "checksumSHA1": "frS661rlSEZWE9CezHhnFioQK/I=",
127 "path": "github.com/prometheus/client_golang/prometheus", 127 "path": "github.com/prometheus/client_golang/prometheus",
128 "revision": "0a8115f42e037a6e327f9a269a26ff6603fb8472", 128 "revision": "1cafe34db7fdec6022e17e00e1c1ea501022f3e4",
129 "revisionTime": "2018-10-01T17:40:01Z" 129 "revisionTime": "2018-10-15T14:52:39Z",
130 "version": "v0.9",
131 "versionExact": "v0.9.0"
130 }, 132 },
131 { 133 {
132 "checksumSHA1": "UBqhkyjCz47+S19MVTigxJ2VjVQ=", 134 "checksumSHA1": "UBqhkyjCz47+S19MVTigxJ2VjVQ=",
133 "path": "github.com/prometheus/client_golang/prometheus/internal", 135 "path": "github.com/prometheus/client_golang/prometheus/internal",
134 "revision": "0a8115f42e037a6e327f9a269a26ff6603fb8472", 136 "revision": "1cafe34db7fdec6022e17e00e1c1ea501022f3e4",
135 "revisionTime": "2018-10-01T17:40:01Z" 137 "revisionTime": "2018-10-15T14:52:39Z",
138 "version": "v0.9",
139 "versionExact": "v0.9.0"
136 }, 140 },
137 { 141 {
138 "checksumSHA1": "d5BiEvD8MrgpWQ6PQJUvawJsMak=", 142 "checksumSHA1": "d5BiEvD8MrgpWQ6PQJUvawJsMak=",
139 "path": "github.com/prometheus/client_golang/prometheus/promhttp", 143 "path": "github.com/prometheus/client_golang/prometheus/promhttp",
140 "revision": "0a8115f42e037a6e327f9a269a26ff6603fb8472", 144 "revision": "1cafe34db7fdec6022e17e00e1c1ea501022f3e4",
141 "revisionTime": "2018-10-01T17:40:01Z" 145 "revisionTime": "2018-10-15T14:52:39Z",
146 "version": "v0.9",
147 "versionExact": "v0.9.0"
142 }, 148 },
143 { 149 {
144 "checksumSHA1": "DvwvOlPNAgRntBzt3b3OSRMS2N4=", 150 "checksumSHA1": "V8xkqgmP66sq2ZW4QO5wi9a4oZE=",
145 "path": "github.com/prometheus/client_model/go", 151 "path": "github.com/prometheus/client_model/go",
146 "revision": "99fa1f4be8e564e8a6b613da7fa6f46c9edafc6c", 152 "revision": "5c3871d89910bfb32f5fcab2aa4b9ec68e65a99f",
147 "revisionTime": "2017-11-17T10:05:41Z" 153 "revisionTime": "2018-07-12T10:51:10Z"
148 }, 154 },
149 { 155 {
150 "checksumSHA1": "+wZ+Pa6NX+NOxUvayXBXGOcqFe8=", 156 "checksumSHA1": "hGf3xT6gRaJh2zAEbWj9YnV+K+0=",
151 "path": "github.com/prometheus/common/expfmt", 157 "path": "github.com/prometheus/common/expfmt",
152 "revision": "38c53a9f4bfcd932d1b00bfc65e256a7fba6b37a", 158 "revision": "bcb74de08d37a417cb6789eec1d6c810040f0470",
153 "revisionTime": "2018-03-26T16:04:09Z" 159 "revisionTime": "2018-10-15T12:42:27Z"
154 }, 160 },
155 { 161 {
156 "checksumSHA1": "GWlM3d2vPYyNATtTFgftS10/A9w=", 162 "checksumSHA1": "GWlM3d2vPYyNATtTFgftS10/A9w=",
157 "path": "github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg", 163 "path": "github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg",
158 "revision": "38c53a9f4bfcd932d1b00bfc65e256a7fba6b37a", 164 "revision": "bcb74de08d37a417cb6789eec1d6c810040f0470",
159 "revisionTime": "2018-03-26T16:04:09Z" 165 "revisionTime": "2018-10-15T12:42:27Z"
160 }, 166 },
161 { 167 {
162 "checksumSHA1": "MGnqHnmEqc1fjnYiWReSiW8C27A=", 168 "checksumSHA1": "MGnqHnmEqc1fjnYiWReSiW8C27A=",
163 "path": "github.com/prometheus/common/log", 169 "path": "github.com/prometheus/common/log",
164 "revision": "38c53a9f4bfcd932d1b00bfc65e256a7fba6b37a", 170 "revision": "bcb74de08d37a417cb6789eec1d6c810040f0470",
165 "revisionTime": "2018-03-26T16:04:09Z" 171 "revisionTime": "2018-10-15T12:42:27Z"
166 }, 172 },
167 { 173 {
168 "checksumSHA1": "YU+/K48IMawQnToO4ETE6a+hhj4=", 174 "checksumSHA1": "EXTRY7DL9gFW8c341Dk6LDXCBn8=",
169 "path": "github.com/prometheus/common/model", 175 "path": "github.com/prometheus/common/model",
170 "revision": "38c53a9f4bfcd932d1b00bfc65e256a7fba6b37a", 176 "revision": "bcb74de08d37a417cb6789eec1d6c810040f0470",
171 "revisionTime": "2018-03-26T16:04:09Z" 177 "revisionTime": "2018-10-15T12:42:27Z"
172 }, 178 },
173 { 179 {
174 "checksumSHA1": "91KYK0SpvkaMJJA2+BcxbVnyRO0=", 180 "checksumSHA1": "91KYK0SpvkaMJJA2+BcxbVnyRO0=",
175 "path": "github.com/prometheus/common/version", 181 "path": "github.com/prometheus/common/version",
176 "revision": "38c53a9f4bfcd932d1b00bfc65e256a7fba6b37a", 182 "revision": "bcb74de08d37a417cb6789eec1d6c810040f0470",
177 "revisionTime": "2018-03-26T16:04:09Z" 183 "revisionTime": "2018-10-15T12:42:27Z"
178 }, 184 },
179 { 185 {
180 "checksumSHA1": "4zOdjJcskuocAzI+i6rcRzYjSlI=", 186 "checksumSHA1": "4zOdjJcskuocAzI+i6rcRzYjSlI=",