Move providers into their own package
This commit is contained in:
parent
575b2257b1
commit
0ffdd6fa2f
|
@ -8,6 +8,8 @@ import (
|
|||
"github.com/prometheus/common/model"
|
||||
"github.com/prometheus/log"
|
||||
"golang.org/x/net/context"
|
||||
|
||||
"github.com/prometheus/alertmanager/provider"
|
||||
)
|
||||
|
||||
const ResolveTimeout = 30 * time.Second
|
||||
|
@ -16,7 +18,7 @@ const ResolveTimeout = 30 * time.Second
|
|||
// assigns the correct notifiers to each.
|
||||
type Dispatcher struct {
|
||||
routes Routes
|
||||
alertProvider AlertProvider
|
||||
alertProvider provider.Alerts
|
||||
|
||||
aggrGroups map[model.Fingerprint]*aggrGroup
|
||||
notifiers map[string]Notifier
|
||||
|
|
|
@ -15,10 +15,12 @@ package manager
|
|||
|
||||
import (
|
||||
"github.com/prometheus/common/model"
|
||||
|
||||
"github.com/prometheus/alertmanager/config"
|
||||
)
|
||||
|
||||
// AlertProvider gives access to a set of alerts.
|
||||
type AlertProvider interface {
|
||||
// Alerts gives access to a set of alerts.
|
||||
type Alerts interface {
|
||||
// Iter returns a channel on which all active alerts from the
|
||||
// beginning of time are sent. They are not guaranteed to be in
|
||||
// chronological order.
|
||||
|
@ -31,8 +33,8 @@ type AlertProvider interface {
|
|||
Del(model.Fingerprint) error
|
||||
}
|
||||
|
||||
// SilenceProvider gives access to silences.
|
||||
type SilenceProvider interface {
|
||||
// Silences gives access to silences.
|
||||
type Silences interface {
|
||||
Silencer
|
||||
|
||||
// All returns all existing silences.
|
||||
|
@ -45,9 +47,13 @@ type SilenceProvider interface {
|
|||
Get(model.Fingerprint) (*Silence, error)
|
||||
}
|
||||
|
||||
type ConfigProvider interface {
|
||||
// Reload initiates a configuration reload.
|
||||
Reload() error
|
||||
// Get returns the current configuration.
|
||||
Get() *Config
|
||||
// Reloadable is a component that can change its state based
|
||||
// on a new configuration.
|
||||
type Reloadable interface {
|
||||
ApplyConfig(*config.Config)
|
||||
}
|
||||
|
||||
type Config interface {
|
||||
// Reload initiates a configuration reload.
|
||||
Reload(...Reloadable) error
|
||||
}
|
Loading…
Reference in New Issue