-
Notifications
You must be signed in to change notification settings - Fork 12.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provisioning: Remove provisioned dashboards without parental reader #26143
Provisioning: Remove provisioned dashboards without parental reader #26143
Conversation
bc66b95
to
26cf253
Compare
Nice! :) 🎆 I won't have time to review this as I'll be on vacation for a while but I'll make sure to help someone catching up on provisioning to be able to review this. |
Do you mind merging this with master, in order to include Drone CI configuration? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks generally good AFAICT, but I saw some things that should be fixed.
edacd35
to
5953e0f
Compare
@aknuds1 I applied your suggestions, moved commentary, and rebased the current branch on the master. The drone pipeline passed. |
Thanks @nabokihms. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good AFAICT, but I'll let @bergquist have his say since I'm new to the functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested it and works as expected. LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very sorry for the slow response. I dropped this completely. Things have been upside down since I got back from vacation :) Any chance you could address the minor comment in this PR? Otherwise I'll do it before 7.2 stable.
Cheers for your great work!
} | ||
|
||
for _, deleteDashCommand := range result { | ||
err := deleteDashboard(&models.DeleteDashboardCommand{Id: deleteDashCommand.DashboardId}, sess) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be great if we could move this deletion loop outside the inTransaction
wrapper. This could create very large transactions without any clear upsides. I suggest we query for potential dashboards to delete without a transaction and then delete each dashboard in its own transition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it makes sense. I have changed the DeleteOrphanedProvisionedDashboards
function behavior according to your suggestions. To make CI works, I also rebased the branch onto master.
074bb99
to
821a636
Compare
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
821a636
to
a2cf1fa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
The folder still says around in the database but that can be solved in another PR. Thank you for contributing and your patience :)
Signed-off-by: m.nabokikh maksim.nabokikh@flant.com
What this PR does / why we need it:
This PR adds deletion of provisioned dashboards, which have no link with provision reader configuration (or you can say, that they are orphan).
The deletion process starts on the Grafana load and occurs on every dashboard provision configuration reloading (requesting
/api/admin/provisioning/dashboards/reload
endpoint).Which issue(s) this PR fixes:
Fixes #15716
Special notes for your reviewer:
There are two problems:
providers[].disableDeletion
flag, because there is no information about previous file readers' settings in the database. In my opinion, to solve this problem we need to add a column to thedashboard_provisioning
table and store the information about dashboards deletion possibility in it.I also wanted to mention that I tried to reuse existed code as much as possible.