You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by "hezyin (via GitHub)" <gi...@apache.org> on 2023/02/25 07:48:52 UTC

[GitHub] [incubator-devlake] hezyin opened a new issue, #4524: [Bug][GitHub dashboard] Outdated SQL queries due to PR status changes

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

   ### 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
   
   A user reported that  "PR closed W/O merging" metric in the GitHub dashboard is at 100%, which is obviously incorrect. I was able to reproduce the issue successfully on apache/incubator-devlake locally, and it appears that we changed the status of the merged PRs from "closed" to "merged", but the SQL queries for the dashboard were not updated.
   
   The problematic query is
   
   ```
   100 * count(distinct case when status = 'closed' and merged_date is null then id else null end)/count(distinct case when status = 'closed' then id else null end) as ratio
   ````
   
   I believe it needs to be updated to
   
   ```
   select
     count(distinct case when status = 'closed' then id else null end)/count(distinct case when status = 'closed' or status = 'merged' then id else null end) as ratio
   from 
   	pull_requests pr
   where
     $__timeFilter(created_date)
   	and base_repo_id in ($repo_id)
   ```
   
   And this is probably not the only query affected by the PR status change, we need to check every panel in the GitHub dashboard that has to do with PRs.
   
   The fix needs to be cherry-picked back to release-v0.15
   
   ### What do you expect to happen
   
   See above
   
   ### How to reproduce
   
   See above
   
   ### Anything else
   
   _No response_
   
   ### Version
   
   v0.15.0
   
   ### 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: commits-unsubscribe@devlake.apache.org.apache.org

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


[GitHub] [incubator-devlake] klesh commented on issue #4524: [Bug][GitHub dashboard] Outdated SQL queries due to PR status changes

Posted by "klesh (via GitHub)" <gi...@apache.org>.
klesh commented on issue #4524:
URL: https://github.com/apache/incubator-devlake/issues/4524#issuecomment-1445924735

   @hezyin Would you mind sharing the screenshot of the database?
   both `_tool_github_pull_requests` and `pull_requests`, thanks


-- 
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: commits-unsubscribe@devlake.apache.org

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


[GitHub] [incubator-devlake] Startrekzky commented on issue #4524: [Bug][GitHub dashboard] Outdated SQL queries due to PR status changes

Posted by "Startrekzky (via GitHub)" <gi...@apache.org>.
Startrekzky commented on issue #4524:
URL: https://github.com/apache/incubator-devlake/issues/4524#issuecomment-1449742096

   This bug happened because we changed GitHub collection method from GitHub REST APIs to GraphQL APIs in v0.15. The PR statuses changed.
   
   Each data source has its own PR statuses:
   - GitHub PR (from REST APIs): open, closed;
   - GitHub PR (from GraphQL APIs): OPEN, CLOSED, MERGED
   - GitLab MR: opened, closed, merged;
   - BitBucket PR: declined ( state=DECLINED ), open ( state=OPEN ) or merged ( state=MERGED )
   - Azure PR: succeeded, failed, pending, notSet, notApplicable, or error
   
   Since DevLake v0.16 hasn't standardized the PR statuses from different data sources. The solution to this issue is to modify the SQLs in Grafana so they can identify all `closed` or `merged` PRs from the above data sources. cc. @abeizn 


-- 
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: commits-unsubscribe@devlake.apache.org

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


[GitHub] [incubator-devlake] abeizn closed issue #4524: [Bug][GitHub dashboard] Outdated SQL queries due to PR status changes

Posted by "abeizn (via GitHub)" <gi...@apache.org>.
abeizn closed issue #4524: [Bug][GitHub dashboard] Outdated SQL queries due to PR status changes
URL: https://github.com/apache/incubator-devlake/issues/4524


-- 
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: commits-unsubscribe@devlake.apache.org

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