alerting

package
v11.1.4-modfix Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Provision

func Provision(ctx context.Context, cfg ProvisionerConfig) error

Types

type AlertRuleGroupV1

type AlertRuleGroupV1 struct {
	OrgID    values.Int64Value  `json:"orgId" yaml:"orgId"`
	Name     values.StringValue `json:"name" yaml:"name"`
	Folder   values.StringValue `json:"folder" yaml:"folder"`
	Interval values.StringValue `json:"interval" yaml:"interval"`
	Rules    []AlertRuleV1      `json:"rules" yaml:"rules"`
}

func (*AlertRuleGroupV1) MapToModel

func (ruleGroupV1 *AlertRuleGroupV1) MapToModel() (models.AlertRuleGroupWithFolderFullpath, error)

type AlertRuleProvisioner

type AlertRuleProvisioner interface {
	Provision(ctx context.Context, files []*AlertingFile) error
}

func NewAlertRuleProvisioner

func NewAlertRuleProvisioner(
	logger log.Logger,
	folderService folder.Service,
	dashboardProvService dashboards.DashboardProvisioningService,
	ruleService provisioning.AlertRuleService) AlertRuleProvisioner

type AlertRuleV1

type AlertRuleV1 struct {
	UID                  values.StringValue      `json:"uid" yaml:"uid"`
	Title                values.StringValue      `json:"title" yaml:"title"`
	Condition            values.StringValue      `json:"condition" yaml:"condition"`
	Data                 []QueryV1               `json:"data" yaml:"data"`
	DashboardUID         values.StringValue      `json:"dasboardUid" yaml:"dashboardUid"`
	PanelID              values.Int64Value       `json:"panelId" yaml:"panelId"`
	NoDataState          values.StringValue      `json:"noDataState" yaml:"noDataState"`
	ExecErrState         values.StringValue      `json:"execErrState" yaml:"execErrState"`
	For                  values.StringValue      `json:"for" yaml:"for"`
	Annotations          values.StringMapValue   `json:"annotations" yaml:"annotations"`
	Labels               values.StringMapValue   `json:"labels" yaml:"labels"`
	IsPaused             values.BoolValue        `json:"isPaused" yaml:"isPaused"`
	NotificationSettings *NotificationSettingsV1 `json:"notification_settings" yaml:"notification_settings"`
	Record               *RecordV1               `json:"record" yaml:"record"`
}

type AlertingFile

type AlertingFile struct {
	Filename            string
	Groups              []models.AlertRuleGroupWithFolderFullpath
	DeleteRules         []RuleDelete
	ContactPoints       []ContactPoint
	DeleteContactPoints []DeleteContactPoint
	Policies            []NotificiationPolicy
	ResetPolicies       []OrgID
	MuteTimes           []MuteTime
	DeleteMuteTimes     []DeleteMuteTime
	Templates           []Template
	DeleteTemplates     []DeleteTemplate
	// contains filtered or unexported fields
}

type AlertingFileV1

type AlertingFileV1 struct {
	Filename            string
	Groups              []AlertRuleGroupV1      `json:"groups" yaml:"groups"`
	DeleteRules         []RuleDeleteV1          `json:"deleteRules" yaml:"deleteRules"`
	ContactPoints       []ContactPointV1        `json:"contactPoints" yaml:"contactPoints"`
	DeleteContactPoints []DeleteContactPointV1  `json:"deleteContactPoints" yaml:"deleteContactPoints"`
	Policies            []NotificiationPolicyV1 `json:"policies" yaml:"policies"`
	ResetPolicies       []values.Int64Value     `json:"resetPolicies" yaml:"resetPolicies"`
	MuteTimes           []MuteTimeV1            `json:"muteTimes" yaml:"muteTimes"`
	DeleteMuteTimes     []DeleteMuteTimeV1      `json:"deleteMuteTimes" yaml:"deleteMuteTimes"`
	Templates           []TemplateV1            `json:"templates" yaml:"templates"`
	DeleteTemplates     []DeleteTemplateV1      `json:"deleteTemplates" yaml:"deleteTemplates"`
	// contains filtered or unexported fields
}

func (*AlertingFileV1) MapToModel

func (fileV1 *AlertingFileV1) MapToModel() (AlertingFile, error)

type ContactPoint

type ContactPoint struct {
	OrgID         int64                              `json:"orgId" yaml:"orgId"`
	ContactPoints []definitions.EmbeddedContactPoint `json:"configs" yaml:"configs"`
}

type ContactPointProvisioner

type ContactPointProvisioner interface {
	Provision(ctx context.Context, files []*AlertingFile) error
	Unprovision(ctx context.Context, files []*AlertingFile) error
}

func NewContactPointProvisoner

func NewContactPointProvisoner(logger log.Logger,
	contactPointService provisioning.ContactPointService) ContactPointProvisioner

type ContactPointV1

type ContactPointV1 struct {
	OrgID     values.Int64Value  `json:"orgId" yaml:"orgId"`
	Name      values.StringValue `json:"name" yaml:"name"`
	Receivers []ReceiverV1       `json:"receivers" yaml:"receivers"`
}

func (*ContactPointV1) MapToModel

func (cpV1 *ContactPointV1) MapToModel() (ContactPoint, error)

type DeleteContactPoint

type DeleteContactPoint struct {
	OrgID int64  `json:"orgId" yaml:"orgId"`
	UID   string `json:"uid" yaml:"uid"`
}

type DeleteContactPointV1

type DeleteContactPointV1 struct {
	OrgID values.Int64Value  `json:"orgId" yaml:"orgId"`
	UID   values.StringValue `json:"uid" yaml:"uid"`
}

func (*DeleteContactPointV1) MapToModel

func (v1 *DeleteContactPointV1) MapToModel() DeleteContactPoint

type DeleteMuteTime

type DeleteMuteTime struct {
	OrgID int64
	Name  string
}

type DeleteMuteTimeV1

type DeleteMuteTimeV1 struct {
	OrgID values.Int64Value  `json:"orgId" yaml:"orgId"`
	Name  values.StringValue `json:"name" yaml:"name"`
}

type DeleteTemplate

type DeleteTemplate struct {
	OrgID int64
	Name  string
}

type DeleteTemplateV1

type DeleteTemplateV1 struct {
	OrgID values.Int64Value  `json:"orgId" yaml:"orgId"`
	Name  values.StringValue `json:"name" yaml:"name"`
}

type MuteTime

type MuteTime struct {
	OrgID    int64
	MuteTime definitions.MuteTimeInterval
}

type MuteTimeV1

type MuteTimeV1 struct {
	OrgID    values.Int64Value            `json:"orgId" yaml:"orgId"`
	MuteTime definitions.MuteTimeInterval `json:",inline" yaml:",inline"`
}

type MuteTimesProvisioner

type MuteTimesProvisioner interface {
	Provision(ctx context.Context, files []*AlertingFile) error
	Unprovision(ctx context.Context, files []*AlertingFile) error
}

func NewMuteTimesProvisioner

func NewMuteTimesProvisioner(logger log.Logger,
	muteTimingService provisioning.MuteTimingService) MuteTimesProvisioner

type NotificationPolicyProvisioner

type NotificationPolicyProvisioner interface {
	Provision(ctx context.Context, files []*AlertingFile) error
	Unprovision(ctx context.Context, files []*AlertingFile) error
}

func NewNotificationPolicyProvisoner

func NewNotificationPolicyProvisoner(logger log.Logger,
	notificationPolicyService provisioning.NotificationPolicyService) NotificationPolicyProvisioner

type NotificationSettingsV1

type NotificationSettingsV1 struct {
	Receiver          values.StringValue   `json:"receiver" yaml:"receiver"`
	GroupBy           []values.StringValue `json:"group_by,omitempty" yaml:"group_by"`
	GroupWait         values.StringValue   `json:"group_wait,omitempty" yaml:"group_wait"`
	GroupInterval     values.StringValue   `json:"group_interval,omitempty" yaml:"group_interval"`
	RepeatInterval    values.StringValue   `json:"repeat_interval,omitempty" yaml:"repeat_interval"`
	MuteTimeIntervals []values.StringValue `json:"mute_time_intervals,omitempty" yaml:"mute_time_intervals"`
}

type NotificiationPolicy

type NotificiationPolicy struct {
	OrgID  int64
	Policy definitions.Route
}

type NotificiationPolicyV1

type NotificiationPolicyV1 struct {
	OrgID values.Int64Value `json:"orgId" yaml:"orgId"`
	// We use JSONValue here, as we want to have interpolation the values.
	Policy values.JSONValue `json:"-" yaml:"-"`
}

func (*NotificiationPolicyV1) UnmarshalYAML

func (v1 *NotificiationPolicyV1) UnmarshalYAML(unmarshal func(any) error) error

type OrgID

type OrgID int64

type ProvisionerConfig

type ProvisionerConfig struct {
	Path                       string
	FolderService              folder.Service
	DashboardProvService       dashboards.DashboardProvisioningService
	RuleService                provisioning.AlertRuleService
	ContactPointService        provisioning.ContactPointService
	NotificiationPolicyService provisioning.NotificationPolicyService
	MuteTimingService          provisioning.MuteTimingService
	TemplateService            provisioning.TemplateService
}

type QueryV1

type QueryV1 struct {
	RefID             values.StringValue       `json:"refId" yaml:"refId"`
	QueryType         values.StringValue       `json:"queryType" yaml:"queryType"`
	RelativeTimeRange models.RelativeTimeRange `json:"relativeTimeRange" yaml:"relativeTimeRange"`
	DatasourceUID     values.StringValue       `json:"datasourceUid" yaml:"datasourceUid"`
	Model             values.JSONValue         `json:"model" yaml:"model"`
}

type ReceiverV1

type ReceiverV1 struct {
	UID                   values.StringValue `json:"uid" yaml:"uid"`
	Type                  values.StringValue `json:"type" yaml:"type"`
	Settings              values.JSONValue   `json:"settings" yaml:"settings"`
	DisableResolveMessage values.BoolValue   `json:"disableResolveMessage" yaml:"disableResolveMessage"`
}

type RecordV1

type RecordV1 struct {
	Metric values.StringValue `json:"metric" yaml:"metric"`
	From   values.StringValue `json:"from" yaml:"from"`
}

type RuleDelete

type RuleDelete struct {
	UID   string
	OrgID int64
}

type RuleDeleteV1

type RuleDeleteV1 struct {
	UID   values.StringValue `json:"uid" yaml:"uid"`
	OrgID values.Int64Value  `json:"orgId" yaml:"orgId"`
}

type Template

type Template struct {
	OrgID int64
	Data  definitions.NotificationTemplate
}

type TemplateV1

type TemplateV1 struct {
	OrgID    values.Int64Value                `json:"orgId" yaml:"orgId"`
	Template definitions.NotificationTemplate `json:",inline" yaml:",inline"`
}

type TextTemplateProvisioner

type TextTemplateProvisioner interface {
	Provision(ctx context.Context, files []*AlertingFile) error
	Unprovision(ctx context.Context, files []*AlertingFile) error
}

func NewTextTemplateProvisioner

func NewTextTemplateProvisioner(logger log.Logger,
	templateService provisioning.TemplateService) TextTemplateProvisioner

Jump to

Keyboard shortcuts

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