alertlog

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AutoClose added in v0.31.0

type AutoClose struct {
	AlertAutoCloseDays int
}

type CreatedMetaData

type CreatedMetaData struct {
	EPNoSteps bool
}

type Entry

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

func (Entry) AlertID

func (e Entry) AlertID() int

func (Entry) ID

func (e Entry) ID() int

func (Entry) Meta

func (e Entry) Meta(ctx context.Context) interface{}

func (Entry) String

func (e Entry) String(ctx context.Context) string

func (Entry) Subject

func (e Entry) Subject() *Subject

func (Entry) Timestamp

func (e Entry) Timestamp() time.Time

func (Entry) Type

func (e Entry) Type() Type

type EscalationMetaData

type EscalationMetaData struct {
	NewStepIndex    int
	Repeat          bool
	Forced          bool
	Deleted         bool
	OldDelayMinutes int
	NoOneOnCall     bool
}

type NotificationMetaData

type NotificationMetaData struct {
	MessageID string
}

type SearchCursor

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 struct {
	// contains filtered or unexported fields
}

func NewStore

func NewStore(ctx context.Context, db *sql.DB) (*Store, error)

func (*Store) FindLatestByType

func (s *Store) FindLatestByType(ctx context.Context, alertID int, status Type) (*Entry, error)

FindLatestByType returns the latest Log Entry given alertID and status type

func (*Store) FindOne

func (s *Store) FindOne(ctx context.Context, logID int) (*Entry, error)

func (*Store) LogEPTx

func (s *Store) LogEPTx(ctx context.Context, tx *sql.Tx, epID string, _type Type, meta *EscalationMetaData) error

func (*Store) LogManyTx

func (s *Store) LogManyTx(ctx context.Context, tx *sql.Tx, alertIDs []int, _type Type, meta interface{}) error

func (*Store) LogServiceTx

func (s *Store) LogServiceTx(ctx context.Context, tx *sql.Tx, serviceID string, _type Type, meta interface{}) error

func (*Store) LogTx

func (s *Store) LogTx(ctx context.Context, tx *sql.Tx, alertID int, _type Type, meta interface{}) error

func (*Store) MustLog

func (s *Store) MustLog(ctx context.Context, alertID int, _type Type, meta interface{})

func (*Store) MustLogTx

func (s *Store) MustLogTx(ctx context.Context, tx *sql.Tx, alertID int, _type Type, meta interface{})

func (*Store) Search

func (s *Store) Search(ctx context.Context, opts *SearchOptions) ([]Entry, error)

Search will return a list of matching log entries

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

func (SubjectType) Value

func (s SubjectType) Value() (driver.Value, error)

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

func (*Type) Scan

func (ty *Type) Scan(value interface{}) error

Scan handles reading a Type from the DB enum

Jump to

Keyboard shortcuts

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