ualert

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: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Legacy          alertingType = "Legacy"
	UnifiedAlerting alertingType = "UnifiedAlerting"
)
View Source
const DefaultFieldMaxLength = 190

DefaultFieldMaxLength is the standard size for most user-settable string fields in Alerting. Use this for typical string fields, unless you have a special reason not to.

View Source
const UIDMaxLength = 40

UIDMaxLength is the standard size for fields that contain UIDs.

Variables

View Source
var KVNamespace = "ngalert.migration"

KVNamespace is a vendored migration.KVNamespace.

Functions

func AddDashboardUIDPanelIDMigration

func AddDashboardUIDPanelIDMigration(mg *migrator.Migrator)

func AddRecordingRuleColumns

func AddRecordingRuleColumns(mg *migrator.Migrator)

AddRecordingRuleColumns adds columns to alert_rule to represent recording rules.

func AddRuleNotificationSettingsColumns

func AddRuleNotificationSettingsColumns(mg *migrator.Migrator)

AddRuleNotificationSettingsColumns creates a column for notification settings in the alert_rule and alert_rule_version tables.

func AddTablesMigrations

func AddTablesMigrations(mg *migrator.Migrator)

AddTablesMigrations defines database migrations that affect Grafana Alerting tables.

func CreateOrgMigratedKVStoreEntries

func CreateOrgMigratedKVStoreEntries(mg *migrator.Migrator)

CreateOrgMigratedKVStoreEntries creates kv store entries for each organization if the migration has been run. This is needed now that we've changed the semantics of data loss when upgrading / rolling back. If a user who previously upgraded were to rollback and upgrade again without clean_upgrade, then since they don't have org-level migrated states it will attempt to upgrade their orgs as if they had never upgraded before. This will almost definitely fail with duplicate key errors.

In addition, this changes the entry for orgId=0 to be better named as it no longer tracks whether the migration has been run, but rather the current alerting type of Grafana; Legacy or UnifiedAlerting. This is used to detect transitions between Legacy and UnifiedAlerting by comparing to the desired type in the configuration.

func CreatedFoldersMigration

func CreatedFoldersMigration(mg *migrator.Migrator)

CreatedFoldersMigration moves the record of created folders during legacy migration from Dashboard created_by=-8 to the kvstore. If there are no dashboards with created_by=-.8, then nothing needs to be done.

func FixEarlyMigration

func FixEarlyMigration(mg *migrator.Migrator)

FixEarlyMigration fixes UA configs created before 8.2 with org_id=0 and moves some files like __default__.tmpl. The only use of this migration is when a user enabled ng-alerting before 8.2.

func MigrationServiceMigration

func MigrationServiceMigration(mg *migrator.Migrator)

MigrationServiceMigration moves the legacy alert migration status from the migration log to kvstore.

func UpdateRuleGroupIndexMigration

func UpdateRuleGroupIndexMigration(mg *migrator.Migrator)

UpdateRuleGroupIndexMigration updates a new field rule_group_index for alert rules that belong to a group with more than 1 alert.

Types

type AlertConfiguration

type AlertConfiguration struct {
	ID    int64 `xorm:"pk autoincr 'id'"`
	OrgID int64 `xorm:"org_id"`

	AlertmanagerConfiguration string
	ConfigurationVersion      string
	CreatedAt                 int64 `xorm:"created"`
}

type MigrationError

type MigrationError struct {
	AlertId int64
	Err     error
}

func (MigrationError) Error

func (e MigrationError) Error() string

func (*MigrationError) Unwrap

func (e *MigrationError) Unwrap() error

Jump to

Keyboard shortcuts

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