Skip to content

Commit 14259fa

Browse files
author
Arthur Silva Sens
authored
Merge pull request #1448 from ywwg/owilliams/content-negotiation
deps: bump prometheus/common version
2 parents 353395b + 6d03920 commit 14259fa

File tree

7 files changed

+29
-29
lines changed

7 files changed

+29
-29
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/davecgh/go-spew v1.1.1
99
github.com/json-iterator/go v1.1.12
1010
github.com/prometheus/client_model v0.5.0
11-
github.com/prometheus/common v0.46.0
11+
github.com/prometheus/common v0.48.0
1212
github.com/prometheus/procfs v0.12.0
1313
golang.org/x/sys v0.16.0
1414
google.golang.org/protobuf v1.32.0

go.sum

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS
1111
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
1212
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
1313
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
14-
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
14+
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
1515
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
1616
github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA=
1717
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
@@ -33,8 +33,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
3333
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
3434
github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw=
3535
github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI=
36-
github.com/prometheus/common v0.46.0 h1:doXzt5ybi1HBKpsZOL0sSkaNHJJqkyfEWZGGqqScV0Y=
37-
github.com/prometheus/common v0.46.0/go.mod h1:Tp0qkxpb9Jsg54QMe+EAmqXkSV7Evdy1BTn+g2pa/hQ=
36+
github.com/prometheus/common v0.48.0 h1:QO8U2CdOzSn1BBsmXJXduaaW+dY/5QLjfB8svtSzKKE=
37+
github.com/prometheus/common v0.48.0/go.mod h1:0/KsvlIEfPQCQ5I2iNSAWKPZziNCvRs5EC6ILDTlAPc=
3838
github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo=
3939
github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
4040
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=

prometheus/push/push.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func New(url, job string) *Pusher {
109109
gatherers: prometheus.Gatherers{reg},
110110
registerer: reg,
111111
client: &http.Client{},
112-
expfmt: expfmt.FmtProtoDelim,
112+
expfmt: expfmt.NewFormat(expfmt.TypeProtoDelim),
113113
}
114114
}
115115

prometheus/push/push_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func TestPush(t *testing.T) {
8484
}
8585

8686
buf := &bytes.Buffer{}
87-
enc := expfmt.NewEncoder(buf, expfmt.FmtProtoDelim)
87+
enc := expfmt.NewEncoder(buf, expfmt.NewFormat(expfmt.TypeProtoDelim))
8888

8989
for _, mf := range mfs {
9090
if err := enc.Encode(mf); err != nil {

prometheus/registry_test.go

+20-20
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func testHandler(t testing.TB) {
9292
},
9393
}
9494
externalBuf := &bytes.Buffer{}
95-
enc := expfmt.NewEncoder(externalBuf, expfmt.FmtProtoDelim)
95+
enc := expfmt.NewEncoder(externalBuf, expfmt.NewFormat(expfmt.TypeProtoDelim))
9696
if err := enc.Encode(externalMetricFamily); err != nil {
9797
t.Fatal(err)
9898
}
@@ -162,7 +162,7 @@ metric: <
162162
},
163163
}
164164
buf := &bytes.Buffer{}
165-
enc = expfmt.NewEncoder(buf, expfmt.FmtProtoDelim)
165+
enc = expfmt.NewEncoder(buf, expfmt.NewFormat(expfmt.TypeProtoDelim))
166166
if err := enc.Encode(expectedMetricFamily); err != nil {
167167
t.Fatal(err)
168168
}
@@ -361,7 +361,7 @@ collected metric "broken_metric" { label:<name:"foo" value:"bar" > label:<name:"
361361
},
362362
out: output{
363363
headers: map[string]string{
364-
"Content-Type": `text/plain; version=0.0.4; charset=utf-8`,
364+
"Content-Type": `text/plain; version=0.0.4; charset=utf-8; escaping=values`,
365365
},
366366
body: []byte{},
367367
},
@@ -372,7 +372,7 @@ collected metric "broken_metric" { label:<name:"foo" value:"bar" > label:<name:"
372372
},
373373
out: output{
374374
headers: map[string]string{
375-
"Content-Type": `text/plain; version=0.0.4; charset=utf-8`,
375+
"Content-Type": `text/plain; version=0.0.4; charset=utf-8; escaping=values`,
376376
},
377377
body: []byte{},
378378
},
@@ -383,7 +383,7 @@ collected metric "broken_metric" { label:<name:"foo" value:"bar" > label:<name:"
383383
},
384384
out: output{
385385
headers: map[string]string{
386-
"Content-Type": `text/plain; version=0.0.4; charset=utf-8`,
386+
"Content-Type": `text/plain; version=0.0.4; charset=utf-8; escaping=values`,
387387
},
388388
body: []byte{},
389389
},
@@ -394,7 +394,7 @@ collected metric "broken_metric" { label:<name:"foo" value:"bar" > label:<name:"
394394
},
395395
out: output{
396396
headers: map[string]string{
397-
"Content-Type": `application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=delimited`,
397+
"Content-Type": `application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=delimited; escaping=values`,
398398
},
399399
body: []byte{},
400400
},
@@ -405,7 +405,7 @@ collected metric "broken_metric" { label:<name:"foo" value:"bar" > label:<name:"
405405
},
406406
out: output{
407407
headers: map[string]string{
408-
"Content-Type": `text/plain; version=0.0.4; charset=utf-8`,
408+
"Content-Type": `text/plain; version=0.0.4; charset=utf-8; escaping=values`,
409409
},
410410
body: expectedMetricFamilyAsText,
411411
},
@@ -417,7 +417,7 @@ collected metric "broken_metric" { label:<name:"foo" value:"bar" > label:<name:"
417417
},
418418
out: output{
419419
headers: map[string]string{
420-
"Content-Type": `application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=delimited`,
420+
"Content-Type": `application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=delimited; escaping=values`,
421421
},
422422
body: expectedMetricFamilyAsBytes,
423423
},
@@ -429,7 +429,7 @@ collected metric "broken_metric" { label:<name:"foo" value:"bar" > label:<name:"
429429
},
430430
out: output{
431431
headers: map[string]string{
432-
"Content-Type": `text/plain; version=0.0.4; charset=utf-8`,
432+
"Content-Type": `text/plain; version=0.0.4; charset=utf-8; escaping=values`,
433433
},
434434
body: externalMetricFamilyAsText,
435435
},
@@ -441,7 +441,7 @@ collected metric "broken_metric" { label:<name:"foo" value:"bar" > label:<name:"
441441
},
442442
out: output{
443443
headers: map[string]string{
444-
"Content-Type": `application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=delimited`,
444+
"Content-Type": `application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=delimited; escaping=values`,
445445
},
446446
body: externalMetricFamilyAsBytes,
447447
},
@@ -453,7 +453,7 @@ collected metric "broken_metric" { label:<name:"foo" value:"bar" > label:<name:"
453453
},
454454
out: output{
455455
headers: map[string]string{
456-
"Content-Type": `application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=delimited`,
456+
"Content-Type": `application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=delimited; escaping=values`,
457457
},
458458
body: bytes.Join(
459459
[][]byte{
@@ -472,7 +472,7 @@ collected metric "broken_metric" { label:<name:"foo" value:"bar" > label:<name:"
472472
},
473473
out: output{
474474
headers: map[string]string{
475-
"Content-Type": `text/plain; version=0.0.4; charset=utf-8`,
475+
"Content-Type": `text/plain; version=0.0.4; charset=utf-8; escaping=values`,
476476
},
477477
body: []byte{},
478478
},
@@ -483,7 +483,7 @@ collected metric "broken_metric" { label:<name:"foo" value:"bar" > label:<name:"
483483
},
484484
out: output{
485485
headers: map[string]string{
486-
"Content-Type": `text/plain; version=0.0.4; charset=utf-8`,
486+
"Content-Type": `text/plain; version=0.0.4; charset=utf-8; escaping=values`,
487487
},
488488
body: expectedMetricFamilyAsText,
489489
},
@@ -495,7 +495,7 @@ collected metric "broken_metric" { label:<name:"foo" value:"bar" > label:<name:"
495495
},
496496
out: output{
497497
headers: map[string]string{
498-
"Content-Type": `text/plain; version=0.0.4; charset=utf-8`,
498+
"Content-Type": `text/plain; version=0.0.4; charset=utf-8; escaping=values`,
499499
},
500500
body: bytes.Join(
501501
[][]byte{
@@ -514,7 +514,7 @@ collected metric "broken_metric" { label:<name:"foo" value:"bar" > label:<name:"
514514
},
515515
out: output{
516516
headers: map[string]string{
517-
"Content-Type": `application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=delimited`,
517+
"Content-Type": `application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=delimited; escaping=values`,
518518
},
519519
body: bytes.Join(
520520
[][]byte{
@@ -533,7 +533,7 @@ collected metric "broken_metric" { label:<name:"foo" value:"bar" > label:<name:"
533533
},
534534
out: output{
535535
headers: map[string]string{
536-
"Content-Type": `application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=text`,
536+
"Content-Type": `application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=text; escaping=values`,
537537
},
538538
body: bytes.Join(
539539
[][]byte{
@@ -552,7 +552,7 @@ collected metric "broken_metric" { label:<name:"foo" value:"bar" > label:<name:"
552552
},
553553
out: output{
554554
headers: map[string]string{
555-
"Content-Type": `application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=compact-text`,
555+
"Content-Type": `application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=compact-text; escaping=values`,
556556
},
557557
body: bytes.Join(
558558
[][]byte{
@@ -571,7 +571,7 @@ collected metric "broken_metric" { label:<name:"foo" value:"bar" > label:<name:"
571571
},
572572
out: output{
573573
headers: map[string]string{
574-
"Content-Type": `application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=compact-text`,
574+
"Content-Type": `application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=compact-text; escaping=values`,
575575
},
576576
body: bytes.Join(
577577
[][]byte{
@@ -609,7 +609,7 @@ collected metric "broken_metric" { label:<name:"foo" value:"bar" > label:<name:"
609609
},
610610
out: output{
611611
headers: map[string]string{
612-
"Content-Type": `text/plain; version=0.0.4; charset=utf-8`,
612+
"Content-Type": `text/plain; version=0.0.4; charset=utf-8; escaping=values`,
613613
},
614614
body: expectedMetricFamilyAsText,
615615
},
@@ -666,7 +666,7 @@ collected metric "broken_metric" { label:<name:"foo" value:"bar" > label:<name:"
666666
},
667667
out: output{
668668
headers: map[string]string{
669-
"Content-Type": `text/plain; version=0.0.4; charset=utf-8`,
669+
"Content-Type": `text/plain; version=0.0.4; charset=utf-8; escaping=values`,
670670
},
671671
body: bytes.Join(
672672
[][]byte{

prometheus/testutil/promlint/promlint.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func (l *Linter) Lint() ([]Problem, error) {
6868
var problems []Problem
6969

7070
if l.r != nil {
71-
d := expfmt.NewDecoder(l.r, expfmt.FmtText)
71+
d := expfmt.NewDecoder(l.r, expfmt.NewFormat(expfmt.TypeTextPlain))
7272

7373
mf := &dto.MetricFamily{}
7474
for {

prometheus/testutil/testutil.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -265,13 +265,13 @@ func compareMetricFamilies(got, expected []*dto.MetricFamily, metricNames ...str
265265
// result.
266266
func compare(got, want []*dto.MetricFamily) error {
267267
var gotBuf, wantBuf bytes.Buffer
268-
enc := expfmt.NewEncoder(&gotBuf, expfmt.FmtText)
268+
enc := expfmt.NewEncoder(&gotBuf, expfmt.NewFormat(expfmt.TypeTextPlain))
269269
for _, mf := range got {
270270
if err := enc.Encode(mf); err != nil {
271271
return fmt.Errorf("encoding gathered metrics failed: %w", err)
272272
}
273273
}
274-
enc = expfmt.NewEncoder(&wantBuf, expfmt.FmtText)
274+
enc = expfmt.NewEncoder(&wantBuf, expfmt.NewFormat(expfmt.TypeTextPlain))
275275
for _, mf := range want {
276276
if err := enc.Encode(mf); err != nil {
277277
return fmt.Errorf("encoding expected metrics failed: %w", err)

0 commit comments

Comments
 (0)