Documentation ¶
Index ¶
- Constants
- Variables
- func AddDashboardUIDPanelIDMigration(mg *migrator.Migrator)
- func AddRecordingRuleColumns(mg *migrator.Migrator)
- func AddRuleNotificationSettingsColumns(mg *migrator.Migrator)
- func AddTablesMigrations(mg *migrator.Migrator)
- func CreateOrgMigratedKVStoreEntries(mg *migrator.Migrator)
- func CreatedFoldersMigration(mg *migrator.Migrator)
- func FixEarlyMigration(mg *migrator.Migrator)
- func MigrationServiceMigration(mg *migrator.Migrator)
- func UpdateRuleGroupIndexMigration(mg *migrator.Migrator)
- type AlertConfiguration
- type MigrationError
Constants ¶
const ( Legacy alertingType = "Legacy" UnifiedAlerting alertingType = "UnifiedAlerting" )
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.
const UIDMaxLength = 40
UIDMaxLength is the standard size for fields that contain UIDs.
Variables ¶
var KVNamespace = "ngalert.migration"
KVNamespace is a vendored migration.KVNamespace.
Functions ¶
func AddRecordingRuleColumns ¶
AddRecordingRuleColumns adds columns to alert_rule to represent recording rules.
func AddRuleNotificationSettingsColumns ¶
AddRuleNotificationSettingsColumns creates a column for notification settings in the alert_rule and alert_rule_version tables.
func AddTablesMigrations ¶
AddTablesMigrations defines database migrations that affect Grafana Alerting tables.
func CreateOrgMigratedKVStoreEntries ¶
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 ¶
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 ¶
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 ¶
MigrationServiceMigration moves the legacy alert migration status from the migration log to kvstore.
func UpdateRuleGroupIndexMigration ¶
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 MigrationError ¶
func (MigrationError) Error ¶
func (e MigrationError) Error() string
func (*MigrationError) Unwrap ¶
func (e *MigrationError) Unwrap() error