notifier

package
v2.4.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2018 License: MIT Imports: 19 Imported by: 0

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
	RemoteConfig     *remote.Config
}

Config is sending settings including log settings

type NotificationPackage

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

NotificationPackage represent sending data

func (NotificationPackage) GetMetricNames

func (pkg NotificationPackage) GetMetricNames() []string

GetMetricNames returns all metric names found in package events

func (NotificationPackage) GetWindow

func (pkg NotificationPackage) GetWindow() (from, to int64, err error)

GetWindow returns the earliest and the latest notification package timestamps

func (NotificationPackage) String

func (pkg NotificationPackage) String() string

String returns notification package summary

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, plotting moira.PlottingData, 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, plotting moira.PlottingData, 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