Open amartynov opened 1 month ago
Hey there, @amartynov! I'm here to help you with any bugs, questions, or contributions you have. Let's squash those bugs together! 🤖
To improve the performance of the DORA dashboard in Grafana, you can optimize the SQL queries by filtering counters by projects and dates. The solution you proposed is on the right track. By joining the incidents
and cicd_deployment_commits
tables with the project_mapping
table and applying the __timeFilter
macro, you can efficiently filter the data based on the selected projects and date range. This approach avoids joining full tables and should significantly reduce the query execution time.
Here's the optimized query you suggested:
SELECT
CASE
WHEN i.cnt = 0
AND cdc.cnt = 0 THEN 'No All'
WHEN i.cnt = 0 THEN 'No Incidents'
WHEN cdc.cnt = 0 THEN 'No Deployments'
END AS is_collected
FROM
(
select count(*) as cnt from incidents i
join project_mapping pm on i.scope_id = pm.row_id and pm.`table` = i.`table`
WHERE pm.project_name in (${project}) and $__timeFilter(i.created_date)
) AS i
LEFT JOIN (
select count(*) as cnt from cicd_deployment_commits cdc
JOIN project_mapping pm on cdc.cicd_scope_id = pm.row_id and pm.`table` = 'cicd_scopes'
WHERE pm.project_name in (${project}) and $__timeFilter(cdc.finished_date)
) as cdc ON 1 = 1
This query should help improve the performance of the DORA dashboard by ensuring that only relevant data is processed.
To continue talking to Dosu, mention @dosu.
Devlake version: v1.0.1-beta5
Performance issue
DORA dashboard. Panels
Overall DORA Metrics
andChange Failure Rate
, SQL queries take too long time to execute.SQL query part:
Investigation
Actual result: cost=113e+6
Solution
Avoid to join full tables
But I think that we should filter counters by projects and dates and the best solution should looks like: