notifier

package
v2.3.1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2018 License: MIT Imports: 12 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Enabled          bool
	SendingTimeout   time.Duration
	ResendingTimeout time.Duration
	Senders          []map[string]string
	LogFile          string
	LogLevel         string
	FrontURL         string
	Location         *time.Location
	DateTimeFormat   string
}

Config is sending settings including log settings

type NotificationPackage

type NotificationPackage struct {
	Events     []moira.NotificationEvent
	Trigger    moira.TriggerData
	Contact    moira.ContactData
	FailCount  int
	Throttled  bool
	DontResend bool
}

NotificationPackage represent sending data

func (NotificationPackage) String

func (pkg NotificationPackage) String() string

type Notifier

type Notifier interface {
	Send(pkg *NotificationPackage, waitGroup *sync.WaitGroup)
	RegisterSender(senderSettings map[string]string, sender moira.Sender) error
	StopSenders()
	GetSenders() map[string]bool
}

Notifier implements notification functionality

type Scheduler

type Scheduler interface {
	ScheduleNotification(now time.Time, event moira.NotificationEvent, trigger moira.TriggerData, contact moira.ContactData, throttledOld bool, sendfail int) *moira.ScheduledNotification
}

Scheduler implements event scheduling functionality

type StandardNotifier

type StandardNotifier struct {
	// contains filtered or unexported fields
}

StandardNotifier represent notification functionality

func NewNotifier

func NewNotifier(database moira.Database, logger moira.Logger, config Config, metrics *graphite.NotifierMetrics) *StandardNotifier

NewNotifier is initializer for StandardNotifier

func (*StandardNotifier) GetSenders

func (notifier *StandardNotifier) GetSenders() map[string]bool

GetSenders get hash of registered notifier senders

func (*StandardNotifier) RegisterSender

func (notifier *StandardNotifier) RegisterSender(senderSettings map[string]string, sender moira.Sender) error

RegisterSender adds sender for notification type and registers metrics

func (*StandardNotifier) RegisterSenders

func (notifier *StandardNotifier) RegisterSenders(connector moira.Database) error

RegisterSenders watch on senders config and register all configured senders

func (*StandardNotifier) Send

func (notifier *StandardNotifier) Send(pkg *NotificationPackage, waitGroup *sync.WaitGroup)

Send is realization of StandardNotifier Send functionality

func (*StandardNotifier) StopSenders

func (notifier *StandardNotifier) StopSenders()

StopSenders close all sending channels

type StandardScheduler

type StandardScheduler struct {
	// contains filtered or unexported fields
}

StandardScheduler represents standard event scheduling

func NewScheduler

func NewScheduler(database moira.Database, logger moira.Logger, metrics *graphite.NotifierMetrics) *StandardScheduler

NewScheduler is initializer for StandardScheduler

func (*StandardScheduler) ScheduleNotification

func (scheduler *StandardScheduler) ScheduleNotification(now time.Time, event moira.NotificationEvent, trigger moira.TriggerData, contact moira.ContactData, throttledOld bool, sendfail int) *moira.ScheduledNotification

ScheduleNotification is realization of scheduling event, based on trigger and subscription time intervals and triggers settings

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL