chenwei791129 opened a new pull request, #9226:
URL: https://github.com/apache/devlake/pull/9226
### Summary
The five PR time panels (PR Cycle / Coding / Pickup / Review / Deploy Time)
of **Engineering Throughput and Cycle
Time** and its **Team View** take merged PRs from `pull_requests`, `LEFT
JOIN project_pr_metrics`, and
`coalesce(..., 0)` the metric. A merged PR without a `project_pr_metrics`
row was therefore averaged in as
**0 hours**. For a project without DORA enabled, every panel showed a flat 0
h.
This PR changes `LEFT JOIN project_pr_metrics` to `JOIN` in those 20 queries
(2 dashboards × 5 panels ×
MySQL/PostgreSQL). Nothing else in the SQL changes.
| Case | Before | After |
| --- | --- | --- |
| Some merged PRs have no row | Averaged in as 0 h, pulling the average down
| Excluded |
| No PR has a row (e.g. DORA disabled) | Flat 0 h | No data |
| Every merged PR has a row (DORA enabled) | — | Unchanged |
- `coalesce(..., 0)` is kept on purpose. A row can still have a NULL coding,
pickup, review or deploy time, and
those values are still treated as 0. All five panels still average over
the same set of PRs.
- The PostgreSQL files are edited by hand. For the main dashboard, the
result is identical to running
`grafana/scripts/convert-mysql-to-postgresql.py` on the updated MySQL
file. The PostgreSQL team view already
differs from the converter output (it uses `${team1:csv}` instead of
`${team1:singlequote}`), so regenerating
it would undo those edits.
### Does this close any open issues?
Closes #9225
### Screenshots
No layout changes. Query results are shown under Tests.
### Other Information
Not changed here: the join matches on `pr.id` only, while the primary key of
`project_pr_metrics` is
`(id, project_name)`. Every dashboard that reads this table joins the same
way.
### Tests
There are no automated tests for dashboard SQL. I ran the 10 panel queries
from `main` and from this branch
against MySQL 8 and PostgreSQL 17 with synthetic data, replacing the Grafana
macros with literal values:
| Project | Data | `main` | This PR |
| --- | --- | --- | --- |
| `p` | 2 PRs with rows (cycle time 14 h and 10 h), 1 PR without | PR Cycle
Time 8 h | 12 h |
| `q` | Merged PR, no rows (DORA disabled) | 0 h on all 10 panels | No rows
(No data) |
| `full` | Every PR has a row | — | Same as `main` on all 10 panels |
The results are the same on MySQL and PostgreSQL, for both dashboards. All
four JSON files parse.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]