You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@devlake.apache.org by "sungkangaw (via GitHub)" <gi...@apache.org> on 2025/02/24 08:09:03 UTC

[I] [Bug][github_graphql] Incorrect dora calculation based on github deployments updated_at [incubator-devlake]

sungkangaw opened a new issue, #8302:
URL: https://github.com/apache/incubator-devlake/issues/8302

   ### Search before asking
   
   - [x] I had searched in the [issues](https://github.com/apache/incubator-devlake/issues?q=is%3Aissue) and found no similar issues.
   
   
   ### What happened
   
   We currently sync deployment data using github deployments. When the deployment is the latest deployment (active), there is no problem. But when syncing historical deployment data i.e. projects have run for some time and we are just setting up devlake project for it or recollect data in full refresh mode, we notice that incidents are not matched to the right deployments, lead time is not correct, consequently then also change failure rate and recovery time.
   
   After looking through the code, we found out for github deployments, finished_date (which is the basis of all dora calculation) is mapped to github deployment updated_at here
   https://github.com/apache/incubator-devlake/blob/e061ef223a93a28d88bb1238a0acd7d29f39f2b6/backend/plugins/github_graphql/tasks/deployment_convertor.go#L93 
   For latest deployment this is no issue.
   But for old deployment, the updated_at can be the date that status is changed to inactive (changed when there is a new active deployment)
   ![Image](https://github.com/user-attachments/assets/6dcec992-a9da-438e-be3d-e439b76c42ef)
   
   This result in wrong calculation of dora as updated_at is not the actual finished_date of the deployment.
   
   
   ### What do you expect to happen
   
   Correct calculation of dora. 
   We are not quite sure yet, but my proposal would be instead of using updated_at field of github deployment object. The graphql query should retrieve the last status where state = success and use updated_at of the status instead. This way the actual finished_date of when status is success is captured.
   But please make a suggest if there is any better solution.
   
   ### How to reproduce
   
   1. Sync github deployments data. Make sure your repo have a few deployments already.
   2. Check the finished_date of these deployments. It is usually around the time of the created_date of the next deployment and also check dora graph.
   
   
   ### Anything else
   
   _No response_
   
   ### Version
   
   v1.0.1
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@devlake.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug][github_graphql] Incorrect dora calculation based on github deployments updated_at [incubator-devlake]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #8302:
URL: https://github.com/apache/incubator-devlake/issues/8302#issuecomment-2848311010

   This issue has been closed because it has been inactive for a long time. You can reopen it if you encounter the similar problem in the future.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug][github_graphql] Incorrect dora calculation based on github deployments updated_at [incubator-devlake]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #8302:
URL: https://github.com/apache/incubator-devlake/issues/8302#issuecomment-2831653583

   This issue has been automatically marked as stale because it has been inactive for 60 days. It will be closed in next 7 days if no further activity occurs.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug][github_graphql] Incorrect dora calculation based on github deployments updated_at [incubator-devlake]

Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #8302:
URL: https://github.com/apache/incubator-devlake/issues/8302#issuecomment-2677686301

   <!-- Greeting -->
   Hey @sungkangaw! 👋 I'm here to assist you with bug fixes, answer questions, and guide you on becoming a contributor. Let's squash those bugs together!
   
   <!-- Answer -->
   The issue you're experiencing with the DORA calculations is due to the `finished_date` being incorrectly mapped to the `updated_at` timestamp of GitHub deployments. This approach works for the latest deployments but causes inaccuracies for historical deployments, where `updated_at` may not reflect the actual completion time.
   
   To address this, your proposal to modify the GraphQL query to retrieve the last status where `state = success` and use its `updated_at` timestamp as the `finished_date` is a valid solution. This change would ensure that the `finished_date` accurately represents the time when the deployment was successfully completed, leading to more accurate DORA metrics calculations.
   
   Currently, the `finished_date` is set to the `UpdatedDate` of the `githubDeployment` in the `deployment_convertor.go` file <sup>[[1]](https://github.com/apache/incubator-devlake/blob/main/backend/plugins/github_graphql/tasks/deployment_convertor.go)</sup>. Adjusting the logic to use the `updated_at` of the last successful status would require changes in the GraphQL query and possibly the data processing logic to ensure the correct timestamp is used.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   
   ---
   <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/a14bd7af-7619-468f-8b1d-6a46d646b9c9?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/a14bd7af-7619-468f-8b1d-6a46d646b9c9?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/a14bd7af-7619-468f-8b1d-6a46d646b9c9?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/a14bd7af-7619-468f-8b1d-6a46d646b9c9?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/a14bd7af-7619-468f-8b1d-6a46d646b9c9?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/a14bd7af-7619-468f-8b1d-6a46d646b9c9?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/a14bd7af-7619-468f-8b1d-6a46d646b9c9?feedback_type=other)</sup>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug][github_graphql] Incorrect dora calculation based on github deployments updated_at [incubator-devlake]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed issue #8302: [Bug][github_graphql] Incorrect dora calculation based on github deployments updated_at
URL: https://github.com/apache/incubator-devlake/issues/8302


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org