From 3f834316089e5947918000276b9e3ae14a0d1f60 Mon Sep 17 00:00:00 2001 From: George Robinson Date: Wed, 5 Mar 2025 14:36:22 +0000 Subject: [PATCH] Revert "Fix UTF-8 not allowed in Equal field for inhibition rules (#10780)" (#10813) This reverts commit c39d5d9dc19279866be0f684e9c38ea4b2524be6. --- go.mod | 4 ++-- go.sum | 8 ++++---- integration/configs.go | 14 -------------- .../prometheus/alertmanager/config/config.go | 14 +------------- vendor/modules.txt | 6 +++--- 5 files changed, 10 insertions(+), 36 deletions(-) diff --git a/go.mod b/go.mod index 8855e21e654..36d4f5a82ed 100644 --- a/go.mod +++ b/go.mod @@ -66,7 +66,7 @@ require ( github.com/google/go-github/v57 v57.0.0 github.com/google/uuid v1.6.0 github.com/grafana-tools/sdk v0.0.0-20220919052116-6562121319fc - github.com/grafana/alerting v0.0.0-20250303095629-6fd0c494dfa3 + github.com/grafana/alerting v0.0.0-20250225150117-15e285d78df2 github.com/grafana/regexp v0.0.0-20240607082908-2cb410fa05da github.com/hashicorp/golang-lru/v2 v2.0.7 github.com/hashicorp/vault/api v1.15.0 @@ -326,7 +326,7 @@ replace github.com/opentracing-contrib/go-stdlib => github.com/grafana/opentraci replace github.com/opentracing-contrib/go-grpc => github.com/charleskorn/go-grpc v0.0.0-20231024023642-e9298576254f // Replacing prometheus/alertmanager with our fork. -replace github.com/prometheus/alertmanager => github.com/grafana/prometheus-alertmanager v0.25.1-0.20250303091802-46a7be9c9432 +replace github.com/prometheus/alertmanager => github.com/grafana/prometheus-alertmanager v0.25.1-0.20250211112812-e32be5e2a455 // Replacing with a fork commit based on v1.17.1 having cherry-picked the following PRs: // - https://github.com/grafana/franz-go/pull/1 diff --git a/go.sum b/go.sum index ad7b823a90c..11fe4e41a46 100644 --- a/go.sum +++ b/go.sum @@ -1270,8 +1270,8 @@ github.com/gosimple/slug v1.1.1 h1:fRu/digW+NMwBIP+RmviTK97Ho/bEj/C9swrCspN3D4= github.com/gosimple/slug v1.1.1/go.mod h1:ER78kgg1Mv0NQGlXiDe57DpCyfbNywXXZ9mIorhxAf0= github.com/grafana-tools/sdk v0.0.0-20220919052116-6562121319fc h1:PXZQA2WCxe85Tnn+WEvr8fDpfwibmEPgfgFEaC87G24= github.com/grafana-tools/sdk v0.0.0-20220919052116-6562121319fc/go.mod h1:AHHlOEv1+GGQ3ktHMlhuTUwo3zljV3QJbC0+8o2kn+4= -github.com/grafana/alerting v0.0.0-20250303095629-6fd0c494dfa3 h1:otX6Lww40e6jEsc4AQBdYmgDsaryAZkBTdBvWUsnDxk= -github.com/grafana/alerting v0.0.0-20250303095629-6fd0c494dfa3/go.mod h1:p5P86ajOwL2XPJN6+xu6QJUtO4DptdFiqJ35r3Ac4HY= +github.com/grafana/alerting v0.0.0-20250225150117-15e285d78df2 h1:kESrzm0FcRVLmGIQCgl1MCwDGLH4sLzWphr7mcFdbfI= +github.com/grafana/alerting v0.0.0-20250225150117-15e285d78df2/go.mod h1:hdGB3dSl8Ma9Rjo2YiAEAjMkZ5HiNJbNDqRKDefRZrM= github.com/grafana/dskit v0.0.0-20250303172748-fd4441b85237 h1:VZagYtPcmjgazfPAuWN7lER6mprG20r51+1eYPpATkw= github.com/grafana/dskit v0.0.0-20250303172748-fd4441b85237/go.mod h1:cu2zIOHhAgRaIDuECsERftSp1l7KHq1aX1jgihQCu0c= github.com/grafana/e2e v0.1.2-0.20240118170847-db90b84177fc h1:BW+LjKJDz0So5LI8UZfW5neWeKpSkWqhmGjQFzcFfLM= @@ -1288,8 +1288,8 @@ github.com/grafana/mimir-prometheus v0.0.0-20250304035310-4c85ad035a73 h1:xojy4g github.com/grafana/mimir-prometheus v0.0.0-20250304035310-4c85ad035a73/go.mod h1:9SIFvqYMa125MSHK5SAEnOGLDikyUMk4tHUQjZtbhs8= github.com/grafana/opentracing-contrib-go-stdlib v0.0.0-20230509071955-f410e79da956 h1:em1oddjXL8c1tL0iFdtVtPloq2hRPen2MJQKoAWpxu0= github.com/grafana/opentracing-contrib-go-stdlib v0.0.0-20230509071955-f410e79da956/go.mod h1:qtI1ogk+2JhVPIXVc6q+NHziSmy2W5GbdQZFUHADCBU= -github.com/grafana/prometheus-alertmanager v0.25.1-0.20250303091802-46a7be9c9432 h1:iLM/0h8BWb7/RPDzqphwFHE7tr5m5f1atwHquv8uWm8= -github.com/grafana/prometheus-alertmanager v0.25.1-0.20250303091802-46a7be9c9432/go.mod h1:FGdGvhI40Dq+CTQaSzK9evuve774cgOUdGfVO04OXkw= +github.com/grafana/prometheus-alertmanager v0.25.1-0.20250211112812-e32be5e2a455 h1:yidC1xzk4fedLZ/iXEqSJopkw3jPZPwoMqqzue4eFEA= +github.com/grafana/prometheus-alertmanager v0.25.1-0.20250211112812-e32be5e2a455/go.mod h1:FGdGvhI40Dq+CTQaSzK9evuve774cgOUdGfVO04OXkw= github.com/grafana/pyroscope-go/godeltaprof v0.1.8 h1:iwOtYXeeVSAeYefJNaxDytgjKtUuKQbJqgAIjlnicKg= github.com/grafana/pyroscope-go/godeltaprof v0.1.8/go.mod h1:2+l7K7twW49Ct4wFluZD3tZ6e0SjanjcUUBPVD/UuGU= github.com/grafana/regexp v0.0.0-20240531075221-3685f1377d7b h1:oMAq12GxTpwo9jxbnG/M4F/HdpwbibTaVoxNA0NZprY= diff --git a/integration/configs.go b/integration/configs.go index 6169b841009..5fbf64334b5 100644 --- a/integration/configs.go +++ b/integration/configs.go @@ -64,13 +64,6 @@ receivers: - bar=baz receivers: - name: test -inhibit_rules: - - source_matchers: - - baz=qux - target_matchers: - - qux=corge - equal: - - jorge ` mimirAlertmanagerUserUTF8ConfigYaml = `route: @@ -82,13 +75,6 @@ inhibit_rules: - bar🙂=baz receivers: - name: test -inhibit_rules: - - source_matchers: - - baz🙂=qux - target_matchers: - - qux🙂=corge - equal: - - jorge🙂 ` mimirRulerUserConfigYaml = `groups: diff --git a/vendor/github.com/prometheus/alertmanager/config/config.go b/vendor/github.com/prometheus/alertmanager/config/config.go index 19f6c32b4cd..f5b30d3f2e5 100644 --- a/vendor/github.com/prometheus/alertmanager/config/config.go +++ b/vendor/github.com/prometheus/alertmanager/config/config.go @@ -882,11 +882,7 @@ type InhibitRule struct { TargetMatchers Matchers `yaml:"target_matchers,omitempty" json:"target_matchers,omitempty"` // A set of labels that must be equal between the source and target alert // for them to be a match. - Equal model.LabelNames `yaml:"-" json:"-"` - // EqualStr allows us to validate the label depending on whether UTF-8 is - // enabled or disabled. It should be removed when Alertmanager is updated - // to use the validation modes in recent versions of prometheus/common. - EqualStr []string `yaml:"equal,omitempty" json:"equal,omitempty"` + Equal model.LabelNames `yaml:"equal,omitempty" json:"equal,omitempty"` } // UnmarshalYAML implements the yaml.Unmarshaler interface for InhibitRule. @@ -908,14 +904,6 @@ func (r *InhibitRule) UnmarshalYAML(unmarshal func(interface{}) error) error { } } - for _, l := range r.EqualStr { - labelName := model.LabelName(l) - if !compat.IsValidLabelName(labelName) { - return fmt.Errorf("invalid label name %q in equal list", l) - } - r.Equal = append(r.Equal, labelName) - } - return nil } diff --git a/vendor/modules.txt b/vendor/modules.txt index 93a1d5dd026..8bcc2ad23cf 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -614,7 +614,7 @@ github.com/gosimple/slug # github.com/grafana-tools/sdk v0.0.0-20220919052116-6562121319fc ## explicit; go 1.13 github.com/grafana-tools/sdk -# github.com/grafana/alerting v0.0.0-20250303095629-6fd0c494dfa3 +# github.com/grafana/alerting v0.0.0-20250225150117-15e285d78df2 ## explicit; go 1.22 github.com/grafana/alerting/cluster github.com/grafana/alerting/definition @@ -991,7 +991,7 @@ github.com/pmezard/go-difflib/difflib # github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c ## explicit; go 1.14 github.com/power-devops/perfstat -# github.com/prometheus/alertmanager v0.27.0 => github.com/grafana/prometheus-alertmanager v0.25.1-0.20250303091802-46a7be9c9432 +# github.com/prometheus/alertmanager v0.27.0 => github.com/grafana/prometheus-alertmanager v0.25.1-0.20250211112812-e32be5e2a455 ## explicit; go 1.22 github.com/prometheus/alertmanager/api github.com/prometheus/alertmanager/api/metrics @@ -1770,6 +1770,6 @@ sigs.k8s.io/yaml/goyaml.v3 # github.com/munnerz/goautoneg => github.com/grafana/goautoneg v0.0.0-20240607115440-f335c04c58ce # github.com/opentracing-contrib/go-stdlib => github.com/grafana/opentracing-contrib-go-stdlib v0.0.0-20230509071955-f410e79da956 # github.com/opentracing-contrib/go-grpc => github.com/charleskorn/go-grpc v0.0.0-20231024023642-e9298576254f -# github.com/prometheus/alertmanager => github.com/grafana/prometheus-alertmanager v0.25.1-0.20250303091802-46a7be9c9432 +# github.com/prometheus/alertmanager => github.com/grafana/prometheus-alertmanager v0.25.1-0.20250211112812-e32be5e2a455 # github.com/twmb/franz-go => github.com/grafana/franz-go v0.0.0-20241009100846-782ba1442937 # google.golang.org/grpc => google.golang.org/grpc v1.65.0