跳到主要内容
版本:v0.20

PR Coding Time

What is this metric?

The time it takes from the first commit until a PR is issued.

Why is it important?

It is recommended that you keep every task on a workable and manageable scale for a reasonably short amount of coding time. The average coding time of most engineering teams is around 3-4 days.

Which dashboard(s) does it exist in?

How is it calculated?

Data Sources Required

This metric relies on PRs/MRs collected from GitHub, GitLab, BitBucket, Gitee or other code review tools.

Data Transformation Required

N/A

SQL Queries

The following SQL shows how to find the coding time of a specific PR. DevLake pre-calculates the metric and stores it in table.project_pr_metrics.

SELECT
pr_coding_time/60 as 'PR Coding Time(h)'
FROM
project_pr_metrics

If you want to measure the monthly trend of PR coding time in the screenshot below, please run the following SQL in Grafana.

SELECT 
DATE_ADD(date(pr.created_date), INTERVAL -DAY(date(pr.created_date))+1 DAY) as time,
avg(ppm.pr_coding_time)/60 as 'PR Coding Time(h)'
FROM
pull_requests pr
JOIN project_pr_metrics ppm ON pr.id = ppm.id
GROUP BY 1
ORDER BY 1

How to improve?

Divide coding tasks into workable and manageable pieces.