Skip to content

Conversation

stephaniehingtgen
Copy link
Contributor

@stephaniehingtgen stephaniehingtgen commented May 27, 2025

What is this feature?

This PR reduces the number of database calls when provisioning dashboards via file based provisioning. Currently, we are only indexing the name of the provisioner, so we have to search all dashboards created under that provisioner name, and then do a query for each provisioned dashboard to get that dashboard's provisioning information. Since these calls happen by default every 10s, this can be significant on instances with a lot of provisioned dashboards. Now that we are looking at making things indexed, but not searchable (so it is not as expensive to add more fields - cc @chaudyg), we can add those to be indexed and reduce this to 1 db call.

To support this in mode 0-2, I had to update some databases function to return the provisioning data as well.

Additionally, I removed the concurrency on getting the provisioned dashboards. This is a background job, and people were seeing "too many connection" errors. While the other optimizations in this PR will fix it, we do not want to be exhausting db connections for background provisioning.

Why do we need this feature?

When instances have a large number of provisioned dashboards, this is hammering the database.

@stephaniehingtgen stephaniehingtgen force-pushed the dashboard-provisioning-reduce-db-load branch from df61ae1 to 174630e Compare May 28, 2025 03:46
@stephaniehingtgen stephaniehingtgen force-pushed the dashboard-provisioning-reduce-db-load branch from 287d2d6 to 23d7c09 Compare May 28, 2025 20:19
@stephaniehingtgen stephaniehingtgen marked this pull request as ready for review May 28, 2025 20:49
@stephaniehingtgen stephaniehingtgen requested review from a team as code owners May 28, 2025 20:49
@stephaniehingtgen stephaniehingtgen requested review from ferruvich and gassiss and removed request for a team May 28, 2025 20:49
@github-actions github-actions bot added this to the 12.1.x milestone May 28, 2025
@stephaniehingtgen stephaniehingtgen requested a review from ryantxu May 28, 2025 20:49
Copy link
Contributor

@ryantxu ryantxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ryantxu ryantxu merged commit ab99211 into main May 29, 2025
129 of 165 checks passed
@ryantxu ryantxu deleted the dashboard-provisioning-reduce-db-load branch May 29, 2025 06:39
@litetex
Copy link

litetex commented Jun 20, 2025

@stephaniehingtgen
Is this fix related to #105588?

YannickAlex07 pushed a commit to YannickAlex07/grafana that referenced this pull request Jul 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants