|
4 | 4 | "context"
|
5 | 5 | "flag"
|
6 | 6 | "fmt"
|
| 7 | + "github.com/prometheus/alertmanager/featurecontrol" |
7 | 8 | "net/http"
|
8 | 9 | "net/url"
|
9 | 10 | "os"
|
@@ -68,6 +69,7 @@ type MultitenantAlertmanagerConfig struct {
|
68 | 69 | ExternalURL flagext.URLValue `yaml:"external_url"`
|
69 | 70 | PollInterval time.Duration `yaml:"poll_interval"`
|
70 | 71 | MaxRecvMsgSize int64 `yaml:"max_recv_msg_size"`
|
| 72 | + FeatureFlags string `yaml:"feature_flags"` |
71 | 73 |
|
72 | 74 | // Enable sharding for the Alertmanager
|
73 | 75 | ShardingEnabled bool `yaml:"sharding_enabled"`
|
@@ -124,6 +126,7 @@ func (cfg *MultitenantAlertmanagerConfig) RegisterFlags(f *flag.FlagSet) {
|
124 | 126 | f.BoolVar(&cfg.ShardingEnabled, "alertmanager.sharding-enabled", false, "Shard tenants across multiple alertmanager instances.")
|
125 | 127 | f.Var(&cfg.EnabledTenants, "alertmanager.enabled-tenants", "Comma separated list of tenants whose alerts this alertmanager can process. If specified, only these tenants will be handled by alertmanager, otherwise this alertmanager can process alerts from all tenants.")
|
126 | 128 | f.Var(&cfg.DisabledTenants, "alertmanager.disabled-tenants", "Comma separated list of tenants whose alerts this alertmanager cannot process. If specified, a alertmanager that would normally pick the specified tenant(s) for processing will ignore them instead.")
|
| 129 | + f.StringVar(&cfg.FeatureFlags, "alertmanager.enable-feature", "", fmt.Sprintf("Prometheus AlertManager experimental features to enable. The flag can be repeated to enable multiple features. Valid options: %s", strings.Join(featurecontrol.AllowedFlags, ", "))) |
127 | 130 |
|
128 | 131 | cfg.AlertmanagerClient.RegisterFlagsWithPrefix("alertmanager.alertmanager-client", f)
|
129 | 132 | cfg.Persister.RegisterFlagsWithPrefix("alertmanager", f)
|
@@ -977,6 +980,7 @@ func (am *MultitenantAlertmanager) newAlertmanager(userID string, amConfig *amco
|
977 | 980 | Limits: am.limits,
|
978 | 981 | APIConcurrency: am.cfg.APIConcurrency,
|
979 | 982 | GCInterval: am.cfg.GCInterval,
|
| 983 | + FeatureFlags: am.cfg.FeatureFlags, |
980 | 984 | }, reg)
|
981 | 985 | if err != nil {
|
982 | 986 | return nil, fmt.Errorf("unable to start Alertmanager for user %v: %v", userID, err)
|
|
0 commit comments