Alerting: Add clean_upgrade config and deprecate force_migration (#78324)

* Alerting: Add clean_upgrade config and deprecate force_migration

Upgrading to UA and rolling back will no longer delete any data by default. 
Instead, each set of tables will remain unchanged when switching between 
legacy and UA. As such, the force_migration config has been deprecated 
and no extra configuration is required to roll back to legacy anymore.

If clean_upgrade is set to true when upgrading from legacy alerting to Unified
Alerting, grafana will first delete all existing Unified Alerting resources,
thus re-upgrading all organizations from scratch. If false or unset,
organizations that have previously upgraded will not lose their existing Unified
 Alerting data when switching between legacy and Unified Alerting.

 Similar to force_migration, it should be kept false when not needed as it may
 cause unintended data-loss if left enabled.

---------

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
This commit is contained in:
Matthew Jacobson
2023-11-30 11:01:11 -05:00
committed by GitHub
parent 0f0249abea
commit 5a80962de9
9 changed files with 144 additions and 47 deletions

View File

@@ -148,11 +148,19 @@ Options are `production` and `development`. Default is `production`. _Do not_ ch
Set the name of the grafana-server instance. Used in logging, internal metrics, and clustering info. Defaults to: `${HOSTNAME}`, which will be replaced with
environment variable `HOSTNAME`, if that is empty or does not exist Grafana will try to use system calls to get the machine name.
### force_migration
## force_migration
Force migration will run migrations that might cause data loss. Default is `false`.
{{% admonition type="note" %}}
This option is deprecated - [See `clean_upgrade` option]({{< relref "#clean_upgrade" >}}) instead.
{{% /admonition %}}
Set force_migration=true in your grafana.ini and restart Grafana to roll back and delete Unified Alerting configuration data. Any alert rules created while using Unified Alerting will be deleted by rolling back.
When you restart Grafana to rollback from Grafana Alerting to legacy alerting, delete any existing Grafana Alerting data, such as alert rules, contact points, and notification policies. Default is `false`.
If `false` or unset, existing Grafana Alerting data is not changed or deleted when rolling back to legacy alerting.
{{% admonition type="note" %}}
It should be kept false or unset when not needed, as it may cause unintended data loss if left enabled.
{{% /admonition %}}
<hr />
@@ -1489,7 +1497,7 @@ For more information about the Grafana alerts, refer to [About Grafana Alerting]
### enabled
Enable or disable Grafana Alerting. If disabled, all your legacy alerting data will be available again, but the data you created using Grafana Alerting will be deleted. Set force_migration=true to avoid deletion of data. The default value is `true`.
Enable or disable Grafana Alerting. If disabled, all your legacy alerting data will be available again. The default value is `true`.
Alerting Rules migrated from dashboards and panels will include a link back via the `annotations`.
@@ -1629,6 +1637,22 @@ For example: `disabled_labels=grafana_folder`
<hr>
## [unified_alerting.upgrade]
For more information about upgrading to Grafana Alerting, refer to [Upgrade Alerting](/docs/grafana/next/alerting/set-up/migrating-alerts/).
### clean_upgrade
When you restart Grafana to upgrade from legacy alerting to Grafana Alerting, delete any existing Grafana Alerting data from a previous upgrade, such as alert rules, contact points, and notification policies. Default is `false`.
If `false` or unset, existing Grafana Alerting data is not changed or deleted when you switch between legacy and Unified Alerting.
{{% admonition type="note" %}}
It should be kept false when not needed, as it may cause unintended data loss if left enabled.
{{% /admonition %}}
<hr>
## [alerting]
For more information about the legacy dashboard alerting feature in Grafana, refer to [the legacy Grafana alerts](/docs/grafana/v8.5/alerting/old-alerting/).