You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by "vvshulga (via GitHub)" <gi...@apache.org> on 2024/10/17 13:28:08 UTC
[PR] fix(grafana): remove extra date condition that is applied together wi… [incubator-devlake]
vvshulga opened a new pull request, #8147:
URL: https://github.com/apache/incubator-devlake/pull/8147
### Summary
On some Grafana dashboards we are using 2 date conditions:
1) $__timeFilter(pr.created_date) AND
2) created_date >= DATE_ADD(DATE_ADD($__timeFrom(), INTERVAL -DAY($__timeFrom())+1 DAY), INTERVAL +1 MONTH)
second function return incorrect dates or dates in the future (especially for short interval <= 7 days).
$__timeFilter(date) filters correctly depends on selected date time range.
We have to remove this extra condition.
### Does this close any open issues?
Closes #8144
### Other Information
Several plugins: AzureDevops, Bamboo, BitBucket, GitHub, Gitlab, Jenkins use the same function
DATE_ADD(DATE_ADD($__timeFrom(), INTERVAL -DAY($__timeFrom())+1 DAY), INTERVAL +1 MONTH)
and there is comment [the following condition to remove the month with incomplete data](https://github.com/apache/incubator-devlake/blob/e856b603ef96b62a23c9834dc5ff4b7901115e3b/grafana/dashboards/Bamboo.json#L123), however, it's unclear how it works.
This PR does not touch plugins file, it should be clarified further.
--
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
Re: [PR] fix(grafana): remove extra date condition that is applied together wi… [incubator-devlake]
Posted by "Startrekzky (via GitHub)" <gi...@apache.org>.
Startrekzky commented on code in PR #8147:
URL: https://github.com/apache/incubator-devlake/pull/8147#discussion_r1808326919
##########
grafana/dashboards/DORADetails-LeadTimeforChanges.json:
##########
@@ -644,7 +644,7 @@
"hide": false,
"metricColumn": "none",
"rawQuery": true,
- "rawSql": "with _prs as(\n SELECT\n pr.id,\n pr.created_date as pr_issued_date,\n -- convert null to 0 if a PR has no deploy_time to make sure cycle_time equals the sum of the four sub-metrics\n\t\tcoalesce(prm.pr_deploy_time/60,0) as deploy_time\n FROM pull_requests pr\n left join project_pr_metrics prm on pr.id = prm.id\n join project_mapping pm on pr.base_repo_id = pm.row_id and pm.table = 'repos' \n WHERE\n $__timeFilter(pr.created_date)\n and pr.created_date >= DATE_ADD(DATE_ADD($__timeFrom(), INTERVAL -DAY($__timeFrom())+1 DAY), INTERVAL +1 MONTH)\n and pm.project_name in (${project})\n GROUP BY 1,2,3\n)\n\nSELECT \n avg(deploy_time) as 'PR Deploy Time(h)'\nFROM _prs",
+ "rawSql": "with _prs as(\n SELECT\n pr.id,\n pr.created_date as pr_issued_date,\n -- convert null to 0 if a PR has no deploy_time to make sure cycle_time equals the sum of the four sub-metrics\n\t\tcoalesce(prm.pr_deploy_time/60,0) as deploy_time\n FROM pull_requests pr\n left join project_pr_metrics prm on pr.id = prm.id\n join project_mapping pm on pr.base_repo_id = pm.row_id and pm.table = 'repos' \n WHERE\n $__timeFilter(pr.created_date)\n and pm.project_name in (${project})\n GROUP BY 1,2,3\n)\n\nSELECT \n avg(deploy_time) as 'PR Deploy Time(h)'\nFROM _prs",
Review Comment:
I agree that you can remove this condition in the 'stat' panels.
--
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
Re: [PR] fix(grafana): remove extra date condition that is applied together wi… [incubator-devlake]
Posted by "Startrekzky (via GitHub)" <gi...@apache.org>.
Startrekzky merged PR #8147:
URL: https://github.com/apache/incubator-devlake/pull/8147
--
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