Documentation ¶
Index ¶
- type CreatedMetaData
- type DB
- func (db *DB) FindAll(ctx context.Context, alertID int) ([]Entry, error)
- func (db *DB) FindLatestByType(ctx context.Context, alertID int, status Type) (*Entry, error)
- func (db *DB) FindOne(ctx context.Context, logID int) (*Entry, error)
- func (db *DB) LegacySearch(ctx context.Context, opts *LegacySearchOptions) ([]Entry, int, error)
- func (db *DB) Log(ctx context.Context, alertID int, _type Type, meta interface{}) error
- func (db *DB) LogEPTx(ctx context.Context, tx *sql.Tx, epID string, _type Type, ...) error
- func (db *DB) LogManyTx(ctx context.Context, tx *sql.Tx, alertIDs []int, _type Type, meta interface{}) error
- func (db *DB) LogServiceTx(ctx context.Context, tx *sql.Tx, serviceID string, _type Type, ...) error
- func (db *DB) LogTx(ctx context.Context, tx *sql.Tx, alertID int, _type Type, meta interface{}) error
- func (db *DB) MustLog(ctx context.Context, alertID int, _type Type, meta interface{})
- func (db *DB) MustLogTx(ctx context.Context, tx *sql.Tx, alertID int, _type Type, meta interface{})
- func (db *DB) Search(ctx context.Context, opts *SearchOptions) ([]Entry, error)
- type Entry
- type EscalationMetaData
- type LegacySearchOptions
- type NotificationMetaData
- type SearchCursor
- type SearchOptions
- type SortBy
- type Store
- type Subject
- type SubjectType
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreatedMetaData ¶ added in v0.25.0
type CreatedMetaData struct {
EPNoSteps bool
}
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (*DB) FindLatestByType ¶
FindLatestByType returns the latest Log Entry given alertID and status type
func (*DB) LegacySearch ¶ added in v0.23.0
LegacySearch will return a list of matching log entries.
func (*DB) LogServiceTx ¶
type EscalationMetaData ¶
type LegacySearchOptions ¶ added in v0.23.0
type LegacySearchOptions struct { // AlertID, if specified, will restrict alert logs to those with a matching AlertID. AlertID int // ServiceID, if specified, will restrict alert logs to those alerts which map to this particular ServiceID. ServiceID string // UserID, if specified, will restrict alert logs to those with events performed by the specified user. UserID string // IntegrationKeyID, if specified, will restrict alert logs to those with events authorized via the specified integration key. IntegrationKeyID string // Start will restrict alert logs to those which were created on or after this time. Start time.Time // End will restrict alert logs to those which were created before this time. End time.Time // Event, if specified, will restrict alert logs to those of the specified event type. Event Type // SortBy can be used to alter the primary sorting criteria. By default, results are ordered by timestamp as newest first. // Results will always have a secondary sort criteria of newest-events-first, unless SortByTimestamp is set and SortDesc is false. SortBy SortBy // SortDesc controls ascending or descending results of the primary sort (SortBy field). SortDesc bool // Offset indicates the starting row of the returned results. Offset int // Limit restricts the maximum number of rows returned. Default is 25. Maximum is 50. // Note: Limit is applied AFTER Offset is taken into account. Limit int }
LegacySearchOptions contains criteria for filtering alert logs. At a minimum, at least one of AlertID or ServiceID must be specified.
type NotificationMetaData ¶
type NotificationMetaData struct {
MessageID string
}
type SearchCursor ¶ added in v0.23.0
type SearchCursor struct {
ID int `json:"i,omitempty"`
}
type SearchOptions ¶
type SearchOptions struct { // FilterAlertIDs restricts the log entries belonging to specific alertIDs only. FilterAlertIDs []int `json:"f"` // Limit restricts the maximum number of rows returned. Default is 15. Limit int `json:"-"` After SearchCursor `json:"a,omitempty"` }
SearchOptions contains criteria for filtering alert logs.
type Store ¶
type Store interface { FindOne(ctx context.Context, logID int) (*Entry, error) FindAll(ctx context.Context, alertID int) ([]Entry, error) Log(ctx context.Context, alertID int, _type Type, meta interface{}) error LogTx(ctx context.Context, tx *sql.Tx, alertID int, _type Type, meta interface{}) error LogEPTx(ctx context.Context, tx *sql.Tx, epID string, _type Type, meta *EscalationMetaData) error LogServiceTx(ctx context.Context, tx *sql.Tx, serviceID string, _type Type, meta interface{}) error LogManyTx(ctx context.Context, tx *sql.Tx, alertIDs []int, _type Type, meta interface{}) error FindLatestByType(ctx context.Context, alertID int, status Type) (*Entry, error) LegacySearch(ctx context.Context, opt *LegacySearchOptions) ([]Entry, int, error) Search(ctx context.Context, opt *SearchOptions) ([]Entry, error) MustLog(ctx context.Context, alertID int, _type Type, meta interface{}) MustLogTx(ctx context.Context, tx *sql.Tx, alertID int, _type Type, meta interface{}) }
type Subject ¶
type Subject struct { ID string `json:"id"` Name string `json:"name"` Type SubjectType `json:"type"` Classifier string `json:"classifier"` }
A Subject is generally the causer of an event. If a user closes an alert, the entry would have a Subject set to the user.
type SubjectType ¶
type SubjectType string
SubjectType represents the type of subject or causer of an alert event.
const ( SubjectTypeUser SubjectType = "user" SubjectTypeIntegrationKey SubjectType = "integration_key" SubjectTypeHeartbeatMonitor SubjectType = "heartbeat_monitor" SubjectTypeChannel SubjectType = "channel" SubjectTypeNone SubjectType = "" )
Possible subject types
func (*SubjectType) Scan ¶
func (s *SubjectType) Scan(value interface{}) error
Scan handles reading a Type from the DB enum
type Type ¶
type Type string
A Type represents a log entry type for an alert.
const ( TypeCreated Type = "created" TypeClosed Type = "closed" TypeNotificationSent Type = "notification_sent" TypeNoNotificationSent Type = "no_notification_sent" TypeEscalated Type = "escalated" TypeAcknowledged Type = "acknowledged" TypePolicyUpdated Type = "policy_updated" TypeDuplicateSupressed Type = "duplicate_suppressed" TypeEscalationRequest Type = "escalation_request" )
Types of Log Entries