Slide 4 of 5

Rename data sources safely

Dashboards reference a data source by ID, not name

A common pitfall after connecting involves how Grafana tracks your data sources. Every data source has a unique identifier (UID). Your dashboards, panels, and alert rules point to that UID behind the scenes, not to the display name you see.

Renaming a data source in place keeps the same UID, so a panel keeps working. Deleting and recreating it gives a new UID, so the panel can't find the data source.

This matters most when you change a data source:

  • Rename in place when you want a new name. An edited name keeps the same UID, so everything that uses the data source keeps working.
  • Avoid delete-and-recreate. A recreated data source gets a new UID, so existing panels and alert rules can no longer find it and fail to load.
  • Imported dashboards from another organization may reference a UID that doesn’t exist in your stack. Repoint each panel to a data source you have.

Script

As you start working with data sources, one issue commonly trips people up. Knowing about it now saves you time later.

It involves how Grafana tracks your data sources. Behind the scenes, every data source has a unique ID, and your dashboards, panels, and alert rules reference that ID, not the name you see. So if you delete and recreate a data source to rename it, those panels and alert rules lose their connection and can’t load data. The fix is simple: rename a data source in place instead of recreating it.