Skip to content

Commit 768a0a4

Browse files
committed
chore: Bump prometheus/common library
1 parent fa5eb67 commit 768a0a4

File tree

5 files changed

+35
-33
lines changed

5 files changed

+35
-33
lines changed

go.mod

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ require (
88
github.com/gobuffalo/flect v1.0.2
99
github.com/google/go-cmp v0.6.0
1010
github.com/oklog/run v1.1.0
11-
github.com/prometheus/client_golang v1.18.0
11+
github.com/prometheus/client_golang v1.19.0
1212
github.com/prometheus/client_model v0.6.0
13-
github.com/prometheus/common v0.47.0
13+
github.com/prometheus/common v0.51.1
1414
github.com/prometheus/exporter-toolkit v0.11.0
1515
github.com/robfig/cron/v3 v3.0.1
1616
github.com/spf13/cobra v1.8.0
@@ -70,13 +70,13 @@ require (
7070
github.com/spf13/pflag v1.0.5 // indirect
7171
github.com/subosito/gotenv v1.6.0 // indirect
7272
go.uber.org/multierr v1.11.0 // indirect
73-
golang.org/x/crypto v0.18.0 // indirect
73+
golang.org/x/crypto v0.21.0 // indirect
7474
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
75-
golang.org/x/net v0.20.0 // indirect
76-
golang.org/x/oauth2 v0.16.0 // indirect
75+
golang.org/x/net v0.22.0 // indirect
76+
golang.org/x/oauth2 v0.18.0 // indirect
7777
golang.org/x/sync v0.5.0 // indirect
78-
golang.org/x/sys v0.16.0 // indirect
79-
golang.org/x/term v0.16.0 // indirect
78+
golang.org/x/sys v0.18.0 // indirect
79+
golang.org/x/term v0.18.0 // indirect
8080
golang.org/x/text v0.14.0 // indirect
8181
golang.org/x/time v0.5.0 // indirect
8282
google.golang.org/appengine v1.6.7 // indirect

go.sum

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,12 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
105105
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
106106
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
107107
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
108-
github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk=
109-
github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA=
108+
github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7kmXYlnfbA6JU=
109+
github.com/prometheus/client_golang v1.19.0/go.mod h1:ZRM9uEAypZakd+q/x7+gmsvXdURP+DABIEIjnmDdp+k=
110110
github.com/prometheus/client_model v0.6.0 h1:k1v3CzpSRUTrKMppY35TLwPvxHqBu0bYgxZzqGIgaos=
111111
github.com/prometheus/client_model v0.6.0/go.mod h1:NTQHnmxFpouOD0DpvP4XujX3CdOAGQPoaGhyTchlyt8=
112-
github.com/prometheus/common v0.47.0 h1:p5Cz0FNHo7SnWOmWmoRozVcjEp0bIVU8cV7OShpjL1k=
113-
github.com/prometheus/common v0.47.0/go.mod h1:0/KsvlIEfPQCQ5I2iNSAWKPZziNCvRs5EC6ILDTlAPc=
112+
github.com/prometheus/common v0.51.1 h1:eIjN50Bwglz6a/c3hAgSMcofL3nD+nFQkV6Dd4DsQCw=
113+
github.com/prometheus/common v0.51.1/go.mod h1:lrWtQx+iDfn2mbH5GUzlH9TSHyfZpHkSiG1W7y3sF2Q=
114114
github.com/prometheus/exporter-toolkit v0.11.0 h1:yNTsuZ0aNCNFQ3aFTD2uhPOvr4iD7fdBvKPAEGkNf+g=
115115
github.com/prometheus/exporter-toolkit v0.11.0/go.mod h1:BVnENhnNecpwoTLiABx7mrPB/OLRIgN74qlQbV+FK1Q=
116116
github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo=
@@ -155,8 +155,8 @@ go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN8
155155
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
156156
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
157157
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
158-
golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc=
159-
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
158+
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
159+
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
160160
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g=
161161
golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k=
162162
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
@@ -166,10 +166,10 @@ golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR
166166
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
167167
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
168168
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
169-
golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
170-
golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
171-
golang.org/x/oauth2 v0.16.0 h1:aDkGMBSYxElaoP81NpoUoz2oo2R2wHdZpGToUxfyQrQ=
172-
golang.org/x/oauth2 v0.16.0/go.mod h1:hqZ+0LWXsiVoZpeld6jVt06P3adbS2Uu911W1SsJv2o=
169+
golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc=
170+
golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
171+
golang.org/x/oauth2 v0.18.0 h1:09qnuIAgzdx1XplqJvW6CQqMCtGZykZWcXzPMPUusvI=
172+
golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8=
173173
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
174174
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
175175
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -178,10 +178,10 @@ golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
178178
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
179179
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
180180
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
181-
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
182-
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
183-
golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE=
184-
golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY=
181+
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
182+
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
183+
golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8=
184+
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
185185
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
186186
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
187187
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=

pkg/app/server.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333
"github.com/oklog/run"
3434
"github.com/prometheus/client_golang/prometheus"
3535
"github.com/prometheus/client_golang/prometheus/collectors"
36+
versionCollector "github.com/prometheus/client_golang/prometheus/collectors/version"
3637
"github.com/prometheus/client_golang/prometheus/promauto"
3738
"github.com/prometheus/client_golang/prometheus/promhttp"
3839
"github.com/prometheus/common/version"
@@ -89,7 +90,7 @@ func RunKubeStateMetricsWrapper(ctx context.Context, opts *options.Options) erro
8990
func RunKubeStateMetrics(ctx context.Context, opts *options.Options) error {
9091
promLogger := promLogger{}
9192
ksmMetricsRegistry := prometheus.NewRegistry()
92-
ksmMetricsRegistry.MustRegister(version.NewCollector("kube_state_metrics"))
93+
ksmMetricsRegistry.MustRegister(versionCollector.NewCollector("kube_state_metrics"))
9394
durationVec := promauto.With(ksmMetricsRegistry).NewHistogramVec(
9495
prometheus.HistogramOpts{
9596
Name: "http_request_duration_seconds",

pkg/metrics_store/metrics_writer_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ func TestSanitizeHeaders(t *testing.T) {
277277
}{
278278
{
279279
name: "text-format unique headers",
280-
contentType: expfmt.FmtText,
280+
contentType: expfmt.NewFormat(expfmt.TypeTextPlain),
281281
headers: []string{
282282
"",
283283
"# HELP foo foo_help\n# TYPE foo gauge",
@@ -294,7 +294,7 @@ func TestSanitizeHeaders(t *testing.T) {
294294
},
295295
{
296296
name: "text-format consecutive duplicate headers",
297-
contentType: expfmt.FmtText,
297+
contentType: expfmt.NewFormat(expfmt.TypeTextPlain),
298298
headers: []string{
299299
"",
300300
"",
@@ -317,7 +317,7 @@ func TestSanitizeHeaders(t *testing.T) {
317317
},
318318
{
319319
name: "proto-format unique headers",
320-
contentType: expfmt.ProtoFmt, // Prometheus ProtoFmt is the only proto-based format we check for.
320+
contentType: expfmt.NewFormat(expfmt.TypeProtoText), // Prometheus ProtoFmt is the only proto-based format we check for.
321321
headers: []string{
322322
"",
323323
"# HELP foo foo_help\n# TYPE foo gauge",
@@ -332,7 +332,7 @@ func TestSanitizeHeaders(t *testing.T) {
332332
},
333333
{
334334
name: "proto-format consecutive duplicate headers",
335-
contentType: expfmt.ProtoFmt, // Prometheus ProtoFmt is the only proto-based format we check for.
335+
contentType: expfmt.NewFormat(expfmt.TypeProtoText), // Prometheus ProtoFmt is the only proto-based format we check for.
336336
headers: []string{
337337
"",
338338
"",
@@ -372,22 +372,22 @@ func BenchmarkSanitizeHeaders(b *testing.B) {
372372
}{
373373
{
374374
name: "text-format unique headers",
375-
contentType: expfmt.FmtText,
375+
contentType: expfmt.NewFormat(expfmt.TypeTextPlain),
376376
writersContainsDuplicates: false,
377377
},
378378
{
379379
name: "text-format duplicate headers",
380-
contentType: expfmt.FmtText,
380+
contentType: expfmt.NewFormat(expfmt.TypeTextPlain),
381381
writersContainsDuplicates: true,
382382
},
383383
{
384384
name: "proto-format unique headers",
385-
contentType: expfmt.ProtoFmt, // Prometheus ProtoFmt is the only proto-based format we check for.
385+
contentType: expfmt.NewFormat(expfmt.TypeProtoText), // Prometheus ProtoFmt is the only proto-based format we check for.
386386
writersContainsDuplicates: false,
387387
},
388388
{
389389
name: "proto-format duplicate headers",
390-
contentType: expfmt.ProtoFmt, // Prometheus ProtoFmt is the only proto-based format we check for.
390+
contentType: expfmt.NewFormat(expfmt.TypeProtoText), // Prometheus ProtoFmt is the only proto-based format we check for.
391391
writersContainsDuplicates: true,
392392
},
393393
}

pkg/metricshandler/metrics_handler.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,9 @@ func (m *MetricsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
189189
contentType := expfmt.NegotiateIncludingOpenMetrics(r.Header)
190190

191191
// We do not support protobuf at the moment. Fall back to FmtText if the negotiated exposition format is not FmtOpenMetrics See: https://github.com/kubernetes/kube-state-metrics/issues/2022.
192-
if contentType != expfmt.FmtOpenMetrics_1_0_0 && contentType != expfmt.FmtOpenMetrics_0_0_1 {
193-
contentType = expfmt.FmtText
192+
193+
if contentType.FormatType() != expfmt.TypeOpenMetrics {
194+
contentType = expfmt.NewFormat(expfmt.TypeTextPlain)
194195
}
195196
resHeader.Set("Content-Type", string(contentType))
196197

@@ -217,7 +218,7 @@ func (m *MetricsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
217218
}
218219

219220
// OpenMetrics spec requires that we end with an EOF directive.
220-
if contentType == expfmt.FmtOpenMetrics_1_0_0 || contentType == expfmt.FmtOpenMetrics_0_0_1 {
221+
if contentType.FormatType() == expfmt.TypeOpenMetrics {
221222
_, err := writer.Write([]byte("# EOF\n"))
222223
if err != nil {
223224
klog.ErrorS(err, "Failed to write EOF directive")

0 commit comments

Comments
 (0)