Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrRelation = errors.New("provider id does not exist")
)
Functions ¶
func BuildNotifications ¶ added in v0.7.6
func BuildNotifications( cfg Config, alerts []Alert, firingLen int, createdTime time.Time, ) ([]notification.Notification, error)
Transform alerts and populate Data and Labels to be interpolated to the system-default template .Data - id - status "FIRING"/"RESOLVED" - resource - template - metric_value - metric_name - generator_url - num_alerts_firing - dashboard - playbook - summary .Labels - severity "WARNING"/"CRITICAL" - alertname - (others labels defined in rules)
Types ¶
type Alert ¶
type Alert struct {
ID uint64 `json:"id"`
ProviderID uint64 `json:"provider_id"`
NamespaceID uint64 `json:"namespace_id"`
ResourceName string `json:"resource_name"`
MetricName string `json:"metric_name"`
MetricValue string `json:"metric_value"`
Severity string `json:"severity"`
Rule string `json:"rule"`
TriggeredAt time.Time `json:"triggered_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
SilenceStatus string `json:"silence_status"`
// These fields won't be stored in the DB
// these are additional information for notification purposes
GroupKey string
Status string
Annotations map[string]string
Labels map[string]string
GeneratorURL string
Fingerprint string
}
func FromV1beta1Proto ¶ added in v0.6.7
func FromV1beta1Proto(proto *sirenv1beta1.Alert) *Alert
func (*Alert) ToV1beta1Proto ¶ added in v0.6.7
func (a *Alert) ToV1beta1Proto() *sirenv1beta1.Alert
type AlertTransformer ¶
type Config ¶ added in v0.7.6
type Config struct {
GroupBy []string `mapstructure:"group_by" yaml:"group_by"`
}
type LogService ¶
type NotificationService ¶ added in v0.7.6
type NotificationService interface {
Dispatch(context.Context, []notification.Notification) ([]string, error)
}
type Repository ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service handles business logic
func NewService ¶
func NewService(cfg Config, logger saltlog.Logger, repository Repository, logService LogService, notificationService NotificationService, registry map[string]AlertTransformer) *Service
NewService returns repository struct
func (*Service) CreateAlerts ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.