Adding a second InfluxDB Data Source has broken my existing dashboard completely - how to fix?

I have a single InfluxDB instance, within which I have two databases, let’s call them “db_app1” and “db_app2”. They store independent data.

Within Grafana I have created two data sources, both of type InfluxDB, one called “InfluxDB-App1”, the other called “InfluxDB-App2”. Because they reference the same instance, almost everything about them is the same, except for the “InfluxDB Details” > “Database” field, where one has “db_app1” and the other has “db_app2”. Both databases work via “Save & Test”.

Unfortunately this is where things start to go badly wrong. I had created my dashboard for App1 prior to adding db_app2 as a datasource, thus all of my dashboard widgets referenced the “InfluxDB-App1” Data Source. But when I added the second Data Source (“InfluxDB-App2”) the dashboard failed to load data properly. Looking at, say, a Singlestat widget, I can see that the Data Source dropdown has changed to just “InfluxDB”. If I click on it, I can see InfluxDB-App1 in the list. There is no sign of “InfluxDB-App2”. If I click “InfluxDB-App1” then the Query looks OK, but no data is displayed. If I click the Data Source drop-down again, there is no longer a “InfluxDB-App1” entry, only “InfluxDB”, “default”, “-Mixed-” and “-Grafana-”. Something is clearly not right and none of my data appears anywhere on the dashboard now.

For some widgets, they show “InfluxDB-App1” as the current selection (no data displayed though) and when I click the drop-down there’s no mention of “InfluxDB-App1” in the list.

I removed the InfluxDB-App2 data source, hoping that it would allow me to restore my connection to InfluxDB-App1 in my dashboard. Unfortunately that didn’t happen and I now have a completely non-operational dashboard.

I’m wondering if perhaps this use-case is not supported? More importantly, how do I restore the operation of my dashboard? It seems completely broken now.

I’m using Grafana v5.1.4 on ARM.

EDIT: I was able to restore the dashboard connection to the data source by editing the InfluxDB-App1 data source and changing the database name from “db_app1” to “db_app1x”, attempting a Save & Test (which failed of course), then renaming it back to “db_app1” and then saving successfully. Then my dashboard lurched back into life.

In fact I remember an additional aspect - the problems earlier started when I tried to import a third-party Dashboard from the Grafana collection by using “Import by ID” for App2. When I did this, it asked me for a Data Source to apply to the new dashboard, and that is when I saw the erroneous “InfluxDB” entry for the first time - I wanted to select “InfluxDB-App2” but I wasn’t given that choice, and there is no data source called “InfluxDB”. I’m fairly certain that was the point where things went wrong.

EDIT2: it seems to get worse - I re-added my App2 data source and this time tried to create a manual dashboard, starting with a Graph widget. I was unable to get it to show any data. I saved and went back to check my data source (seemed OK) - when I went back to the saved dashboard and tried to edit the Graph widget, I just get a blank screen (side bar and headers are there, nothing else is). The config for this widget seems to be completely inaccessible now. In fact I can’t create any more widgets on this dashboard - every attempt results in a (mostly) blank screen. Unfortunately removing the second Data Source doesn’t bring this dashboard back to life - it’s in a very bad state.

I now strongly suspect that having two InfluxDB data sources is a very bad idea with this version of Grafana, unfortunately.