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