feat: add community experience dashboard#2636
Conversation
| ] | ||
| } | ||
| ], | ||
| "title": "Issue Response Rate within SLA [Last Month]", |
There was a problem hiding this comment.
Add or comment_rank is null in the last line? Otherwise, the non-responded issue won't be calculated.
with issue_comment_list as(
select
i.id as issue_id,
i.url,
i.title,
i.created_date as issue_created_date,
ic.id as comment_id,
ic.created_date as comment_date,
ic.body,
case when ic.id is not null then rank() over (partition by i.id order by ic.created_date asc) else null end as comment_rank
from
lake.issues i
join lake.board_issues bi on i.id = bi.issue_id
join lake.boards b on bi.board_id = b.id
left join lake.issue_comments ic on i.id = ic.issue_id
where
date(i.created_date) BETWEEN
curdate() - INTERVAL DAYOFMONTH(curdate())-1 DAY - INTERVAL 1 month and
curdate() - INTERVAL DAYOFMONTH(curdate()) DAY
and b.id in ($repo_id)
)
select
100 * sum(case when (TIMESTAMPDIFF(MINUTE, issue_created_date,comment_date))/60 < $iir_sla then 1 else null end) / count(*)
from issue_comment_list
where comment_rank = 1 or comment_rank is null
| ] | ||
| } | ||
| ], | ||
| "title": "PR Resolution Rate within SLA [Last Month]", |
There was a problem hiding this comment.
Similar to Issue response time, shall we remove and status = 'closed? Otherwise, the opened PR will not be calculated.
select
100 * sum(case when TIMESTAMPDIFF(Minute, created_date, closed_date) / 1440 < $prrt_sla then 1 else 0 end) / count(*)
from
pull_requests pr
where
date(created_date) BETWEEN
curdate() - INTERVAL DAYOFMONTH(curdate())-1 DAY - INTERVAL 1 month and
curdate() - INTERVAL DAYOFMONTH(curdate()) DAY
and pr.base_repo_id in ($repo_id)
There was a problem hiding this comment.
Updated. Even though it's not necessary, I added closed_date to the condition to make the query easier to understand.
select
100 * sum(case when closed_date and TIMESTAMPDIFF(Minute, created_date, closed_date) / 1440 < $prrt_sla then 1 else 0 end) / count(*)
from
pull_requests pr
where
date(created_date) BETWEEN
curdate() - INTERVAL DAYOFMONTH(curdate())-1 DAY - INTERVAL 1 month and
curdate() - INTERVAL DAYOFMONTH(curdate()) DAY
and pr.base_repo_id in ($repo_id)
There was a problem hiding this comment.
Adding closed_date to the condition will affect the result of count(*) and the final result
| "metricColumn": "none", | ||
| "queryType": "randomWalk", | ||
| "rawQuery": true, | ||
| "rawSql": "select\n count(*)\nfrom\n lake.issues i\n join lake.board_issues bi on i.id = bi.issue_id\n join lake.boards b on bi.board_id = b.id\n join lake.issue_labels il on il.issue_id = i.id\nwhere\n il.label_name = \"$label_gfi\" and\n i.status != 'DONE' and\n b.id in ($repo_id)", |
There was a problem hiding this comment.
it's safer to count(distinct i.id) then count(*)
There was a problem hiding this comment.
count(distinct.id) is indeed more error tolerant, but it's also more prone to hiding data duplication bugs. Maybe we should go with count(*) here?
e421e95 to
3b2ebef
Compare
Add a new dashboard that computes 8 key metrics for dev experience in the community. Here's the metric list:
Issue Metrics:
PR Metrics:
Future work includes differentiating between community issues/PRs vs core team issues/PRs.
Example Screehshot: