docs/sources/upgrade-guide/upgrade-v11.2/index.md
{{< docs/shared lookup="upgrade/intro.md" source="grafana" version="<GRAFANA_VERSION>" >}}
{{< docs/shared lookup="back-up/back-up-grafana.md" source="grafana" version="<GRAFANA_VERSION>" leveloffset="+1" >}}
{{< docs/shared lookup="upgrade/upgrade-common-tasks.md" source="grafana" version="<GRAFANA_VERSION>" >}}
Ensure that your data source UIDs follow the correct standard
We've had a standard ways to define UIDs for Grafana objects for years (at least since Grafana v5). While all of our internal code complies to this format, we didn't yet have strict enforcement of this format in REST APIs and provisioning paths that allow the creation and update of data sources.
In Grafana v11.1, we introduced a warning that is sent to Grafana server logs every time a data source instance is being created or updated using an invalid UID format.
In Grafana v11.2, we added a new feature flag called failWrongDSUID that is turned off by default. When enabled, the REST APIs and provisioning start rejecting any requests to create or update data source instances that have an incorrect UID.
In Grafana v11.5, we're going to turn feature flag failWrongDSUID on by default, but there will still be an option to turn it off.
In Grafana v12, this will be the default behavior and will not be configurable.
You can find the exact regex definition in the grafana repository.
A data source UID can only contain:
a-Z)0-9)-)/api/datasources API. Review the uid fields, comparing them to the correct format, as shown in the docs. Following is a script that can help, but note that it's missing authentication that you have to add yourself:curl http://localhost:3000/api/datasources | jq '.[] | select((.uid | test("^[a-zA-Z0-9\\-_]+$") | not) or (.uid | length > 40)) | {id, uid, name, type}'
Invalid datasource uid error.You'll need to create a new data source with the correct UID and update your dashboards and alert rules to use it.
Go to the dashboard using the data source and update it by selecting the new or updated data source from the picker below your panel.
Update the dashboard's JSON model directly using search and replace.
Navigate to dashboard json model and carefully replace all the instances of old uid with the newly created uid.
{{< figure src="/media/docs/grafana/screenshot-grafana-11-datasource-uid-enforcement.png" alt="Updating JSON Model of a Dashboard">}}
Open the alert rule you want to adjust and search for the data source that is being used for the query/alert condition. From there, select the new data source from the drop-down list and save the alert rule.