apache / incubator-devlake

Apache DevLake is an open-source dev data platform to ingest, analyze, and visualize the fragmented data from DevOps tools, extracting insights for engineering excellence, developer experience, and community growth.
https://devlake.apache.org/
Apache License 2.0
2.6k stars 528 forks source link

fix(dora): change lead time calculator #8206

Open kostas-petrakis opened 2 days ago

kostas-petrakis commented 2 days ago

Summary

Fixes the issue where the project_pr_metrics link to wrong deployment when prev_success_deployment_commit_id is empty.

Does this close any open issues?

Closes #8188

Screenshots

I builded a local image, and re-run the data collection through my existing project, the results are now correct (compare with data from issue):

{
"project_pr_metrics": [
    {
        "id" : "github:GithubPullRequest:4:1806504909",
        "created_at" : "2024-11-20 17:06:50.350",
        "updated_at" : "2024-11-20 17:06:50.350",
        "_raw_data_params" : "",
        "_raw_data_table" : "",
        "_raw_data_id" : 0,
        "_raw_data_remark" : "",
        "project_name" : "*************",
        "first_commit_sha" : "3726ef9fce54e1f95717ab0fbe695403cbf850ff",
        "pr_coding_time" : 1,
        "first_review_id" : "github:GithubPrReview:4:1979264065",
        "pr_pickup_time" : 4,
        "pr_review_time" : 1429,
        "deployment_commit_id" : "github:GithubRun:4:435823930:8567339272:https:\/\/github.com\/****\/****",
        "pr_deploy_time" : 15,
        "pr_cycle_time" : 1449,
        "first_commit_authored_date" : "2024-04-04 09:07:51",
        "pr_created_date" : "2024-04-04 09:08:03",
        "first_comment_date" : "2024-04-04 09:11:44",
        "pr_merged_date" : "2024-04-05 09:00:16",
        "pr_deployed_date" : "2024-04-05 09:14:22"
    }
]}