Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion apps/historian/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ require (
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.5.0 // indirect
github.com/Masterminds/sprig/v3 v3.3.0 // indirect
github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b // indirect
github.com/aws/aws-sdk-go v1.55.5 // indirect
github.com/benbjohnson/clock v1.3.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
Expand All @@ -38,6 +39,7 @@ require (
github.com/dlclark/regexp2 v1.11.5 // indirect
github.com/emicklei/go-restful/v3 v3.13.0 // indirect
github.com/evanphx/json-patch v5.9.11+incompatible // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
github.com/getkin/kin-openapi v0.144.0 // indirect
github.com/go-logfmt/logfmt v0.6.1 // indirect
Expand Down Expand Up @@ -109,12 +111,15 @@ require (
github.com/shurcooL/vfsgen v0.0.0-20230704071429-0000e147ea92 // indirect
github.com/spf13/cast v1.10.0 // indirect
github.com/stretchr/objx v0.5.3 // indirect
github.com/trivago/tgo v1.0.7 // indirect
github.com/uber/jaeger-client-go v2.30.0+incompatible // indirect
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
github.com/x448/float16 v0.8.4 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/contrib/bridges/prometheus v0.68.0 // indirect
go.opentelemetry.io/contrib/exporters/autoexport v0.68.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.67.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0 // indirect
go.opentelemetry.io/contrib/propagators/jaeger v1.43.0 // indirect
go.opentelemetry.io/contrib/samplers/jaegerremote v0.37.0 // indirect
go.opentelemetry.io/otel/exporters/jaeger v1.17.0 // indirect
Expand Down Expand Up @@ -153,6 +158,7 @@ require (
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/mail.v2 v2.3.1 // indirect
gopkg.in/telebot.v3 v3.2.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/api v0.36.1 // indirect
Expand All @@ -166,4 +172,4 @@ require (
)

// Use our fork of the upstream Alertmanager.
replace github.com/prometheus/alertmanager => github.com/grafana/prometheus-alertmanager v0.25.1-0.20260225120258-18275ca76b0c
replace github.com/prometheus/alertmanager => github.com/grafana/prometheus-alertmanager v0.25.1-0.20260925150512-27a6d009fb33
408 changes: 406 additions & 2 deletions apps/historian/go.sum

Large diffs are not rendered by default.

27 changes: 14 additions & 13 deletions definition/alertmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"gopkg.in/yaml.v3"

"github.com/prometheus/alertmanager/config"
amcommoncfg "github.com/prometheus/alertmanager/config/common"
"github.com/prometheus/alertmanager/pkg/labels"
"github.com/prometheus/common/model"
)
Expand All @@ -19,9 +20,9 @@ type Provenance string

// Config is the top-level configuration for Alertmanager's config files.
type Config struct {
Global *config.GlobalConfig `yaml:"global,omitempty" json:"global,omitempty"`
Route *Route `yaml:"route,omitempty" json:"route,omitempty"`
InhibitRules []config.InhibitRule `yaml:"inhibit_rules,omitempty" json:"inhibit_rules,omitempty"`
Global *config.GlobalConfig `yaml:"global,omitempty" json:"global,omitempty"`
Route *Route `yaml:"route,omitempty" json:"route,omitempty"`
InhibitRules []amcommoncfg.InhibitRule `yaml:"inhibit_rules,omitempty" json:"inhibit_rules,omitempty"`
// MuteTimeIntervals is deprecated and will be removed before Alertmanager 1.0.
MuteTimeIntervals []config.MuteTimeInterval `yaml:"mute_time_intervals,omitempty" json:"mute_time_intervals,omitempty"`
TimeIntervals []config.TimeInterval `yaml:"time_intervals,omitempty" json:"time_intervals,omitempty"`
Expand All @@ -39,13 +40,13 @@ type Route struct {
// Deprecated. Remove before v1.0 release.
Match map[string]string `yaml:"match,omitempty" json:"match,omitempty"`
// Deprecated. Remove before v1.0 release.
MatchRE config.MatchRegexps `yaml:"match_re,omitempty" json:"match_re,omitempty"`
Matchers config.Matchers `yaml:"matchers,omitempty" json:"matchers,omitempty"`
ObjectMatchers ObjectMatchers `yaml:"object_matchers,omitempty" json:"object_matchers,omitempty"`
MuteTimeIntervals []string `yaml:"mute_time_intervals,omitempty" json:"mute_time_intervals,omitempty"`
ActiveTimeIntervals []string `yaml:"active_time_intervals,omitempty" json:"active_time_intervals,omitempty"`
Continue bool `yaml:"continue" json:"continue,omitempty"`
Routes []*Route `yaml:"routes,omitempty" json:"routes,omitempty"`
MatchRE amcommoncfg.MatchRegexps `yaml:"match_re,omitempty" json:"match_re,omitempty"`
Matchers amcommoncfg.Matchers `yaml:"matchers,omitempty" json:"matchers,omitempty"`
ObjectMatchers ObjectMatchers `yaml:"object_matchers,omitempty" json:"object_matchers,omitempty"`
MuteTimeIntervals []string `yaml:"mute_time_intervals,omitempty" json:"mute_time_intervals,omitempty"`
ActiveTimeIntervals []string `yaml:"active_time_intervals,omitempty" json:"active_time_intervals,omitempty"`
Continue bool `yaml:"continue" json:"continue,omitempty"`
Routes []*Route `yaml:"routes,omitempty" json:"routes,omitempty"`

GroupWait *model.Duration `yaml:"group_wait,omitempty" json:"group_wait,omitempty"`
GroupInterval *model.Duration `yaml:"group_interval,omitempty" json:"group_interval,omitempty"`
Expand Down Expand Up @@ -118,9 +119,9 @@ func AsGrafanaRoute(r *config.Route) *Route {
return gRoute
}

// AllMatchers returns concatenated Match, MatchRE, Matchers and ObjectMatchers in a format of config.Matchers.
func (r *Route) AllMatchers() (config.Matchers, error) {
matchers := make(config.Matchers, 0, len(r.Matchers)+len(r.ObjectMatchers)+len(r.Match)+len(r.MatchRE))
// AllMatchers returns concatenated Match, MatchRE, Matchers and ObjectMatchers in a format of amcommoncfg.Matchers.
func (r *Route) AllMatchers() (amcommoncfg.Matchers, error) {
matchers := make(amcommoncfg.Matchers, 0, len(r.Matchers)+len(r.ObjectMatchers)+len(r.Match)+len(r.MatchRE))

for ln, lv := range r.Match {
matcher, err := labels.NewMatcher(labels.MatchEqual, ln, lv)
Expand Down
33 changes: 17 additions & 16 deletions definition/alertmanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"gopkg.in/yaml.v3"

"github.com/prometheus/alertmanager/config"
amcommoncfg "github.com/prometheus/alertmanager/config/common"
"github.com/prometheus/alertmanager/featurecontrol"
"github.com/prometheus/alertmanager/matchers/compat"
"github.com/prometheus/alertmanager/pkg/labels"
Expand Down Expand Up @@ -274,7 +275,7 @@ func Test_ApiAlertingConfig_Marshaling(t *testing.T) {
Receiver: "am",
Routes: []*Route{
{
Matchers: config.Matchers{
Matchers: amcommoncfg.Matchers{
{
Name: autogeneratedRouteLabel,
Type: labels.MatchEqual,
Expand Down Expand Up @@ -307,7 +308,7 @@ func Test_ApiAlertingConfig_Marshaling(t *testing.T) {
Receiver: "graf",
Routes: []*Route{
{
Matchers: config.Matchers{
Matchers: amcommoncfg.Matchers{
{
Name: autogeneratedRouteLabel,
Type: labels.MatchEqual,
Expand Down Expand Up @@ -1113,12 +1114,12 @@ func TestInhibitRule_Unmarshal_JSON(t *testing.T) {
require.NoError(t, json.Unmarshal([]byte(s), &c))
require.Len(t, c.InhibitRules, 1)
r := c.InhibitRules[0]
require.Equal(t, config.Matchers{{
require.Equal(t, amcommoncfg.Matchers{{
Name: "foo",
Type: labels.MatchEqual,
Value: "bar",
}}, r.SourceMatchers)
require.Equal(t, config.Matchers{{
require.Equal(t, amcommoncfg.Matchers{{
Name: "bar",
Type: labels.MatchEqual,
Value: "baz",
Expand Down Expand Up @@ -1158,12 +1159,12 @@ func TestInhibitRule_UTF8_In_Equals_Unmarshal_JSON(t *testing.T) {
require.NoError(t, json.Unmarshal([]byte(s), &c))
require.Len(t, c.InhibitRules, 1)
r := c.InhibitRules[0]
require.Equal(t, config.Matchers{{
require.Equal(t, amcommoncfg.Matchers{{
Name: "foo",
Type: labels.MatchEqual,
Value: "bar",
}}, r.SourceMatchers)
require.Equal(t, config.Matchers{{
require.Equal(t, amcommoncfg.Matchers{{
Name: "bar",
Type: labels.MatchEqual,
Value: "baz",
Expand All @@ -1172,13 +1173,13 @@ func TestInhibitRule_UTF8_In_Equals_Unmarshal_JSON(t *testing.T) {
}

func TestInhibitRule_Marshal_JSON(t *testing.T) {
r := config.InhibitRule{
SourceMatchers: config.Matchers{{
r := amcommoncfg.InhibitRule{
SourceMatchers: amcommoncfg.Matchers{{
Name: "foo",
Type: labels.MatchEqual,
Value: "bar",
}},
TargetMatchers: config.Matchers{{
TargetMatchers: amcommoncfg.Matchers{{
Name: "bar",
Type: labels.MatchEqual,
Value: "baz",
Expand Down Expand Up @@ -1210,12 +1211,12 @@ func TestInhibitRule_Unmarshal_YAML(t *testing.T) {
require.Len(t, c.InhibitRules, 1)
r := c.InhibitRules[0]
t.Log(r)
require.Equal(t, config.Matchers{{
require.Equal(t, amcommoncfg.Matchers{{
Name: "foo",
Type: labels.MatchEqual,
Value: "bar",
}}, r.SourceMatchers)
require.Equal(t, config.Matchers{{
require.Equal(t, amcommoncfg.Matchers{{
Name: "bar",
Type: labels.MatchEqual,
Value: "baz",
Expand Down Expand Up @@ -1256,12 +1257,12 @@ func TestInhibitRule_UTF8_In_Equals_Unmarshal_YAML(t *testing.T) {
require.NoError(t, yaml.Unmarshal([]byte(s), &c))
require.Len(t, c.InhibitRules, 1)
r := c.InhibitRules[0]
require.Equal(t, config.Matchers{{
require.Equal(t, amcommoncfg.Matchers{{
Name: "foo",
Type: labels.MatchEqual,
Value: "bar",
}}, r.SourceMatchers)
require.Equal(t, config.Matchers{{
require.Equal(t, amcommoncfg.Matchers{{
Name: "bar",
Type: labels.MatchEqual,
Value: "baz",
Expand All @@ -1270,13 +1271,13 @@ func TestInhibitRule_UTF8_In_Equals_Unmarshal_YAML(t *testing.T) {
}

func TestInhibitRule_Marshal_YAML(t *testing.T) {
r := config.InhibitRule{
SourceMatchers: config.Matchers{{
r := amcommoncfg.InhibitRule{
SourceMatchers: amcommoncfg.Matchers{{
Name: "foo",
Type: labels.MatchEqual,
Value: "bar",
}},
TargetMatchers: config.Matchers{{
TargetMatchers: amcommoncfg.Matchers{{
Name: "bar",
Type: labels.MatchEqual,
Value: "baz",
Expand Down
Loading
Loading