Documentation ¶
Overview ¶
Alert provides a framework for tracking events in a publish subscribe system. Events are published to topics and handlers consume the events from the topics.
Index ¶
- type Event
- type EventData
- type EventState
- type Handler
- type Level
- type TemplateData
- type Topic
- type TopicStatus
- type Topics
- func (s *Topics) Close() error
- func (s *Topics) Collect(event Event) error
- func (s *Topics) DeleteTopic(topic string)
- func (s *Topics) DeregisterHandler(topics []string, h Handler)
- func (s *Topics) EventState(topic, event string) (EventState, bool)
- func (s *Topics) Open() error
- func (s *Topics) RegisterHandler(topics []string, h Handler)
- func (s *Topics) ReplaceHandler(oldTopics, newTopics []string, oldH, newH Handler)
- func (s *Topics) RestoreTopic(id string, eventStates map[string]EventState)
- func (s *Topics) Topic(id string) (*Topic, bool)
- func (s *Topics) TopicStatus(pattern string, minLevel Level) map[string]TopicStatus
- func (s *Topics) TopicStatusEvents(pattern string, minLevel Level) map[string]map[string]EventState
- func (s *Topics) UpdateEvent(id string, event EventState)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct { Topic string State EventState Data EventData // contains filtered or unexported fields }
func (Event) PreviousState ¶
func (e Event) PreviousState() EventState
func (Event) TemplateData ¶
func (e Event) TemplateData() TemplateData
type EventData ¶
type EventData struct { // Measurement name Name string // TaskName is the name of the task that generated this event. TaskName string // Concatenation of all group-by tags of the form [key=value,]+. // If not groupBy is performed equal to literal 'nil' Group string // Map of tags Tags map[string]string // Fields of alerting data point. Fields map[string]interface{} Result influxql.Result }
type EventState ¶
type Handler ¶
type Handler interface { // Handle is responsible for taking action on the event. Handle(event Event) }
type Level ¶
type Level int
func ParseLevel ¶
func (Level) MarshalText ¶
func (*Level) UnmarshalText ¶
type TemplateData ¶
type TemplateData struct { // The ID of the alert. ID string // The Message of the Alert Message string // Alert Level, one of: INFO, WARNING, CRITICAL. Level string // Time the event occurred. Time time.Time // Duration of the event Duration time.Duration // Measurement name Name string // Task name TaskName string // Concatenation of all group-by tags of the form [key=value,]+. // If not groupBy is performed equal to literal 'nil' Group string // Map of tags Tags map[string]string // Fields of alerting data point. Fields map[string]interface{} }
TemplateData is a structure containing all information available to use in templates for an Event.
type Topic ¶
type Topic struct {
// contains filtered or unexported fields
}
func (*Topic) EventState ¶
func (t *Topic) EventState(event string) (EventState, bool)
func (*Topic) EventStates ¶
func (t *Topic) EventStates(minLevel Level) map[string]EventState
func (*Topic) Status ¶
func (t *Topic) Status() TopicStatus
type TopicStatus ¶
type Topics ¶
type Topics struct {
// contains filtered or unexported fields
}
func (*Topics) DeleteTopic ¶
func (*Topics) DeregisterHandler ¶
func (*Topics) EventState ¶
func (s *Topics) EventState(topic, event string) (EventState, bool)
func (*Topics) RegisterHandler ¶
func (*Topics) ReplaceHandler ¶
func (*Topics) RestoreTopic ¶
func (s *Topics) RestoreTopic(id string, eventStates map[string]EventState)
func (*Topics) TopicStatus ¶
func (s *Topics) TopicStatus(pattern string, minLevel Level) map[string]TopicStatus
TopicStatus returns the max alert level for each topic matching 'pattern', not returning any topics with max alert levels less severe than 'minLevel'
func (*Topics) TopicStatusEvents ¶
TopicStatusDetails is similar to TopicStatus, but will additionally return at least 'minLevel' severity
func (*Topics) UpdateEvent ¶
func (s *Topics) UpdateEvent(id string, event EventState)
Click to show internal directories.
Click to hide internal directories.