From bdf10e3f561406def78b0e0577430397dae35d04 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Jun 2026 17:13:11 +0000 Subject: [PATCH] Bump github.com/prometheus/common from 0.68.1 to 0.69.0 Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.68.1 to 0.69.0. - [Release notes](https://github.com/prometheus/common/releases) - [Changelog](https://github.com/prometheus/common/blob/main/CHANGELOG.md) - [Commits](https://github.com/prometheus/common/compare/v0.68.1...v0.69.0) --- updated-dependencies: - dependency-name: github.com/prometheus/common dependency-version: 0.69.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 +- .../prometheus/common/config/config.go | 4 +- .../prometheus/common/config/http_config.go | 150 +++++++++++++++--- .../common/config/oauth_assertion.go | 5 +- .../prometheus/common/expfmt/expfmt.go | 4 +- .../prometheus/common/expfmt/text_create.go | 4 +- .../prometheus/common/expfmt/text_parse.go | 10 ++ .../prometheus/common/model/labels.go | 2 +- .../prometheus/common/model/labelset.go | 13 +- .../prometheus/common/model/metric.go | 5 +- .../prometheus/common/model/time.go | 44 +++-- .../prometheus/common/model/value.go | 8 +- .../prometheus/common/model/value_float.go | 2 +- .../common/model/value_histogram.go | 8 +- .../prometheus/common/promslog/slog.go | 2 +- vendor/modules.txt | 2 +- 17 files changed, 188 insertions(+), 81 deletions(-) diff --git a/go.mod b/go.mod index 5186363..10e370e 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/kubeservice-stack/common v1.9.1 github.com/montanaflynn/stats v0.9.0 github.com/prometheus/client_golang v1.23.2 - github.com/prometheus/common v0.68.1 + github.com/prometheus/common v0.69.0 github.com/prometheus/exporter-toolkit v0.16.0 github.com/prometheus/procfs v0.20.1 github.com/stretchr/testify v1.11.1 diff --git a/go.sum b/go.sum index d6a54dd..e1401bf 100644 --- a/go.sum +++ b/go.sum @@ -58,8 +58,8 @@ github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.68.1 h1:omjRRl4QP4komogpXuhfeOiisQg7xdy8VM1UY+pStaY= -github.com/prometheus/common v0.68.1/go.mod h1:ZzL3f6u94qUxh9p+tJTrF+FvBS1XXbbRAZCQkytAL0Y= +github.com/prometheus/common v0.69.0 h1:OA85nJQS/T/MaYh/Q2CcgDKSGWqNIgrBDvDH85CuiNk= +github.com/prometheus/common v0.69.0/go.mod h1:ZzL3f6u94qUxh9p+tJTrF+FvBS1XXbbRAZCQkytAL0Y= github.com/prometheus/exporter-toolkit v0.16.0 h1:xT/j7L2XKF+VJd6B4fpUw6xWabHrSmsUf6mYmFqyu0s= github.com/prometheus/exporter-toolkit v0.16.0/go.mod h1:d1EL8Z9674xQe/iWhwP2wDyCEoBPbXVeqDbqAUsgJWY= github.com/prometheus/procfs v0.20.1 h1:XwbrGOIplXW/AU3YhIhLODXMJYyC1isLFfYCsTEycfc= diff --git a/vendor/github.com/prometheus/common/config/config.go b/vendor/github.com/prometheus/common/config/config.go index ff54cdd..d004076 100644 --- a/vendor/github.com/prometheus/common/config/config.go +++ b/vendor/github.com/prometheus/common/config/config.go @@ -33,7 +33,7 @@ type Secret string var MarshalSecretValue = false // MarshalYAML implements the yaml.Marshaler interface for Secrets. -func (s Secret) MarshalYAML() (interface{}, error) { +func (s Secret) MarshalYAML() (any, error) { if MarshalSecretValue { return string(s), nil } @@ -44,7 +44,7 @@ func (s Secret) MarshalYAML() (interface{}, error) { } // UnmarshalYAML implements the yaml.Unmarshaler interface for Secrets. -func (s *Secret) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (s *Secret) UnmarshalYAML(unmarshal func(any) error) error { type plain Secret return unmarshal((*plain)(s)) } diff --git a/vendor/github.com/prometheus/common/config/http_config.go b/vendor/github.com/prometheus/common/config/http_config.go index 7089fc7..8845737 100644 --- a/vendor/github.com/prometheus/common/config/http_config.go +++ b/vendor/github.com/prometheus/common/config/http_config.go @@ -22,6 +22,7 @@ import ( "encoding/json" "errors" "fmt" + "maps" "net" "net/http" "net/url" @@ -76,7 +77,7 @@ var TLSVersions = map[string]TLSVersion{ "TLS10": (TLSVersion)(tls.VersionTLS10), } -func (tv *TLSVersion) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (tv *TLSVersion) UnmarshalYAML(unmarshal func(any) error) error { var s string err := unmarshal(&s) if err != nil { @@ -89,7 +90,7 @@ func (tv *TLSVersion) UnmarshalYAML(unmarshal func(interface{}) error) error { return fmt.Errorf("unknown TLS version: %s", s) } -func (tv TLSVersion) MarshalYAML() (interface{}, error) { +func (tv TLSVersion) MarshalYAML() (any, error) { for s, v := range TLSVersions { if tv == v { return s, nil @@ -178,7 +179,7 @@ type URL struct { } // UnmarshalYAML implements the yaml.Unmarshaler interface for URLs. -func (u *URL) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (u *URL) UnmarshalYAML(unmarshal func(any) error) error { var s string if err := unmarshal(&s); err != nil { return err @@ -193,7 +194,7 @@ func (u *URL) UnmarshalYAML(unmarshal func(interface{}) error) error { } // MarshalYAML implements the yaml.Marshaler interface for URLs. -func (u URL) MarshalYAML() (interface{}, error) { +func (u URL) MarshalYAML() (any, error) { if u.URL != nil { return u.Redacted(), nil } @@ -269,16 +270,16 @@ type OAuth2 struct { Audience string `yaml:"audience,omitempty" json:"audience,omitempty"` // Claims is a map of claims to be added to the JWT token. Only used if // GrantType is set to "urn:ietf:params:oauth:grant-type:jwt-bearer". - Claims map[string]interface{} `yaml:"claims,omitempty" json:"claims,omitempty"` - Scopes []string `yaml:"scopes,omitempty" json:"scopes,omitempty"` - TokenURL string `yaml:"token_url,omitempty" json:"token_url,omitempty"` - EndpointParams map[string]string `yaml:"endpoint_params,omitempty" json:"endpoint_params,omitempty"` - TLSConfig TLSConfig `yaml:"tls_config,omitempty"` + Claims map[string]any `yaml:"claims,omitempty" json:"claims,omitempty"` + Scopes []string `yaml:"scopes,omitempty" json:"scopes,omitempty"` + TokenURL string `yaml:"token_url,omitempty" json:"token_url,omitempty"` + EndpointParams map[string]string `yaml:"endpoint_params,omitempty" json:"endpoint_params,omitempty"` + TLSConfig TLSConfig `yaml:"tls_config,omitempty"` ProxyConfig `yaml:",inline"` } // UnmarshalYAML implements the yaml.Unmarshaler interface. -func (o *OAuth2) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (o *OAuth2) UnmarshalYAML(unmarshal func(any) error) error { type plain OAuth2 if err := unmarshal((*plain)(o)); err != nil { return err @@ -324,7 +325,7 @@ func LoadHTTPConfigFile(filename string) (*HTTPClientConfig, []byte, error) { if err != nil { return nil, nil, err } - cfg.SetDirectory(filepath.Dir(filepath.Dir(filename))) + cfg.SetDirectory(filepath.Dir(filename)) return cfg, content, nil } @@ -463,7 +464,7 @@ func (c *HTTPClientConfig) Validate() error { } // UnmarshalYAML implements the yaml.Unmarshaler interface. -func (c *HTTPClientConfig) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (c *HTTPClientConfig) UnmarshalYAML(unmarshal func(any) error) error { type plain HTTPClientConfig *c = DefaultHTTPClientConfig if err := unmarshal((*plain)(c)); err != nil { @@ -483,7 +484,7 @@ func (c *HTTPClientConfig) UnmarshalJSON(data []byte) error { } // UnmarshalYAML implements the yaml.Unmarshaler interface. -func (a *BasicAuth) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (a *BasicAuth) UnmarshalYAML(unmarshal func(any) error) error { type plain BasicAuth return unmarshal((*plain)(a)) } @@ -721,6 +722,14 @@ func NewRoundTripperFromConfigWithContext(ctx context.Context, cfg HTTPClientCon } if cfg.HTTPHeaders != nil { + // Strip sensitive headers added by headersRoundTripper on cross-host + // redirects before they reach the transport. Only needed when + // redirects are actually followed; when FollowRedirects is false + // CheckRedirect returns ErrUseLastResponse immediately so there are + // no subsequent requests. + if cfg.FollowRedirects { + rt = &sensitiveHeadersStripRT{next: rt} + } rt = NewHeadersRoundTripper(cfg.HTTPHeaders, rt) } @@ -862,7 +871,7 @@ func NewAuthorizationCredentialsRoundTripper(authType string, authCredentials Se } func (rt *authorizationCredentialsRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { - if len(req.Header.Get("Authorization")) != 0 { + if len(req.Header.Get("Authorization")) != 0 || isCrossHostRedirect(req) { return rt.rt.RoundTrip(req) } @@ -900,7 +909,7 @@ func NewBasicAuthRoundTripper(username, password SecretReader, rt http.RoundTrip } func (rt *basicAuthRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { - if len(req.Header.Get("Authorization")) != 0 { + if len(req.Header.Get("Authorization")) != 0 || isCrossHostRedirect(req) { return rt.rt.RoundTrip(req) } var username string @@ -1059,6 +1068,18 @@ func (rt *oauth2RoundTripper) newOauth2TokenSource(req *http.Request, clientCred } func (rt *oauth2RoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { + if isCrossHostRedirect(req) { + // Bypass the OAuth2 transport so no token is attached. Read Base under + // the lock to avoid a data race with concurrent reconfigurations. + rt.mtx.RLock() + base := rt.lastRT.Base + rt.mtx.RUnlock() + if base == nil { + base = http.DefaultTransport + } + return base.RoundTrip(req) + } + var ( secret string needsInit bool @@ -1123,6 +1144,98 @@ func mapToValues(m map[string]string) url.Values { return v } +// isCrossHostRedirect reports whether req is a redirect that has left the +// original request's host at any point in the chain. It detects this by walking +// the req.Response chain (which Go's HTTP client populates on every redirect +// hop) to find the original request's hostname, then checking every hop in the +// chain against it. +// +// The decision is sticky, mirroring net/http: once any hop leaves the original +// host's domain, credentials and sensitive headers stay stripped for the rest +// of the chain, even if a later hop redirects back to the original host. +// +// This works regardless of whether the caller uses NewClientFromConfig or a +// custom http.Client built from NewRoundTripperFromConfigWithContext directly. +func isCrossHostRedirect(req *http.Request) bool { + if req.Response == nil { + return false + } + originalHost := strings.ToLower(originalRequestHost(req)) + for r := req; r.Response != nil && r.Response.Request != nil; r = r.Response.Request { + if !isDomainOrSubdomain(strings.ToLower(r.URL.Hostname()), originalHost) { + return true + } + } + return false +} + +func originalRequestHost(req *http.Request) string { + r := req + for r.Response != nil && r.Response.Request != nil { + r = r.Response.Request + } + return r.URL.Hostname() +} + +// sensitiveHeadersOnRedirect lists the headers that must not be forwarded when +// following a redirect to a different host. The first four entries match the +// list stripped by makeHeadersCopier in net/http/client.go; we additionally +// strip the Proxy-* headers, which net/http does not, to avoid leaking proxy +// credentials to an untrusted host. +var sensitiveHeadersOnRedirect = map[string]struct{}{ + "Authorization": {}, + // "Www-Authenticate" is the canonical form produced by + // textproto.CanonicalMIMEHeaderKey; it is not a typo of "WWW-Authenticate". + "Www-Authenticate": {}, + "Cookie": {}, + "Cookie2": {}, + "Proxy-Authorization": {}, + "Proxy-Authenticate": {}, +} + +// sensitiveHeadersStripRT strips sensitive headers from requests marked as +// cross-host redirects before passing them to the underlying transport. +type sensitiveHeadersStripRT struct { + next http.RoundTripper +} + +func (rt *sensitiveHeadersStripRT) RoundTrip(req *http.Request) (*http.Response, error) { + if isCrossHostRedirect(req) { + req = cloneRequest(req) + for h := range sensitiveHeadersOnRedirect { + req.Header.Del(h) + } + } + return rt.next.RoundTrip(req) +} + +func (rt *sensitiveHeadersStripRT) CloseIdleConnections() { + if ci, ok := rt.next.(closeIdler); ok { + ci.CloseIdleConnections() + } +} + +// isDomainOrSubdomain reports whether sub is a subdomain (or exact match) of +// parent. It mirrors isDomainOrSubdomain from net/http/client.go. +func isDomainOrSubdomain(sub, parent string) bool { + if parent == "" { + return false + } + if sub == parent { + return true + } + // A colon means sub is an IPv6 address; a percent sign introduces an IPv6 + // zone ID. Neither can be a hostname, and both could otherwise pass the + // suffix check below (e.g. "::1%.www.example.com" ends with "example.com"). + if strings.ContainsAny(sub, ":%") { + return false + } + if !strings.HasSuffix(sub, parent) { + return false + } + return sub[len(sub)-len(parent)-1] == '.' +} + // cloneRequest returns a clone of the provided *http.Request. // The clone is a shallow copy of the struct and its Header map. func cloneRequest(r *http.Request) *http.Request { @@ -1130,10 +1243,7 @@ func cloneRequest(r *http.Request) *http.Request { r2 := new(http.Request) *r2 = *r // Deep copy of the Header. - r2.Header = make(http.Header) - for k, s := range r.Header { - r2.Header[k] = s - } + maps.Copy(r.Header, r2.Header) return r2 } @@ -1256,7 +1366,7 @@ func (c *TLSConfig) SetDirectory(dir string) { } // UnmarshalYAML implements the yaml.Unmarshaler interface. -func (c *TLSConfig) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (c *TLSConfig) UnmarshalYAML(unmarshal func(any) error) error { type plain TLSConfig if err := unmarshal((*plain)(c)); err != nil { return err diff --git a/vendor/github.com/prometheus/common/config/oauth_assertion.go b/vendor/github.com/prometheus/common/config/oauth_assertion.go index bf4bcb9..ba5ffb4 100644 --- a/vendor/github.com/prometheus/common/config/oauth_assertion.go +++ b/vendor/github.com/prometheus/common/config/oauth_assertion.go @@ -18,6 +18,7 @@ import ( "encoding/json" "fmt" "io" + "maps" "net/http" "net/url" "strings" @@ -133,9 +134,7 @@ func (js jwtSource) Token() (*oauth2.Token, error) { claims["scope"] = scopes } - for k, v := range js.conf.PrivateClaims { - claims[k] = v - } + maps.Copy(claims, js.conf.PrivateClaims) assertion := jwt.NewWithClaims(js.conf.SigningAlgorithm, claims) if js.conf.PrivateKeyID != "" { diff --git a/vendor/github.com/prometheus/common/expfmt/expfmt.go b/vendor/github.com/prometheus/common/expfmt/expfmt.go index 4e4c13e..10bf357 100644 --- a/vendor/github.com/prometheus/common/expfmt/expfmt.go +++ b/vendor/github.com/prometheus/common/expfmt/expfmt.go @@ -122,7 +122,7 @@ func NewOpenMetricsFormat(version string) (Format, error) { // removed. func (f Format) WithEscapingScheme(s model.EscapingScheme) Format { var terms []string - for _, p := range strings.Split(string(f), ";") { + for p := range strings.SplitSeq(string(f), ";") { toks := strings.Split(p, "=") if len(toks) != 2 { trimmed := strings.TrimSpace(p) @@ -194,7 +194,7 @@ func (f Format) FormatType() FormatType { // "escaping" term exists, that will be used. Otherwise, the global default will // be returned. func (f Format) ToEscapingScheme() model.EscapingScheme { - for _, p := range strings.Split(string(f), ";") { + for p := range strings.SplitSeq(string(f), ";") { toks := strings.Split(p, "=") if len(toks) != 2 { continue diff --git a/vendor/github.com/prometheus/common/expfmt/text_create.go b/vendor/github.com/prometheus/common/expfmt/text_create.go index 6b89781..f4074ae 100644 --- a/vendor/github.com/prometheus/common/expfmt/text_create.go +++ b/vendor/github.com/prometheus/common/expfmt/text_create.go @@ -42,12 +42,12 @@ const ( var ( bufPool = sync.Pool{ - New: func() interface{} { + New: func() any { return bufio.NewWriter(io.Discard) }, } numBufPool = sync.Pool{ - New: func() interface{} { + New: func() any { b := make([]byte, 0, initialNumBufSize) return &b }, diff --git a/vendor/github.com/prometheus/common/expfmt/text_parse.go b/vendor/github.com/prometheus/common/expfmt/text_parse.go index 00c8841..4ce1f40 100644 --- a/vendor/github.com/prometheus/common/expfmt/text_parse.go +++ b/vendor/github.com/prometheus/common/expfmt/text_parse.go @@ -339,6 +339,16 @@ func (p *TextParser) startLabelName() stateFn { return nil // Unexpected end of input. } if p.currentByte == '}' { + if p.currentMF == nil { + // The closing brace was reached before any metric name was read, + // e.g. for the input "{}". There is no metric to attach labels to, + // so this is a malformed exposition. This mirrors the guard in + // startLabelValue. currentMF (not currentMetric) is checked because + // reset only clears currentMF between parses. + p.parseError("invalid metric name") + p.currentLabelPairs = nil + return nil + } p.currentMetric.Label = append(p.currentMetric.Label, p.currentLabelPairs...) p.currentLabelPairs = nil if p.skipBlankTab(); p.err != nil { diff --git a/vendor/github.com/prometheus/common/model/labels.go b/vendor/github.com/prometheus/common/model/labels.go index dfeb34b..29688a1 100644 --- a/vendor/github.com/prometheus/common/model/labels.go +++ b/vendor/github.com/prometheus/common/model/labels.go @@ -124,7 +124,7 @@ func (ln LabelName) IsValidLegacy() bool { } // UnmarshalYAML implements the yaml.Unmarshaler interface. -func (ln *LabelName) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (ln *LabelName) UnmarshalYAML(unmarshal func(any) error) error { var s string if err := unmarshal(&s); err != nil { return err diff --git a/vendor/github.com/prometheus/common/model/labelset.go b/vendor/github.com/prometheus/common/model/labelset.go index 9de47b2..6010b26 100644 --- a/vendor/github.com/prometheus/common/model/labelset.go +++ b/vendor/github.com/prometheus/common/model/labelset.go @@ -16,6 +16,7 @@ package model import ( "encoding/json" "fmt" + "maps" "sort" ) @@ -107,9 +108,7 @@ func (ls LabelSet) Before(o LabelSet) bool { // Clone returns a copy of the label set. func (ls LabelSet) Clone() LabelSet { lsn := make(LabelSet, len(ls)) - for ln, lv := range ls { - lsn[ln] = lv - } + maps.Copy(lsn, ls) return lsn } @@ -117,13 +116,9 @@ func (ls LabelSet) Clone() LabelSet { func (ls LabelSet) Merge(other LabelSet) LabelSet { result := make(LabelSet, len(ls)) - for k, v := range ls { - result[k] = v - } + maps.Copy(result, ls) - for k, v := range other { - result[k] = v - } + maps.Copy(result, other) return result } diff --git a/vendor/github.com/prometheus/common/model/metric.go b/vendor/github.com/prometheus/common/model/metric.go index 429a0da..2fe4615 100644 --- a/vendor/github.com/prometheus/common/model/metric.go +++ b/vendor/github.com/prometheus/common/model/metric.go @@ -17,6 +17,7 @@ import ( "encoding/json" "errors" "fmt" + "maps" "regexp" "sort" "strconv" @@ -258,9 +259,7 @@ func (m Metric) Before(o Metric) bool { // Clone returns a copy of the Metric. func (m Metric) Clone() Metric { clone := make(Metric, len(m)) - for k, v := range m { - clone[k] = v - } + maps.Copy(clone, m) return clone } diff --git a/vendor/github.com/prometheus/common/model/time.go b/vendor/github.com/prometheus/common/model/time.go index 1730b0f..0854753 100644 --- a/vendor/github.com/prometheus/common/model/time.go +++ b/vendor/github.com/prometheus/common/model/time.go @@ -123,44 +123,38 @@ func (t Time) MarshalJSON() ([]byte, error) { // UnmarshalJSON implements the json.Unmarshaler interface. func (t *Time) UnmarshalJSON(b []byte) error { - p := strings.Split(string(b), ".") - switch len(p) { - case 1: - v, err := strconv.ParseInt(p[0], 10, 64) + base, frac, found := strings.Cut(string(b), ".") + if !found { + v, err := strconv.ParseInt(base, 10, 64) if err != nil { return err } *t = Time(v * second) - - case 2: - v, err := strconv.ParseInt(p[0], 10, 64) + } else { + v, err := strconv.ParseInt(base, 10, 64) if err != nil { return err } - v *= second - prec := dotPrecision - len(p[1]) + prec := dotPrecision - len(frac) if prec < 0 { - p[1] = p[1][:dotPrecision] - } else if prec > 0 { - p[1] += strings.Repeat("0", prec) + frac = frac[:dotPrecision] } - - va, err := strconv.ParseInt(p[1], 10, 32) + va, err := strconv.ParseInt(frac, 10, 32) if err != nil { return err } - - // If the value was something like -0.1 the negative is lost in the - // parsing because of the leading zero, this ensures that we capture it. - if len(p[0]) > 0 && p[0][0] == '-' && v+va > 0 { - *t = Time(v+va) * -1 - } else { - *t = Time(v + va) + switch prec { + case 1: + va *= 10 + case 2: + va *= 100 } - default: - return fmt.Errorf("invalid time %q", string(b)) + if len(base) > 0 && base[0] == '-' { + va = -va + } + *t = Time(v*second + va) } return nil } @@ -340,12 +334,12 @@ func (d *Duration) UnmarshalText(text []byte) error { } // MarshalYAML implements the yaml.Marshaler interface. -func (d Duration) MarshalYAML() (interface{}, error) { +func (d Duration) MarshalYAML() (any, error) { return d.String(), nil } // UnmarshalYAML implements the yaml.Unmarshaler interface. -func (d *Duration) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (d *Duration) UnmarshalYAML(unmarshal func(any) error) error { var s string if err := unmarshal(&s); err != nil { return err diff --git a/vendor/github.com/prometheus/common/model/value.go b/vendor/github.com/prometheus/common/model/value.go index a9995a3..8dffd9c 100644 --- a/vendor/github.com/prometheus/common/model/value.go +++ b/vendor/github.com/prometheus/common/model/value.go @@ -259,13 +259,13 @@ func (s Scalar) String() string { // MarshalJSON implements json.Marshaler. func (s Scalar) MarshalJSON() ([]byte, error) { v := strconv.FormatFloat(float64(s.Value), 'f', -1, 64) - return json.Marshal([...]interface{}{s.Timestamp, v}) + return json.Marshal([...]any{s.Timestamp, v}) } // UnmarshalJSON implements json.Unmarshaler. func (s *Scalar) UnmarshalJSON(b []byte) error { var f string - v := [...]interface{}{&s.Timestamp, &f} + v := [...]any{&s.Timestamp, &f} if err := json.Unmarshal(b, &v); err != nil { return err @@ -291,12 +291,12 @@ func (s *String) String() string { // MarshalJSON implements json.Marshaler. func (s String) MarshalJSON() ([]byte, error) { - return json.Marshal([]interface{}{s.Timestamp, s.Value}) + return json.Marshal([]any{s.Timestamp, s.Value}) } // UnmarshalJSON implements json.Unmarshaler. func (s *String) UnmarshalJSON(b []byte) error { - v := [...]interface{}{&s.Timestamp, &s.Value} + v := [...]any{&s.Timestamp, &s.Value} return json.Unmarshal(b, &v) } diff --git a/vendor/github.com/prometheus/common/model/value_float.go b/vendor/github.com/prometheus/common/model/value_float.go index 6bfc757..b7d9361 100644 --- a/vendor/github.com/prometheus/common/model/value_float.go +++ b/vendor/github.com/prometheus/common/model/value_float.go @@ -79,7 +79,7 @@ func (s SamplePair) MarshalJSON() ([]byte, error) { if err != nil { return nil, err } - return []byte(fmt.Sprintf("[%s,%s]", t, v)), nil + return fmt.Appendf(nil, "[%s,%s]", t, v), nil } // UnmarshalJSON implements json.Unmarshaler. diff --git a/vendor/github.com/prometheus/common/model/value_histogram.go b/vendor/github.com/prometheus/common/model/value_histogram.go index 91ce5b7..f27856c 100644 --- a/vendor/github.com/prometheus/common/model/value_histogram.go +++ b/vendor/github.com/prometheus/common/model/value_histogram.go @@ -67,11 +67,11 @@ func (s HistogramBucket) MarshalJSON() ([]byte, error) { if err != nil { return nil, err } - return []byte(fmt.Sprintf("[%s,%s,%s,%s]", b, l, u, c)), nil + return fmt.Appendf(nil, "[%s,%s,%s,%s]", b, l, u, c), nil } func (s *HistogramBucket) UnmarshalJSON(buf []byte) error { - tmp := []interface{}{&s.Boundaries, &s.Lower, &s.Upper, &s.Count} + tmp := []any{&s.Boundaries, &s.Lower, &s.Upper, &s.Count} wantLen := len(tmp) if err := json.Unmarshal(buf, &tmp); err != nil { return err @@ -152,11 +152,11 @@ func (s SampleHistogramPair) MarshalJSON() ([]byte, error) { if err != nil { return nil, err } - return []byte(fmt.Sprintf("[%s,%s]", t, v)), nil + return fmt.Appendf(nil, "[%s,%s]", t, v), nil } func (s *SampleHistogramPair) UnmarshalJSON(buf []byte) error { - tmp := []interface{}{&s.Timestamp, &s.Histogram} + tmp := []any{&s.Timestamp, &s.Histogram} wantLen := len(tmp) if err := json.Unmarshal(buf, &tmp); err != nil { return err diff --git a/vendor/github.com/prometheus/common/promslog/slog.go b/vendor/github.com/prometheus/common/promslog/slog.go index f5b9e98..f8f7716 100644 --- a/vendor/github.com/prometheus/common/promslog/slog.go +++ b/vendor/github.com/prometheus/common/promslog/slog.go @@ -61,7 +61,7 @@ func NewLevel() *Level { } } -func (l *Level) UnmarshalYAML(unmarshal func(interface{}) error) error { +func (l *Level) UnmarshalYAML(unmarshal func(any) error) error { var s string type plain string if err := unmarshal((*plain)(&s)); err != nil { diff --git a/vendor/modules.txt b/vendor/modules.txt index 919af0f..b5d8cf4 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -80,7 +80,7 @@ github.com/prometheus/client_golang/prometheus/promhttp/internal # github.com/prometheus/client_model v0.6.2 ## explicit; go 1.22.0 github.com/prometheus/client_model/go -# github.com/prometheus/common v0.68.1 +# github.com/prometheus/common v0.69.0 ## explicit; go 1.25.0 github.com/prometheus/common/config github.com/prometheus/common/expfmt