Is it possible not to increment dashboard and connection ids on restoring? #209
-
|
Is your feature request related to a problem? Please describe. Now, on dashboards (or connections) upload, all dashboards/connections are just deleted in Grafana and then uploaded from scratch, thats's why their IDs are changed on every upload. If we are keeping them in GIT, we are getting new changes on every download after upload. Describe the solution you'd like IDs of already existing resources in Grafana should be kept on upload. If there is a way in grafana to specify IDs on resource creation - that's would be great. Describe alternatives you've considered |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 3 replies
-
Beta Was this translation helpful? Give feedback.
-
|
I wrote some hacky code to implement the ask above. One of the issues is that even if the UID is preserved, the ID has to be wiped out. There are two endpoints that are supported: The import endpoint: +++ b/test/data/org_1/dashboards/General/top-talkers-over-time.json
Since this might be valuable I'll change this to a conversation, but at this point, there is no pattern to fix this unless upstream changes. |
Beta Was this translation helpful? Give feedback.
-
|
Here's the hacky implementation, I yanked some of the code from testify for the JSON comparison. |
Beta Was this translation helpful? Give feedback.
-
|
As an option, if IDs in export files don't mean anything (id field is lost anyway on upload in current implementation), maybe you can provide an option to just fill them with some constants in export files? So export files won't change after every upload, because there will be |
Beta Was this translation helpful? Give feedback.
-
|
#211 Issue to track the requested behavior change. |
Beta Was this translation helpful? Give feedback.

@maxout123 if you are explicitly watching for changes in git, I don't think the preservIDs will fix this issue.
Even if the IDs don't change, I have a partial implementation of this, you end up with the version incrimenting. Even if there are no changes if you push a new dashboard, and pull it back down you'll get diffs like this: