Startrekzky commented on issue #8363:
URL:
https://github.com/apache/incubator-devlake/issues/8363#issuecomment-3047856078
@jeffschaper I can't reproduce this bug on my local env.
Could you
1. query the temp table `_failure_caused_by_deployments` and check if there
are records with `has_incident > 1`?
2. If so, please change the query to below and try it out.
```
-- Metric 3: change failure rate
with _deployments as (
SELECT
cdc.cicd_deployment_id as deployment_id,
max(cdc.finished_date) as deployment_finished_date,
pm.project_name
FROM
cicd_deployment_commits cdc
JOIN project_mapping pm on cdc.cicd_scope_id = pm.row_id
and pm.`table` = 'cicd_scopes'
WHERE
pm.project_name in (${project})
and cdc.result = 'SUCCESS'
and cdc.environment = 'PRODUCTION'
GROUP BY
1, 3
HAVING
$__timeFilter(max(cdc.finished_date))
),
_failure_caused_by_deployments as (
SELECT
d.deployment_id,
d.deployment_finished_date,
d.project_name,
**MAX(case when i.id is not null then 1 else 0 end) as has_incident**
FROM
_deployments d
left join project_incident_deployment_relationships pim on
d.deployment_id = pim.deployment_id
left join incidents i on pim.id = i.id
GROUP BY
1, 2, 3
)
SELECT
d.project_name,
sum(has_incident) / count(deployment_id) as "change_failure_rate"
FROM
_failure_caused_by_deployments d
GROUP BY
d.project_name
```
If the second step solves your problem, feel free to put up a PR to address
this. Don't forget to update the SQL of 'Change Failure Rate' in the DORA
dashboard as well.
--
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]