chore: bump github.com/prometheus/common to 0.63.0 to get

https://github.com/prometheus/common/pull/746 in order to fix
https://github.com/prometheus/prometheus/issues/16466

it seems acceptable to get the other changes in 0.63.0
as well

Signed-off-by: machine424 <ayoubmrini424@gmail.com>
pull/16434/head
machine424 8 months ago
parent 2499fc765d
commit a8a4b7ce69
No known key found for this signature in database
GPG Key ID: A4B001A4FDEE017D
  1. 2
      CHANGELOG.md
  2. 1
      cmd/prometheus/main.go
  3. 1
      cmd/prometheus/main_test.go
  4. 1
      cmd/promtool/main.go
  5. 1
      cmd/promtool/main_test.go
  6. 1
      config/config.go
  7. 9
      config/config_test.go
  8. 2
      go.mod
  9. 4
      go.sum
  10. 2
      model/labels/labels_common.go
  11. 1
      model/labels/labels_test.go
  12. 1
      model/relabel/relabel.go
  13. 3
      model/textparse/openmetricsparse_test.go
  14. 3
      model/textparse/promparse_test.go
  15. 1
      promql/parser/parse_test.go
  16. 1
      promql/parser/printer_test.go
  17. 1
      promql/promqltest/test.go
  18. 1
      scrape/manager_test.go
  19. 5
      scrape/scrape_test.go
  20. 3
      storage/remote/codec_test.go
  21. 2
      storage/remote/write_handler.go
  22. 2
      util/logging/file.go
  23. 9
      web/api/v1/api_test.go

@ -2,7 +2,7 @@
## unreleased
## 3.3.1 / 2025-04-30
## 3.3.1 / 2025-05-02
* [BUGFIX] Azure SD: Fix panic on malformed log message. #16434 #16210
* [BUGFIX] Config: Update GOGC before loading TSDB. #16491

@ -141,6 +141,7 @@ var (
func init() {
// This can be removed when the default validation scheme in common is updated.
//nolint:staticcheck
model.NameValidationScheme = model.UTF8Validation
prometheus.MustRegister(versioncollector.NewCollector(strings.ReplaceAll(appName, "-", "_")))

@ -45,6 +45,7 @@ import (
func init() {
// This can be removed when the default validation scheme in common is updated.
//nolint:staticcheck
model.NameValidationScheme = model.UTF8Validation
}

@ -64,6 +64,7 @@ import (
func init() {
// This can be removed when the default validation scheme in common is updated.
//nolint:staticcheck
model.NameValidationScheme = model.UTF8Validation
}

@ -41,6 +41,7 @@ import (
func init() {
// This can be removed when the default validation scheme in common is updated.
//nolint:staticcheck
model.NameValidationScheme = model.UTF8Validation
}

@ -840,6 +840,7 @@ func (c *ScrapeConfig) Validate(globalConfig GlobalConfig) error {
switch globalConfig.MetricNameValidationScheme {
case LegacyValidationConfig:
case "", UTF8ValidationConfig:
//nolint:staticcheck
if model.NameValidationScheme != model.UTF8Validation {
panic("utf8 name validation requested but model.NameValidationScheme is not set to UTF8")
}

@ -64,6 +64,7 @@ import (
func init() {
// This can be removed when the default validation scheme in common is updated.
//nolint:staticcheck
model.NameValidationScheme = model.UTF8Validation
}
@ -2181,8 +2182,10 @@ var expectedErrors = []struct {
}
func TestBadConfigs(t *testing.T) {
//nolint:staticcheck
model.NameValidationScheme = model.LegacyValidation
defer func() {
//nolint:staticcheck
model.NameValidationScheme = model.UTF8Validation
}()
for _, ee := range expectedErrors {
@ -2193,8 +2196,10 @@ func TestBadConfigs(t *testing.T) {
}
func TestBadStaticConfigsJSON(t *testing.T) {
//nolint:staticcheck
model.NameValidationScheme = model.LegacyValidation
defer func() {
//nolint:staticcheck
model.NameValidationScheme = model.UTF8Validation
}()
content, err := os.ReadFile("testdata/static_config.bad.json")
@ -2205,8 +2210,10 @@ func TestBadStaticConfigsJSON(t *testing.T) {
}
func TestBadStaticConfigsYML(t *testing.T) {
//nolint:staticcheck
model.NameValidationScheme = model.LegacyValidation
defer func() {
//nolint:staticcheck
model.NameValidationScheme = model.UTF8Validation
}()
content, err := os.ReadFile("testdata/static_config.bad.yml")
@ -2453,8 +2460,10 @@ func TestScrapeConfigDisableCompression(t *testing.T) {
}
func TestScrapeConfigNameValidationSettings(t *testing.T) {
//nolint:staticcheck
model.NameValidationScheme = model.UTF8Validation
defer func() {
//nolint:staticcheck
model.NameValidationScheme = model.LegacyValidation
}()

@ -53,7 +53,7 @@ require (
github.com/prometheus/alertmanager v0.28.0
github.com/prometheus/client_golang v1.21.0-rc.0
github.com/prometheus/client_model v0.6.1
github.com/prometheus/common v0.62.0
github.com/prometheus/common v0.63.0
github.com/prometheus/common/assets v0.2.0
github.com/prometheus/exporter-toolkit v0.14.0
github.com/prometheus/sigv4 v0.1.2

@ -441,8 +441,8 @@ github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=
github.com/prometheus/common v0.62.0 h1:xasJaQlnWAeyHdUBeGjXmutelfJHWMRr+Fg4QszZ2Io=
github.com/prometheus/common v0.62.0/go.mod h1:vyBcEuLSvWos9B1+CyL7JZ2up+uFzXhkqml0W5zIY1I=
github.com/prometheus/common v0.63.0 h1:YR/EIY1o3mEFP/kZCD7iDMnLPlGyuU2Gb3HIcXnA98k=
github.com/prometheus/common v0.63.0/go.mod h1:VVFF/fBIoToEnWRVkYoXEkq3R3paCoxG9PXP74SnV18=
github.com/prometheus/common/assets v0.2.0 h1:0P5OrzoHrYBOSM1OigWL3mY8ZvV2N4zIE/5AahrSrfM=
github.com/prometheus/common/assets v0.2.0/go.mod h1:D17UVUE12bHbim7HzwUvtqm6gwBEaDQ0F+hIGbFbccI=
github.com/prometheus/exporter-toolkit v0.14.0 h1:NMlswfibpcZZ+H0sZBiTjrA3/aBFHkNZqE+iCj5EmRg=

@ -104,6 +104,7 @@ func (ls Labels) IsValid(validationScheme model.ValidationScheme) bool {
if l.Name == model.MetricNameLabel {
// If the default validation scheme has been overridden with legacy mode,
// we need to call the special legacy validation checker.
//nolint:staticcheck
if validationScheme == model.LegacyValidation && model.NameValidationScheme == model.UTF8Validation && !model.IsValidLegacyMetricName(string(model.LabelValue(l.Value))) {
return strconv.ErrSyntax
}
@ -111,6 +112,7 @@ func (ls Labels) IsValid(validationScheme model.ValidationScheme) bool {
return strconv.ErrSyntax
}
}
//nolint:staticcheck
if validationScheme == model.LegacyValidation && model.NameValidationScheme == model.UTF8Validation {
if !model.LabelName(l.Name).IsValidLegacy() || !model.LabelValue(l.Value).IsValid() {
return strconv.ErrSyntax

@ -352,6 +352,7 @@ func TestLabels_ValidationModes(t *testing.T) {
expected: false,
},
} {
//nolint:staticcheck
model.NameValidationScheme = test.globalMode
require.Equal(t, test.expected, test.input.IsValid(test.callMode))
}

@ -135,6 +135,7 @@ func (c *Config) Validate() error {
// Design escaping mechanism to allow that, once valid use case appears.
return model.LabelName(value).IsValid()
}
//nolint:staticcheck
if model.NameValidationScheme == model.LegacyValidation {
isValidLabelNameWithRegexVarFn = func(value string) bool {
return relabelTargetLegacy.MatchString(value)

@ -469,9 +469,12 @@ foobar{quantile="0.99"} 150.1`
}
func TestUTF8OpenMetricsParse(t *testing.T) {
//nolint:staticcheck
oldValidationScheme := model.NameValidationScheme
//nolint:staticcheck
model.NameValidationScheme = model.UTF8Validation
defer func() {
//nolint:staticcheck
model.NameValidationScheme = oldValidationScheme
}()

@ -205,9 +205,12 @@ testmetric{le="10"} 1`
}
func TestUTF8PromParse(t *testing.T) {
//nolint:staticcheck
oldValidationScheme := model.NameValidationScheme
//nolint:staticcheck
model.NameValidationScheme = model.UTF8Validation
defer func() {
//nolint:staticcheck
model.NameValidationScheme = oldValidationScheme
}()

@ -3970,6 +3970,7 @@ func TestParseExpressions(t *testing.T) {
EnableExperimentalFunctions = false
})
//nolint:staticcheck
model.NameValidationScheme = model.UTF8Validation
for _, test := range testExpr {
t.Run(readable(test.input), func(t *testing.T) {

@ -170,6 +170,7 @@ func TestExprString(t *testing.T) {
},
}
//nolint:staticcheck
model.NameValidationScheme = model.UTF8Validation
for _, test := range inputs {

@ -58,6 +58,7 @@ const (
)
func init() {
//nolint:staticcheck
model.NameValidationScheme = model.UTF8Validation
}

@ -57,6 +57,7 @@ import (
func init() {
// This can be removed when the default validation scheme in common is updated.
//nolint:staticcheck
model.NameValidationScheme = model.UTF8Validation
}

@ -1325,6 +1325,7 @@ func TestScrapeLoopSeriesAdded(t *testing.T) {
}
func TestScrapeLoopFailWithInvalidLabelsAfterRelabel(t *testing.T) {
//nolint:staticcheck
model.NameValidationScheme = model.LegacyValidation
s := teststorage.New(t)
defer s.Close()
@ -1357,8 +1358,10 @@ func TestScrapeLoopFailWithInvalidLabelsAfterRelabel(t *testing.T) {
func TestScrapeLoopFailLegacyUnderUTF8(t *testing.T) {
// Test that scrapes fail when default validation is utf8 but scrape config is
// legacy.
//nolint:staticcheck
model.NameValidationScheme = model.UTF8Validation
defer func() {
//nolint:staticcheck
model.NameValidationScheme = model.LegacyValidation
}()
s := teststorage.New(t)
@ -3885,7 +3888,9 @@ func TestScrapeReportLimit(t *testing.T) {
func TestScrapeUTF8(t *testing.T) {
s := teststorage.New(t)
defer s.Close()
//nolint:staticcheck
model.NameValidationScheme = model.UTF8Validation
//nolint:staticcheck
t.Cleanup(func() { model.NameValidationScheme = model.LegacyValidation })
cfg := &config.ScrapeConfig{

@ -165,9 +165,12 @@ func TestWriteV2RequestFixture(t *testing.T) {
}
func TestValidateLabelsAndMetricName(t *testing.T) {
//nolint:staticcheck
oldScheme := model.NameValidationScheme
//nolint:staticcheck
model.NameValidationScheme = model.LegacyValidation
defer func() {
//nolint:staticcheck
model.NameValidationScheme = oldScheme
}()
tests := []struct {

@ -250,6 +250,7 @@ func (h *writeHandler) write(ctx context.Context, req *prompb.WriteRequest) (err
// TODO(bwplotka): Even as per 1.0 spec, this should be a 400 error, while other samples are
// potentially written. Perhaps unify with fixed writeV2 implementation a bit.
//nolint:staticcheck
if !ls.Has(labels.MetricName) || !ls.IsValid(model.NameValidationScheme) {
h.logger.Warn("Invalid metric names or labels", "got", ls.String())
samplesWithInvalidLabels++
@ -391,6 +392,7 @@ func (h *writeHandler) appendV2(app storage.Appender, req *writev2.Request, rs *
// Validate series labels early.
// NOTE(bwplotka): While spec allows UTF-8, Prometheus Receiver may impose
// specific limits and follow https://prometheus.io/docs/specs/remote_write_spec_2_0/#invalid-samples case.
//nolint:staticcheck
if !ls.Has(labels.MetricName) || !ls.IsValid(model.NameValidationScheme) {
badRequestErrs = append(badRequestErrs, fmt.Errorf("invalid metric name or labels, got %v", ls.String()))
samplesWithInvalidLabels += len(ts.Samples) + len(ts.Histograms)

@ -45,7 +45,7 @@ func NewJSONFileLogger(s string) (*JSONFileLogger, error) {
return nil, fmt.Errorf("can't create json log file: %w", err)
}
jsonFmt := &promslog.AllowedFormat{}
jsonFmt := promslog.NewFormat()
_ = jsonFmt.Set("json")
return &JSONFileLogger{
handler: promslog.New(&promslog.Config{Format: jsonFmt, Writer: f}).Handler(),

@ -480,15 +480,15 @@ func TestEndpoints(t *testing.T) {
u, err := url.Parse(server.URL)
require.NoError(t, err)
al := promslog.AllowedLevel{}
al := promslog.NewLevel()
require.NoError(t, al.Set("debug"))
af := promslog.AllowedFormat{}
af := promslog.NewFormat()
require.NoError(t, af.Set("logfmt"))
promslogConfig := promslog.Config{
Level: &al,
Format: &af,
Level: al,
Format: af,
}
dbDir := t.TempDir()
@ -3706,6 +3706,7 @@ func testEndpoints(t *testing.T, api *API, tr *testTargetRetriever, es storage.E
ctx = route.WithParam(ctx, p, v)
}
//nolint:staticcheck
model.NameValidationScheme = test.nameValidationScheme
req, err := request(method, test.query)

Loading…
Cancel
Save