2025-02-18 13:06:31 +05:30
|
|
|
package alertmanager
|
|
|
|
|
|
|
|
|
|
import (
|
2025-02-20 14:14:09 +05:30
|
|
|
"net/url"
|
2025-02-18 13:06:31 +05:30
|
|
|
"time"
|
|
|
|
|
|
2025-02-20 14:14:09 +05:30
|
|
|
"go.signoz.io/signoz/pkg/alertmanager/alertmanagerserver"
|
2025-02-18 13:06:31 +05:30
|
|
|
"go.signoz.io/signoz/pkg/factory"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type Config struct {
|
|
|
|
|
// Config is the config for the alertmanager server.
|
2025-02-20 14:14:09 +05:30
|
|
|
alertmanagerserver.Config `mapstructure:",squash"`
|
2025-02-18 13:06:31 +05:30
|
|
|
|
|
|
|
|
// Provider is the provider for the alertmanager service.
|
|
|
|
|
Provider string `mapstructure:"provider"`
|
|
|
|
|
|
|
|
|
|
// Internal is the internal alertmanager configuration.
|
2025-02-20 14:14:09 +05:30
|
|
|
Signoz Signoz `mapstructure:"signoz"`
|
|
|
|
|
|
|
|
|
|
// Legacy is the legacy alertmanager configuration.
|
|
|
|
|
Legacy Legacy `mapstructure:"legacy"`
|
2025-02-18 13:06:31 +05:30
|
|
|
}
|
|
|
|
|
|
2025-02-20 14:14:09 +05:30
|
|
|
type Signoz struct {
|
2025-02-18 13:06:31 +05:30
|
|
|
// PollInterval is the interval at which the alertmanager is synced.
|
|
|
|
|
PollInterval time.Duration `mapstructure:"poll_interval"`
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-20 14:14:09 +05:30
|
|
|
type Legacy struct {
|
|
|
|
|
// URL is the URL of the legacy alertmanager.
|
|
|
|
|
URL *url.URL `mapstructure:"url"`
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-18 13:06:31 +05:30
|
|
|
func NewConfigFactory() factory.ConfigFactory {
|
|
|
|
|
return factory.NewConfigFactory(factory.MustNewName("alertmanager"), newConfig)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func newConfig() factory.Config {
|
|
|
|
|
return Config{
|
2025-02-20 14:14:09 +05:30
|
|
|
Config: alertmanagerserver.NewConfig(),
|
|
|
|
|
Provider: "signoz",
|
|
|
|
|
Signoz: Signoz{
|
2025-02-18 13:06:31 +05:30
|
|
|
PollInterval: 15 * time.Second,
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c Config) Validate() error {
|
|
|
|
|
return nil
|
|
|
|
|
}
|