alerting

package
v0.0.0-...-fb7f86c Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: AGPL-3.0 Imports: 19 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.AlertRuleGroupWithFolderTitle, error)

type AlertRuleProvisioner

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

func NewAlertRuleProvisioner

func NewAlertRuleProvisioner(
	logger log.Logger,
	dashboardService dashboards.DashboardService,
	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"`
}

type AlertingFile

type AlertingFile struct {
	Filename            string
	Groups              []models.AlertRuleGroupWithFolderTitle
	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 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(interface{}) error) error

type OrgID

type OrgID int64

type ProvisionerConfig

type ProvisionerConfig struct {
	Path                       string
	DashboardService           dashboards.DashboardService
	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 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