From 6093183e73e0de353f1f6750253180ea87b813a9 Mon Sep 17 00:00:00 2001 From: zhou-yinyuan Date: Mon, 29 Jul 2024 17:05:07 +0800 Subject: [PATCH] ADM-983 [frontend][backend]: rename dev mean time to recovery and dev change failure rate to pipeline mean time to recovery and pipeline change failure rate --- .../report/dto/request/MetricEnum.java | 11 +- ...java => AvgPipelineChangeFailureRate.java} | 2 +- ...ava => AvgPipelineMeanTimeToRecovery.java} | 2 +- ...te.java => PipelineChangeFailureRate.java} | 6 +- ... PipelineChangeFailureRateOfPipeline.java} | 2 +- ...y.java => PipelineMeanTimeToRecovery.java} | 6 +- ...PipelineMeanTimeToRecoveryOfPipeline.java} | 2 +- .../report/dto/response/ReportResponse.java | 4 +- .../service/report/CSVFileGenerator.java | 76 +++++----- .../report/GenerateReporterService.java | 20 +-- .../DevChangeFailureRateCalculator.java | 64 --------- .../PipelineChangeFailureRateCalculator.java | 66 +++++++++ ... => PipelineMeanToRecoveryCalculator.java} | 30 ++-- .../main/java/heartbeat/util/MetricsUtil.java | 3 +- .../controller/report/reportResponse.json | 12 +- .../service/report/CSVFileGeneratorTest.java | 76 +++++----- .../report/GenerateReporterServiceTest.java | 44 +++--- .../service/report/MetricCsvFixture.java | 48 +++---- ...PipelineMeanToRecoveryCalculatorTest.java} | 60 ++++---- ...lculatePipelineChangeFailureRateTest.java} | 39 ++--- .../java/heartbeat/util/MetricsUtilTest.java | 4 +- .../constants/fileConfig/fileConfig.test.ts | 11 ++ .../containers/ConfigStep/BasicInfo.test.tsx | 15 +- .../ReportStep/ReportDetail/dora.test.tsx | 28 ++-- .../containers/ReportStep/ReportStep.test.tsx | 8 +- .../ShareReport/ShareReport.test.tsx | 8 +- frontend/__tests__/fixtures.ts | 52 +++---- .../reportMapper/changeFailureRate.test.tsx | 14 +- .../reportMapper/meanTimeToRecovery.test.tsx | 38 ++--- .../hooks/reportMapper/report.test.tsx | 4 +- .../create-new/board-20240607-20240607.csv | 12 +- .../e2e/fixtures/create-new/config-step.ts | 4 +- .../create-new/metric-20240603-20240604.csv | 4 +- .../create-new/metric-20240605-20240606.csv | 4 +- .../create-new/metric-20240607-20240607.csv | 4 +- .../e2e/fixtures/create-new/metrics-step.ts | 4 +- .../e2e/fixtures/create-new/report-result.ts | 8 +- .../e2e/fixtures/import-file/chart-result.ts | 8 +- .../import-file/metric-with-holiday-data.csv | 4 +- frontend/e2e/pages/metrics/report-step.ts | 135 +++++++++--------- .../import-project-from-file.spec.ts | 2 +- .../e2e/specs/side-path/unhappy-path.spec.ts | 2 +- frontend/src/clients/report/ReportClient.ts | 8 +- frontend/src/clients/report/dto/response.ts | 24 ++-- .../Common/ReportForTwoColumns/index.tsx | 2 +- frontend/src/constants/fileConfig.ts | 13 ++ frontend/src/constants/resources.ts | 24 ++-- .../src/containers/ConfigStep/Form/literal.ts | 4 +- frontend/src/containers/MetricsStep/index.tsx | 4 +- .../src/containers/MetricsStepper/index.tsx | 4 +- .../ReportStep/DoraMetrics/index.tsx | 18 +-- .../ReportStep/DoraMetricsChart/index.tsx | 30 ++-- .../ReportStep/ReportDetail/dora.tsx | 4 +- frontend/src/context/config/configSlice.ts | 8 +- .../reportMapper/devChangeFailureRate.ts | 16 +-- .../reportMapper/devMeanTimeToRecovery.ts | 16 +-- frontend/src/hooks/reportMapper/report.ts | 18 +-- 57 files changed, 595 insertions(+), 544 deletions(-) rename backend/src/main/java/heartbeat/controller/report/dto/response/{AvgDevChangeFailureRate.java => AvgPipelineChangeFailureRate.java} (89%) rename backend/src/main/java/heartbeat/controller/report/dto/response/{AvgDevMeanTimeToRecovery.java => AvgPipelineMeanTimeToRecovery.java} (88%) rename backend/src/main/java/heartbeat/controller/report/dto/response/{DevChangeFailureRate.java => PipelineChangeFailureRate.java} (55%) rename backend/src/main/java/heartbeat/controller/report/dto/response/{DevChangeFailureRateOfPipeline.java => PipelineChangeFailureRateOfPipeline.java} (87%) rename backend/src/main/java/heartbeat/controller/report/dto/response/{DevMeanTimeToRecovery.java => PipelineMeanTimeToRecovery.java} (54%) rename backend/src/main/java/heartbeat/controller/report/dto/response/{DevMeanTimeToRecoveryOfPipeline.java => PipelineMeanTimeToRecoveryOfPipeline.java} (86%) delete mode 100644 backend/src/main/java/heartbeat/service/report/calculator/DevChangeFailureRateCalculator.java create mode 100644 backend/src/main/java/heartbeat/service/report/calculator/PipelineChangeFailureRateCalculator.java rename backend/src/main/java/heartbeat/service/report/calculator/{MeanToRecoveryCalculator.java => PipelineMeanToRecoveryCalculator.java} (71%) rename backend/src/test/java/heartbeat/service/report/{MeanToRecoveryCalculatorTest.java => PipelineMeanToRecoveryCalculatorTest.java} (74%) rename backend/src/test/java/heartbeat/service/report/calculator/{CalculateDevChangeFailureRateTest.java => CalculatePipelineChangeFailureRateTest.java} (53%) diff --git a/backend/src/main/java/heartbeat/controller/report/dto/request/MetricEnum.java b/backend/src/main/java/heartbeat/controller/report/dto/request/MetricEnum.java index caf477f831..1a6576ea47 100644 --- a/backend/src/main/java/heartbeat/controller/report/dto/request/MetricEnum.java +++ b/backend/src/main/java/heartbeat/controller/report/dto/request/MetricEnum.java @@ -1,10 +1,13 @@ package heartbeat.controller.report.dto.request; +import lombok.Getter; + +@Getter public enum MetricEnum { VELOCITY("velocity"), CYCLE_TIME("cycle time"), CLASSIFICATION("classification"), - DEPLOYMENT_FREQUENCY("deployment frequency"), DEV_CHANGE_FAILURE_RATE("dev change failure rate"), - DEV_MEAN_TIME_TO_RECOVERY("dev mean time to recovery"), LEAD_TIME_FOR_CHANGES("lead time for changes"), + DEPLOYMENT_FREQUENCY("deployment frequency"), PIPELINE_CHANGE_FAILURE_RATE("pipeline change failure rate"), + PIPELINE_MEAN_TIME_TO_RECOVERY("pipeline mean time to recovery"), LEAD_TIME_FOR_CHANGES("lead time for changes"), REWORK_TIMES("rework times"); private final String value; @@ -13,8 +16,4 @@ public enum MetricEnum { this.value = value; } - public String getValue() { - return value; - } - } diff --git a/backend/src/main/java/heartbeat/controller/report/dto/response/AvgDevChangeFailureRate.java b/backend/src/main/java/heartbeat/controller/report/dto/response/AvgPipelineChangeFailureRate.java similarity index 89% rename from backend/src/main/java/heartbeat/controller/report/dto/response/AvgDevChangeFailureRate.java rename to backend/src/main/java/heartbeat/controller/report/dto/response/AvgPipelineChangeFailureRate.java index fa3c4c6b10..18c9d3b56c 100644 --- a/backend/src/main/java/heartbeat/controller/report/dto/response/AvgDevChangeFailureRate.java +++ b/backend/src/main/java/heartbeat/controller/report/dto/response/AvgPipelineChangeFailureRate.java @@ -9,7 +9,7 @@ @Builder @NoArgsConstructor @AllArgsConstructor -public class AvgDevChangeFailureRate { +public class AvgPipelineChangeFailureRate { @Builder.Default private String name = "Average"; diff --git a/backend/src/main/java/heartbeat/controller/report/dto/response/AvgDevMeanTimeToRecovery.java b/backend/src/main/java/heartbeat/controller/report/dto/response/AvgPipelineMeanTimeToRecovery.java similarity index 88% rename from backend/src/main/java/heartbeat/controller/report/dto/response/AvgDevMeanTimeToRecovery.java rename to backend/src/main/java/heartbeat/controller/report/dto/response/AvgPipelineMeanTimeToRecovery.java index ea5258f02c..36d301993b 100644 --- a/backend/src/main/java/heartbeat/controller/report/dto/response/AvgDevMeanTimeToRecovery.java +++ b/backend/src/main/java/heartbeat/controller/report/dto/response/AvgPipelineMeanTimeToRecovery.java @@ -10,7 +10,7 @@ @NoArgsConstructor @AllArgsConstructor @Builder -public class AvgDevMeanTimeToRecovery { +public class AvgPipelineMeanTimeToRecovery { @Builder.Default private String name = "Total"; diff --git a/backend/src/main/java/heartbeat/controller/report/dto/response/DevChangeFailureRate.java b/backend/src/main/java/heartbeat/controller/report/dto/response/PipelineChangeFailureRate.java similarity index 55% rename from backend/src/main/java/heartbeat/controller/report/dto/response/DevChangeFailureRate.java rename to backend/src/main/java/heartbeat/controller/report/dto/response/PipelineChangeFailureRate.java index 8b9ee253b6..dc0187fdc0 100644 --- a/backend/src/main/java/heartbeat/controller/report/dto/response/DevChangeFailureRate.java +++ b/backend/src/main/java/heartbeat/controller/report/dto/response/PipelineChangeFailureRate.java @@ -11,10 +11,10 @@ @Builder @NoArgsConstructor @AllArgsConstructor -public class DevChangeFailureRate { +public class PipelineChangeFailureRate { - private AvgDevChangeFailureRate avgDevChangeFailureRate; + private AvgPipelineChangeFailureRate avgPipelineChangeFailureRate; - private List devChangeFailureRateOfPipelines; + private List pipelineChangeFailureRateOfPipelines; } diff --git a/backend/src/main/java/heartbeat/controller/report/dto/response/DevChangeFailureRateOfPipeline.java b/backend/src/main/java/heartbeat/controller/report/dto/response/PipelineChangeFailureRateOfPipeline.java similarity index 87% rename from backend/src/main/java/heartbeat/controller/report/dto/response/DevChangeFailureRateOfPipeline.java rename to backend/src/main/java/heartbeat/controller/report/dto/response/PipelineChangeFailureRateOfPipeline.java index bd74a96871..48440ddee5 100644 --- a/backend/src/main/java/heartbeat/controller/report/dto/response/DevChangeFailureRateOfPipeline.java +++ b/backend/src/main/java/heartbeat/controller/report/dto/response/PipelineChangeFailureRateOfPipeline.java @@ -9,7 +9,7 @@ @Builder @NoArgsConstructor @AllArgsConstructor -public class DevChangeFailureRateOfPipeline { +public class PipelineChangeFailureRateOfPipeline { private String name; diff --git a/backend/src/main/java/heartbeat/controller/report/dto/response/DevMeanTimeToRecovery.java b/backend/src/main/java/heartbeat/controller/report/dto/response/PipelineMeanTimeToRecovery.java similarity index 54% rename from backend/src/main/java/heartbeat/controller/report/dto/response/DevMeanTimeToRecovery.java rename to backend/src/main/java/heartbeat/controller/report/dto/response/PipelineMeanTimeToRecovery.java index 8c0a30270c..be93985664 100644 --- a/backend/src/main/java/heartbeat/controller/report/dto/response/DevMeanTimeToRecovery.java +++ b/backend/src/main/java/heartbeat/controller/report/dto/response/PipelineMeanTimeToRecovery.java @@ -10,10 +10,10 @@ @NoArgsConstructor @AllArgsConstructor @Builder -public class DevMeanTimeToRecovery { +public class PipelineMeanTimeToRecovery { - private AvgDevMeanTimeToRecovery avgDevMeanTimeToRecovery; + private AvgPipelineMeanTimeToRecovery avgPipelineMeanTimeToRecovery; - private List devMeanTimeToRecoveryOfPipelines; + private List pipelineMeanTimeToRecoveryOfPipelines; } diff --git a/backend/src/main/java/heartbeat/controller/report/dto/response/DevMeanTimeToRecoveryOfPipeline.java b/backend/src/main/java/heartbeat/controller/report/dto/response/PipelineMeanTimeToRecoveryOfPipeline.java similarity index 86% rename from backend/src/main/java/heartbeat/controller/report/dto/response/DevMeanTimeToRecoveryOfPipeline.java rename to backend/src/main/java/heartbeat/controller/report/dto/response/PipelineMeanTimeToRecoveryOfPipeline.java index 2462864884..91bbde4c66 100644 --- a/backend/src/main/java/heartbeat/controller/report/dto/response/DevMeanTimeToRecoveryOfPipeline.java +++ b/backend/src/main/java/heartbeat/controller/report/dto/response/PipelineMeanTimeToRecoveryOfPipeline.java @@ -11,7 +11,7 @@ @NoArgsConstructor @AllArgsConstructor @Builder -public class DevMeanTimeToRecoveryOfPipeline { +public class PipelineMeanTimeToRecoveryOfPipeline { private String name; diff --git a/backend/src/main/java/heartbeat/controller/report/dto/response/ReportResponse.java b/backend/src/main/java/heartbeat/controller/report/dto/response/ReportResponse.java index 2ea152555c..d266467711 100644 --- a/backend/src/main/java/heartbeat/controller/report/dto/response/ReportResponse.java +++ b/backend/src/main/java/heartbeat/controller/report/dto/response/ReportResponse.java @@ -21,9 +21,9 @@ public class ReportResponse { private DeploymentFrequency deploymentFrequency; - private DevChangeFailureRate devChangeFailureRate; + private PipelineChangeFailureRate pipelineChangeFailureRate; - private DevMeanTimeToRecovery devMeanTimeToRecovery; + private PipelineMeanTimeToRecovery pipelineMeanTimeToRecovery; private LeadTimeForChanges leadTimeForChanges; diff --git a/backend/src/main/java/heartbeat/service/report/CSVFileGenerator.java b/backend/src/main/java/heartbeat/service/report/CSVFileGenerator.java index 6e58ec657e..9f254409d4 100644 --- a/backend/src/main/java/heartbeat/service/report/CSVFileGenerator.java +++ b/backend/src/main/java/heartbeat/service/report/CSVFileGenerator.java @@ -3,12 +3,14 @@ import com.google.gson.JsonArray; import com.google.gson.JsonElement; import heartbeat.client.dto.pipeline.buildkite.BuildKiteBuildInfo; +import heartbeat.controller.report.dto.response.PipelineChangeFailureRateOfPipeline; +import heartbeat.controller.report.dto.response.PipelineMeanTimeToRecovery; import heartbeat.repository.FilePrefixType; import heartbeat.controller.board.dto.response.JiraCardDTO; import heartbeat.controller.report.dto.request.ReportType; import heartbeat.controller.report.dto.response.AvgDeploymentFrequency; -import heartbeat.controller.report.dto.response.AvgDevChangeFailureRate; -import heartbeat.controller.report.dto.response.AvgDevMeanTimeToRecovery; +import heartbeat.controller.report.dto.response.AvgPipelineChangeFailureRate; +import heartbeat.controller.report.dto.response.AvgPipelineMeanTimeToRecovery; import heartbeat.controller.report.dto.response.AvgLeadTimeForChanges; import heartbeat.controller.report.dto.response.BoardCSVConfig; import heartbeat.controller.report.dto.response.BoardCSVConfigEnum; @@ -18,10 +20,8 @@ import heartbeat.controller.report.dto.response.CycleTimeForSelectedStepItem; import heartbeat.controller.report.dto.response.DeploymentFrequency; import heartbeat.controller.report.dto.response.DeploymentFrequencyOfPipeline; -import heartbeat.controller.report.dto.response.DevChangeFailureRate; -import heartbeat.controller.report.dto.response.DevChangeFailureRateOfPipeline; -import heartbeat.controller.report.dto.response.DevMeanTimeToRecovery; -import heartbeat.controller.report.dto.response.DevMeanTimeToRecoveryOfPipeline; +import heartbeat.controller.report.dto.response.PipelineChangeFailureRate; +import heartbeat.controller.report.dto.response.PipelineMeanTimeToRecoveryOfPipeline; import heartbeat.controller.report.dto.response.LeadTimeForChanges; import heartbeat.controller.report.dto.response.LeadTimeForChangesOfPipelines; import heartbeat.controller.report.dto.response.LeadTimeInfo; @@ -367,13 +367,13 @@ private List convertReportResponseToCSVRows(ReportResponse reportRespo if (leadTimeForChanges != null) rows.addAll(getRowsFromLeadTimeForChanges(leadTimeForChanges)); - DevChangeFailureRate devChangeFailureRate = reportResponse.getDevChangeFailureRate(); - if (devChangeFailureRate != null) - rows.addAll(getRowsFromDevChangeFailureRate(devChangeFailureRate)); + PipelineChangeFailureRate pipelineChangeFailureRate = reportResponse.getPipelineChangeFailureRate(); + if (pipelineChangeFailureRate != null) + rows.addAll(getRowsFromPipelineChangeFailureRate(pipelineChangeFailureRate)); - DevMeanTimeToRecovery devMeanTimeToRecovery = reportResponse.getDevMeanTimeToRecovery(); - if (devMeanTimeToRecovery != null) - rows.addAll(getRowsFromDevMeanTimeToRecovery(devMeanTimeToRecovery)); + PipelineMeanTimeToRecovery pipelineMeanTimeToRecovery = reportResponse.getPipelineMeanTimeToRecovery(); + if (pipelineMeanTimeToRecovery != null) + rows.addAll(getRowsFromPipelineMeanTimeToRecovery(pipelineMeanTimeToRecovery)); return rows; } @@ -520,38 +520,44 @@ private List getRowsFromLeadTimeForChanges(LeadTimeForChanges leadTime return rows; } - private List getRowsFromDevChangeFailureRate(DevChangeFailureRate devChangeFailureRate) { + private List getRowsFromPipelineChangeFailureRate(PipelineChangeFailureRate pipelineChangeFailureRate) { List rows = new ArrayList<>(); - List devChangeFailureRateOfPipelines = devChangeFailureRate - .getDevChangeFailureRateOfPipelines(); - devChangeFailureRateOfPipelines.forEach(pipeline -> rows.add(new String[] { "Dev change failure rate", - pipeline.getName() + " / " + extractPipelineStep(pipeline.getStep()) + " / Dev change failure rate", + List pipelineChangeFailureRateOfPipelines = pipelineChangeFailureRate + .getPipelineChangeFailureRateOfPipelines(); + pipelineChangeFailureRateOfPipelines.forEach(pipeline -> rows.add(new String[] { "Pipeline change failure rate", + pipeline.getName() + " / " + extractPipelineStep(pipeline.getStep()) + + " / Pipeline change failure rate", DecimalUtil.formatDecimalFour(pipeline.getFailureRate()) })); - AvgDevChangeFailureRate avgDevChangeFailureRate = devChangeFailureRate.getAvgDevChangeFailureRate(); - if (devChangeFailureRateOfPipelines.size() > 1) - rows.add(new String[] { "Dev change failure rate", - avgDevChangeFailureRate.getName() + " / Dev change failure rate", - DecimalUtil.formatDecimalTwo(avgDevChangeFailureRate.getFailureRate() * 100) }); + AvgPipelineChangeFailureRate avgPipelineChangeFailureRate = pipelineChangeFailureRate + .getAvgPipelineChangeFailureRate(); + if (pipelineChangeFailureRateOfPipelines.size() > 1) + rows.add(new String[] { "Pipeline change failure rate", + avgPipelineChangeFailureRate.getName() + " / Pipeline change failure rate", + DecimalUtil.formatDecimalTwo(avgPipelineChangeFailureRate.getFailureRate() * 100) }); return rows; } - private List getRowsFromDevMeanTimeToRecovery(DevMeanTimeToRecovery devMeanTimeToRecovery) { + private List getRowsFromPipelineMeanTimeToRecovery( + PipelineMeanTimeToRecovery pipelineMeanTimeToRecovery) { List rows = new ArrayList<>(); - List devMeanTimeToRecoveryOfPipelines = devMeanTimeToRecovery - .getDevMeanTimeToRecoveryOfPipelines(); - devMeanTimeToRecoveryOfPipelines.forEach(pipeline -> rows.add(new String[] { "Dev mean time to recovery", - pipeline.getName() + " / " + extractPipelineStep(pipeline.getStep()) + " / Dev mean time to recovery", - DecimalUtil - .formatDecimalTwo(TimeUtils.millisToUnit(pipeline.getTimeToRecovery().doubleValue(), HOURS)) })); - - AvgDevMeanTimeToRecovery avgDevMeanTimeToRecovery = devMeanTimeToRecovery.getAvgDevMeanTimeToRecovery(); - if (devMeanTimeToRecoveryOfPipelines.size() > 1) - rows.add(new String[] { "Dev mean time to recovery", - avgDevMeanTimeToRecovery.getName() + " / Dev mean time to recovery", + List pipelineMeanTimeToRecoveryOfPipelines = pipelineMeanTimeToRecovery + .getPipelineMeanTimeToRecoveryOfPipelines(); + pipelineMeanTimeToRecoveryOfPipelines + .forEach(pipeline -> rows.add(new String[] { "Pipeline mean time to recovery", + pipeline.getName() + " / " + extractPipelineStep(pipeline.getStep()) + + " / Pipeline mean time to recovery", + DecimalUtil.formatDecimalTwo( + TimeUtils.millisToUnit(pipeline.getTimeToRecovery().doubleValue(), HOURS)) })); + + AvgPipelineMeanTimeToRecovery avgPipelineMeanTimeToRecovery = pipelineMeanTimeToRecovery + .getAvgPipelineMeanTimeToRecovery(); + if (pipelineMeanTimeToRecoveryOfPipelines.size() > 1) + rows.add(new String[] { "Pipeline mean time to recovery", + avgPipelineMeanTimeToRecovery.getName() + " / Pipeline mean time to recovery", DecimalUtil.formatDecimalTwo(TimeUtils - .millisToUnit(avgDevMeanTimeToRecovery.getTimeToRecovery().doubleValue(), HOURS)) }); + .millisToUnit(avgPipelineMeanTimeToRecovery.getTimeToRecovery().doubleValue(), HOURS)) }); return rows; } diff --git a/backend/src/main/java/heartbeat/service/report/GenerateReporterService.java b/backend/src/main/java/heartbeat/service/report/GenerateReporterService.java index d727474da8..1b5524ae4a 100644 --- a/backend/src/main/java/heartbeat/service/report/GenerateReporterService.java +++ b/backend/src/main/java/heartbeat/service/report/GenerateReporterService.java @@ -21,9 +21,9 @@ import heartbeat.service.report.calculator.ClassificationCalculator; import heartbeat.service.report.calculator.CycleTimeCalculator; import heartbeat.service.report.calculator.DeploymentFrequencyCalculator; -import heartbeat.service.report.calculator.DevChangeFailureRateCalculator; +import heartbeat.service.report.calculator.PipelineChangeFailureRateCalculator; import heartbeat.service.report.calculator.LeadTimeForChangesCalculator; -import heartbeat.service.report.calculator.MeanToRecoveryCalculator; +import heartbeat.service.report.calculator.PipelineMeanToRecoveryCalculator; import heartbeat.service.report.calculator.ReworkCalculator; import heartbeat.service.report.calculator.VelocityCalculator; import heartbeat.service.report.calculator.model.FetchedData; @@ -60,9 +60,9 @@ public class GenerateReporterService { private final DeploymentFrequencyCalculator deploymentFrequency; - private final DevChangeFailureRateCalculator devChangeFailureRate; + private final PipelineChangeFailureRateCalculator pipelineChangeFailureRate; - private final MeanToRecoveryCalculator meanToRecoveryCalculator; + private final PipelineMeanToRecoveryCalculator pipelineMeanToRecoveryCalculator; private final CycleTimeCalculator cycleTimeCalculator; @@ -184,9 +184,9 @@ private synchronized ReportResponse generatePipelineReporter(GenerateReportReque deploymentFrequency.calculate(fetchedData.getBuildKiteData().getDeployTimesList(), Long.parseLong(request.getStartTime()), Long.parseLong(request.getEndTime()), request.getCalendarType(), request.getTimezoneByZoneId())); - case "dev change failure rate" -> reportResponse.setDevChangeFailureRate( - devChangeFailureRate.calculate(fetchedData.getBuildKiteData().getDeployTimesList())); - default -> reportResponse.setDevMeanTimeToRecovery(meanToRecoveryCalculator + case "pipeline change failure rate" -> reportResponse.setPipelineChangeFailureRate( + pipelineChangeFailureRate.calculate(fetchedData.getBuildKiteData().getDeployTimesList())); + default -> reportResponse.setPipelineMeanTimeToRecovery(pipelineMeanToRecoveryCalculator .calculate(fetchedData.getBuildKiteData().getDeployTimesList(), request)); } }); @@ -363,8 +363,10 @@ private ReportResponse getComposedReportResponse(String uuid, String timeRangeAn .rework(getValueOrNull(boardReportResponse, ReportResponse::getRework)) .exportValidityTime(fileRepository.getExpiredTime()) .deploymentFrequency(getValueOrNull(pipelineReportResponse, ReportResponse::getDeploymentFrequency)) - .devChangeFailureRate(getValueOrNull(pipelineReportResponse, ReportResponse::getDevChangeFailureRate)) - .devMeanTimeToRecovery(getValueOrNull(pipelineReportResponse, ReportResponse::getDevMeanTimeToRecovery)) + .pipelineChangeFailureRate( + getValueOrNull(pipelineReportResponse, ReportResponse::getPipelineChangeFailureRate)) + .pipelineMeanTimeToRecovery( + getValueOrNull(pipelineReportResponse, ReportResponse::getPipelineMeanTimeToRecovery)) .leadTimeForChanges(getValueOrNull(sourceControlReportResponse, ReportResponse::getLeadTimeForChanges)) .boardMetricsCompleted(reportReadyStatus.boardMetricsCompleted()) .doraMetricsCompleted(reportReadyStatus.doraMetricsCompleted()) diff --git a/backend/src/main/java/heartbeat/service/report/calculator/DevChangeFailureRateCalculator.java b/backend/src/main/java/heartbeat/service/report/calculator/DevChangeFailureRateCalculator.java deleted file mode 100644 index 38c7247c07..0000000000 --- a/backend/src/main/java/heartbeat/service/report/calculator/DevChangeFailureRateCalculator.java +++ /dev/null @@ -1,64 +0,0 @@ -package heartbeat.service.report.calculator; - -import heartbeat.client.dto.pipeline.buildkite.DeployTimes; -import heartbeat.controller.report.dto.response.AvgDevChangeFailureRate; -import heartbeat.controller.report.dto.response.DevChangeFailureRate; -import heartbeat.controller.report.dto.response.DevChangeFailureRateOfPipeline; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Component; - -import java.text.DecimalFormat; -import java.util.List; - -@RequiredArgsConstructor -@Component -public class DevChangeFailureRateCalculator { - - private static final String FORMAT_4_DECIMALS = "0.0000"; - - private int totalCount = 0; - - private int totalFailureCount = 0; - - public DevChangeFailureRate calculate(List deployTimesList) { - DecimalFormat decimalFormat = new DecimalFormat(FORMAT_4_DECIMALS); - totalCount = 0; - totalFailureCount = 0; - - List devChangeFailureRateOfPipelines = deployTimesList.stream().map(item -> { - int failedTimesOfPipeline = item.getFailed().size(); - int validPassedTimesOfPipeline = (int) item.getPassed() - .stream() - .filter(deployInfo -> item.getPipelineStep().equals(deployInfo.getJobName())) - .count(); - int totalTimesOfPipeline = failedTimesOfPipeline + validPassedTimesOfPipeline; - - float failureRateOfPipeline = totalTimesOfPipeline == 0 ? 0 - : (float) failedTimesOfPipeline / totalTimesOfPipeline; - - totalCount += totalTimesOfPipeline; - totalFailureCount += failedTimesOfPipeline; - - return DevChangeFailureRateOfPipeline.builder() - .name(item.getPipelineName()) - .step(item.getPipelineStep()) - .failedTimesOfPipeline(failedTimesOfPipeline) - .totalTimesOfPipeline(totalTimesOfPipeline) - .failureRate(Float.parseFloat(decimalFormat.format(failureRateOfPipeline))) - .build(); - }).toList(); - - float avgFailureRate = totalCount == 0 ? 0 : (float) totalFailureCount / totalCount; - AvgDevChangeFailureRate avgDevChangeFailureRate = AvgDevChangeFailureRate.builder() - .totalTimes(totalCount) - .totalFailedTimes(totalFailureCount) - .failureRate(Float.parseFloat(decimalFormat.format(avgFailureRate))) - .build(); - - return DevChangeFailureRate.builder() - .avgDevChangeFailureRate(avgDevChangeFailureRate) - .devChangeFailureRateOfPipelines(devChangeFailureRateOfPipelines) - .build(); - } - -} diff --git a/backend/src/main/java/heartbeat/service/report/calculator/PipelineChangeFailureRateCalculator.java b/backend/src/main/java/heartbeat/service/report/calculator/PipelineChangeFailureRateCalculator.java new file mode 100644 index 0000000000..1d43505dae --- /dev/null +++ b/backend/src/main/java/heartbeat/service/report/calculator/PipelineChangeFailureRateCalculator.java @@ -0,0 +1,66 @@ +package heartbeat.service.report.calculator; + +import heartbeat.client.dto.pipeline.buildkite.DeployTimes; +import heartbeat.controller.report.dto.response.AvgPipelineChangeFailureRate; +import heartbeat.controller.report.dto.response.PipelineChangeFailureRate; +import heartbeat.controller.report.dto.response.PipelineChangeFailureRateOfPipeline; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +import java.text.DecimalFormat; +import java.util.List; + +@RequiredArgsConstructor +@Component +public class PipelineChangeFailureRateCalculator { + + private static final String FORMAT_4_DECIMALS = "0.0000"; + + private int totalCount = 0; + + private int totalFailureCount = 0; + + public PipelineChangeFailureRate calculate(List deployTimesList) { + DecimalFormat decimalFormat = new DecimalFormat(FORMAT_4_DECIMALS); + totalCount = 0; + totalFailureCount = 0; + + List pipelineChangeFailureRateOfPipelines = deployTimesList.stream() + .map(item -> { + int failedTimesOfPipeline = item.getFailed().size(); + int validPassedTimesOfPipeline = (int) item.getPassed() + .stream() + .filter(deployInfo -> item.getPipelineStep().equals(deployInfo.getJobName())) + .count(); + int totalTimesOfPipeline = failedTimesOfPipeline + validPassedTimesOfPipeline; + + float failureRateOfPipeline = totalTimesOfPipeline == 0 ? 0 + : (float) failedTimesOfPipeline / totalTimesOfPipeline; + + totalCount += totalTimesOfPipeline; + totalFailureCount += failedTimesOfPipeline; + + return PipelineChangeFailureRateOfPipeline.builder() + .name(item.getPipelineName()) + .step(item.getPipelineStep()) + .failedTimesOfPipeline(failedTimesOfPipeline) + .totalTimesOfPipeline(totalTimesOfPipeline) + .failureRate(Float.parseFloat(decimalFormat.format(failureRateOfPipeline))) + .build(); + }) + .toList(); + + float avgFailureRate = totalCount == 0 ? 0 : (float) totalFailureCount / totalCount; + AvgPipelineChangeFailureRate avgPipelineChangeFailureRate = AvgPipelineChangeFailureRate.builder() + .totalTimes(totalCount) + .totalFailedTimes(totalFailureCount) + .failureRate(Float.parseFloat(decimalFormat.format(avgFailureRate))) + .build(); + + return PipelineChangeFailureRate.builder() + .avgPipelineChangeFailureRate(avgPipelineChangeFailureRate) + .pipelineChangeFailureRateOfPipelines(pipelineChangeFailureRateOfPipelines) + .build(); + } + +} diff --git a/backend/src/main/java/heartbeat/service/report/calculator/MeanToRecoveryCalculator.java b/backend/src/main/java/heartbeat/service/report/calculator/PipelineMeanToRecoveryCalculator.java similarity index 71% rename from backend/src/main/java/heartbeat/service/report/calculator/MeanToRecoveryCalculator.java rename to backend/src/main/java/heartbeat/service/report/calculator/PipelineMeanToRecoveryCalculator.java index 478793c4ba..225fdb1afc 100644 --- a/backend/src/main/java/heartbeat/service/report/calculator/MeanToRecoveryCalculator.java +++ b/backend/src/main/java/heartbeat/service/report/calculator/PipelineMeanToRecoveryCalculator.java @@ -3,9 +3,9 @@ import heartbeat.client.dto.pipeline.buildkite.DeployInfo; import heartbeat.client.dto.pipeline.buildkite.DeployTimes; import heartbeat.controller.report.dto.request.GenerateReportRequest; -import heartbeat.controller.report.dto.response.AvgDevMeanTimeToRecovery; -import heartbeat.controller.report.dto.response.DevMeanTimeToRecovery; -import heartbeat.controller.report.dto.response.DevMeanTimeToRecoveryOfPipeline; +import heartbeat.controller.report.dto.response.AvgPipelineMeanTimeToRecovery; +import heartbeat.controller.report.dto.response.PipelineMeanTimeToRecovery; +import heartbeat.controller.report.dto.response.PipelineMeanTimeToRecoveryOfPipeline; import heartbeat.controller.report.dto.response.TotalTimeAndRecoveryTimes; import heartbeat.service.report.WorkDay; import lombok.RequiredArgsConstructor; @@ -24,34 +24,34 @@ @RequiredArgsConstructor @Component @Log4j2 -public class MeanToRecoveryCalculator { +public class PipelineMeanToRecoveryCalculator { private final WorkDay workDay; - public DevMeanTimeToRecovery calculate(List deployTimes, GenerateReportRequest request) { + public PipelineMeanTimeToRecovery calculate(List deployTimes, GenerateReportRequest request) { if (deployTimes.isEmpty()) { - return new DevMeanTimeToRecovery( - AvgDevMeanTimeToRecovery.builder().timeToRecovery(stripTrailingZeros(BigDecimal.ZERO)).build(), + return new PipelineMeanTimeToRecovery( + AvgPipelineMeanTimeToRecovery.builder().timeToRecovery(stripTrailingZeros(BigDecimal.ZERO)).build(), Collections.emptyList()); } - List devMeanTimeToRecoveryOfPipelines = deployTimes.stream() + List pipelineMeanTimeToRecoveryOfPipelines = deployTimes.stream() .map(it -> convertToDevMeanTimeToRecoveryOfPipeline(it, request)) .collect(Collectors.toList()); - BigDecimal avgDevMeanTimeToRecovery = devMeanTimeToRecoveryOfPipelines.stream() - .map(DevMeanTimeToRecoveryOfPipeline::getTimeToRecovery) + BigDecimal avgDevMeanTimeToRecovery = pipelineMeanTimeToRecoveryOfPipelines.stream() + .map(PipelineMeanTimeToRecoveryOfPipeline::getTimeToRecovery) .reduce(BigDecimal.ZERO, BigDecimal::add); - AvgDevMeanTimeToRecovery avgDevMeanTimeToRecoveryObj = AvgDevMeanTimeToRecovery.builder() + AvgPipelineMeanTimeToRecovery avgPipelineMeanTimeToRecoveryObj = AvgPipelineMeanTimeToRecovery.builder() .timeToRecovery(stripTrailingZeros(avgDevMeanTimeToRecovery)) .build(); - return new DevMeanTimeToRecovery(avgDevMeanTimeToRecoveryObj, devMeanTimeToRecoveryOfPipelines); + return new PipelineMeanTimeToRecovery(avgPipelineMeanTimeToRecoveryObj, pipelineMeanTimeToRecoveryOfPipelines); } - private DevMeanTimeToRecoveryOfPipeline convertToDevMeanTimeToRecoveryOfPipeline(DeployTimes deploy, + private PipelineMeanTimeToRecoveryOfPipeline convertToDevMeanTimeToRecoveryOfPipeline(DeployTimes deploy, GenerateReportRequest request) { if (deploy.getFailed().isEmpty()) { - return new DevMeanTimeToRecoveryOfPipeline(deploy.getPipelineName(), deploy.getPipelineStep(), + return new PipelineMeanTimeToRecoveryOfPipeline(deploy.getPipelineName(), deploy.getPipelineStep(), BigDecimal.ZERO); } else { @@ -61,7 +61,7 @@ private DevMeanTimeToRecoveryOfPipeline convertToDevMeanTimeToRecoveryOfPipeline devMeanTimeToRecovery = stripTrailingZeros(new BigDecimal(result.getTotalTimeToRecovery()) .divide(new BigDecimal(result.getRecoveryTimes()), 8, RoundingMode.HALF_UP)); } - return new DevMeanTimeToRecoveryOfPipeline(deploy.getPipelineName(), deploy.getPipelineStep(), + return new PipelineMeanTimeToRecoveryOfPipeline(deploy.getPipelineName(), deploy.getPipelineStep(), devMeanTimeToRecovery); } } diff --git a/backend/src/main/java/heartbeat/util/MetricsUtil.java b/backend/src/main/java/heartbeat/util/MetricsUtil.java index c81a6563fd..e07dd2efcd 100644 --- a/backend/src/main/java/heartbeat/util/MetricsUtil.java +++ b/backend/src/main/java/heartbeat/util/MetricsUtil.java @@ -17,7 +17,8 @@ public enum MetricsUtil { .toList()), BUILDKITE_METRICS(Stream - .of(MetricEnum.DEV_CHANGE_FAILURE_RATE, MetricEnum.DEPLOYMENT_FREQUENCY, MetricEnum.DEV_MEAN_TIME_TO_RECOVERY) + .of(MetricEnum.PIPELINE_CHANGE_FAILURE_RATE, MetricEnum.DEPLOYMENT_FREQUENCY, + MetricEnum.PIPELINE_MEAN_TIME_TO_RECOVERY) .map(MetricEnum::getValue) .toList()), diff --git a/backend/src/test/java/heartbeat/controller/report/reportResponse.json b/backend/src/test/java/heartbeat/controller/report/reportResponse.json index 863c783deb..6bfea00bfd 100644 --- a/backend/src/test/java/heartbeat/controller/report/reportResponse.json +++ b/backend/src/test/java/heartbeat/controller/report/reportResponse.json @@ -96,14 +96,14 @@ } ] }, - "devChangeFailureRate": { - "avgDevChangeFailureRate": { + "pipelineChangeFailureRate": { + "avgPipelineChangeFailureRate": { "name": "Average", "totalTimes": 56, "totalFailedTimes": 0, "failureRate": 0.0 }, - "devChangeFailureRateOfPipelines": [ + "pipelineChangeFailureRateOfPipelines": [ { "name": "Heartbeat", "step": ":lock: Check Security", @@ -113,12 +113,12 @@ } ] }, - "devMeanTimeToRecovery": { - "avgDevMeanTimeToRecovery": { + "pipelineMeanTimeToRecovery": { + "avgPipelineMeanTimeToRecovery": { "name": "Average", "timeToRecovery": 0 }, - "devMeanTimeToRecoveryOfPipelines": [ + "pipelineMeanTimeToRecoveryOfPipelines": [ { "timeToRecovery": 0, "name": "Heartbeat", diff --git a/backend/src/test/java/heartbeat/service/report/CSVFileGeneratorTest.java b/backend/src/test/java/heartbeat/service/report/CSVFileGeneratorTest.java index 27086d17c2..01d4e4c147 100644 --- a/backend/src/test/java/heartbeat/service/report/CSVFileGeneratorTest.java +++ b/backend/src/test/java/heartbeat/service/report/CSVFileGeneratorTest.java @@ -14,8 +14,8 @@ import heartbeat.controller.board.dto.response.StepsDay; import heartbeat.controller.report.dto.request.ReportType; import heartbeat.controller.report.dto.response.AvgDeploymentFrequency; -import heartbeat.controller.report.dto.response.AvgDevChangeFailureRate; -import heartbeat.controller.report.dto.response.AvgDevMeanTimeToRecovery; +import heartbeat.controller.report.dto.response.AvgPipelineChangeFailureRate; +import heartbeat.controller.report.dto.response.AvgPipelineMeanTimeToRecovery; import heartbeat.controller.report.dto.response.AvgLeadTimeForChanges; import heartbeat.controller.report.dto.response.BoardCSVConfig; import heartbeat.controller.report.dto.response.Classification; @@ -25,10 +25,10 @@ import heartbeat.controller.report.dto.response.DailyDeploymentCount; import heartbeat.controller.report.dto.response.DeploymentFrequency; import heartbeat.controller.report.dto.response.DeploymentFrequencyOfPipeline; -import heartbeat.controller.report.dto.response.DevChangeFailureRate; -import heartbeat.controller.report.dto.response.DevChangeFailureRateOfPipeline; -import heartbeat.controller.report.dto.response.DevMeanTimeToRecovery; -import heartbeat.controller.report.dto.response.DevMeanTimeToRecoveryOfPipeline; +import heartbeat.controller.report.dto.response.PipelineChangeFailureRate; +import heartbeat.controller.report.dto.response.PipelineChangeFailureRateOfPipeline; +import heartbeat.controller.report.dto.response.PipelineMeanTimeToRecovery; +import heartbeat.controller.report.dto.response.PipelineMeanTimeToRecoveryOfPipeline; import heartbeat.controller.report.dto.response.LeadTimeForChanges; import heartbeat.controller.report.dto.response.LeadTimeForChangesOfPipelines; import heartbeat.controller.report.dto.response.PipelineCSVInfo; @@ -245,12 +245,12 @@ void shouldConvertMetricDataToCsv() { { "Lead time for changes", "Average / PR Lead Time", "0" }, { "Lead time for changes", "Average / Pipeline Lead Time", "0.05" }, { "Lead time for changes", "Average / Total Lead Time", "0.05" }, - { "Dev change failure rate", "Heartbeat / Deploy prod / Dev change failure rate", "0.0000" }, - { "Dev change failure rate", "Heartbeat / Check Frontend License / Dev change failure rate", "0.0000" }, - { "Dev change failure rate", "Average / Dev change failure rate", "0" }, - { "Dev mean time to recovery", "Heartbeat / Deploy prod / Dev mean time to recovery", "0" }, - { "Dev mean time to recovery", "Heartbeat / Check Frontend License / Dev mean time to recovery", "0" }, - { "Dev mean time to recovery", "Total / Dev mean time to recovery", "0" }, }; + { "Pipeline change failure rate", "Heartbeat / Deploy prod / Pipeline change failure rate", "0.0000" }, + { "Pipeline change failure rate", "Heartbeat / Check Frontend License / Pipeline change failure rate", "0.0000" }, + { "Pipeline change failure rate", "Average / Pipeline change failure rate", "0" }, + { "Pipeline mean time to recovery", "Heartbeat / Deploy prod / Pipeline mean time to recovery", "0" }, + { "Pipeline mean time to recovery", "Heartbeat / Check Frontend License / Pipeline mean time to recovery", "0" }, + { "Pipeline mean time to recovery", "Total / Pipeline mean time to recovery", "0" }, }; csvFileGenerator.convertMetricDataToCSV(TEST_UUID, reportResponse, mockTimeStamp); @@ -414,22 +414,22 @@ void shouldHasContentWhenGetDataFromCsvGivenDataTypeIsMetric() { List.of(DailyDeploymentCount.builder().date("10/16/2023").count(1).build())) .build())) .build()) - .devChangeFailureRate(DevChangeFailureRate.builder() - .avgDevChangeFailureRate(AvgDevChangeFailureRate.builder() + .pipelineChangeFailureRate(PipelineChangeFailureRate.builder() + .avgPipelineChangeFailureRate(AvgPipelineChangeFailureRate.builder() .name("Average") .totalTimes(12) .totalFailedTimes(0) .failureRate(0.0F) .build()) - .devChangeFailureRateOfPipelines(List.of( - DevChangeFailureRateOfPipeline.builder() + .pipelineChangeFailureRateOfPipelines(List.of( + PipelineChangeFailureRateOfPipeline.builder() .name("Heartbeat") .step(":rocket: Deploy prod") .failedTimesOfPipeline(0) .totalTimesOfPipeline(7) .failureRate(0.0F) .build(), - DevChangeFailureRateOfPipeline.builder() + PipelineChangeFailureRateOfPipeline.builder() .name("Heartbeat") .step(":mag: Check Frontend License") .failedTimesOfPipeline(0) @@ -437,16 +437,16 @@ void shouldHasContentWhenGetDataFromCsvGivenDataTypeIsMetric() { .failureRate(0.0F) .build())) .build()) - .devMeanTimeToRecovery(DevMeanTimeToRecovery.builder() - .avgDevMeanTimeToRecovery( - AvgDevMeanTimeToRecovery.builder().timeToRecovery(BigDecimal.valueOf(0)).build()) - .devMeanTimeToRecoveryOfPipelines(List.of( - DevMeanTimeToRecoveryOfPipeline.builder() + .pipelineMeanTimeToRecovery(PipelineMeanTimeToRecovery.builder() + .avgPipelineMeanTimeToRecovery( + AvgPipelineMeanTimeToRecovery.builder().timeToRecovery(BigDecimal.valueOf(0)).build()) + .pipelineMeanTimeToRecoveryOfPipelines(List.of( + PipelineMeanTimeToRecoveryOfPipeline.builder() .timeToRecovery(BigDecimal.valueOf(0)) .name("Heartbeat") .step(":rocket: Deploy prod") .build(), - DevMeanTimeToRecoveryOfPipeline.builder() + PipelineMeanTimeToRecoveryOfPipeline.builder() .timeToRecovery(BigDecimal.valueOf(0)) .name("Heartbeat") .step(":mag: Check Frontend License") @@ -521,12 +521,12 @@ void shouldHasContentWhenGetDataFromCsvGivenDataTypeIsMetric() { { "Lead time for changes", "Average / PR Lead Time", "0" }, { "Lead time for changes", "Average / Pipeline Lead Time", "0.05" }, { "Lead time for changes", "Average / Total Lead Time", "0.05" }, - { "Dev change failure rate", "Heartbeat / Deploy prod / Dev change failure rate", "0.0000" }, - { "Dev change failure rate", "Heartbeat / Check Frontend License / Dev change failure rate", "0.0000" }, - { "Dev change failure rate", "Average / Dev change failure rate", "0" }, - { "Dev mean time to recovery", "Heartbeat / Deploy prod / Dev mean time to recovery", "0" }, - { "Dev mean time to recovery", "Heartbeat / Check Frontend License / Dev mean time to recovery", "0" }, - { "Dev mean time to recovery", "Total / Dev mean time to recovery", "0" } }; + { "Pipeline change failure rate", "Heartbeat / Deploy prod / Pipeline change failure rate", "0.0000" }, + { "Pipeline change failure rate", "Heartbeat / Check Frontend License / Pipeline change failure rate", "0.0000" }, + { "Pipeline change failure rate", "Average / Pipeline change failure rate", "0" }, + { "Pipeline mean time to recovery", "Heartbeat / Deploy prod / Pipeline mean time to recovery", "0" }, + { "Pipeline mean time to recovery", "Heartbeat / Check Frontend License / Pipeline mean time to recovery", "0" }, + { "Pipeline mean time to recovery", "Total / Pipeline mean time to recovery", "0" } }; csvFileGenerator.convertMetricDataToCSV(TEST_UUID, reportResponse, mockTimeStamp); @@ -560,14 +560,14 @@ void shouldHasNoContentForAveragesWhenGetDataFromCsvGivenDataTypeIsMetricAndTheQ .build())) .totalDeployTimes(1) .build()) - .devChangeFailureRate(DevChangeFailureRate.builder() - .avgDevChangeFailureRate(AvgDevChangeFailureRate.builder() + .pipelineChangeFailureRate(PipelineChangeFailureRate.builder() + .avgPipelineChangeFailureRate(AvgPipelineChangeFailureRate.builder() .name("Average") .totalTimes(12) .totalFailedTimes(0) .failureRate(0.0F) .build()) - .devChangeFailureRateOfPipelines(List.of(DevChangeFailureRateOfPipeline.builder() + .pipelineChangeFailureRateOfPipelines(List.of(PipelineChangeFailureRateOfPipeline.builder() .name("Heartbeat") .step(":rocket: Deploy prod") .failedTimesOfPipeline(0) @@ -575,10 +575,10 @@ void shouldHasNoContentForAveragesWhenGetDataFromCsvGivenDataTypeIsMetricAndTheQ .failureRate(0.0F) .build())) .build()) - .devMeanTimeToRecovery(DevMeanTimeToRecovery.builder() - .avgDevMeanTimeToRecovery( - AvgDevMeanTimeToRecovery.builder().timeToRecovery(BigDecimal.valueOf(0)).build()) - .devMeanTimeToRecoveryOfPipelines(List.of(DevMeanTimeToRecoveryOfPipeline.builder() + .pipelineMeanTimeToRecovery(PipelineMeanTimeToRecovery.builder() + .avgPipelineMeanTimeToRecovery( + AvgPipelineMeanTimeToRecovery.builder().timeToRecovery(BigDecimal.valueOf(0)).build()) + .pipelineMeanTimeToRecoveryOfPipelines(List.of(PipelineMeanTimeToRecoveryOfPipeline.builder() .timeToRecovery(BigDecimal.valueOf(0)) .name("Heartbeat") .step(":rocket: Deploy prod") @@ -608,8 +608,8 @@ void shouldHasNoContentForAveragesWhenGetDataFromCsvGivenDataTypeIsMetricAndTheQ { "Lead time for changes", "Heartbeat / Deploy prod / PR Lead Time", "0" }, { "Lead time for changes", "Heartbeat / Deploy prod / Pipeline Lead Time", "0.02" }, { "Lead time for changes", "Heartbeat / Deploy prod / Total Lead Time", "0.02" }, - { "Dev change failure rate", "Heartbeat / Deploy prod / Dev change failure rate", "0.0000" }, - { "Dev mean time to recovery", "Heartbeat / Deploy prod / Dev mean time to recovery", "0" }, }; + { "Pipeline change failure rate", "Heartbeat / Deploy prod / Pipeline change failure rate", "0.0000" }, + { "Pipeline mean time to recovery", "Heartbeat / Deploy prod / Pipeline mean time to recovery", "0" }, }; csvFileGenerator.convertMetricDataToCSV(TEST_UUID, reportResponse, mockTimeStamp); diff --git a/backend/src/test/java/heartbeat/service/report/GenerateReporterServiceTest.java b/backend/src/test/java/heartbeat/service/report/GenerateReporterServiceTest.java index 8ca528ded1..a86866c620 100644 --- a/backend/src/test/java/heartbeat/service/report/GenerateReporterServiceTest.java +++ b/backend/src/test/java/heartbeat/service/report/GenerateReporterServiceTest.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import heartbeat.controller.report.dto.response.MetricsDataCompleted; +import heartbeat.controller.report.dto.response.PipelineMeanTimeToRecovery; import heartbeat.exception.GenerateReportException; import heartbeat.exception.RequestFailedException; import heartbeat.exception.ServiceUnavailableException; @@ -20,8 +21,7 @@ import heartbeat.controller.report.dto.response.Classification; import heartbeat.controller.report.dto.response.CycleTime; import heartbeat.controller.report.dto.response.DeploymentFrequency; -import heartbeat.controller.report.dto.response.DevChangeFailureRate; -import heartbeat.controller.report.dto.response.DevMeanTimeToRecovery; +import heartbeat.controller.report.dto.response.PipelineChangeFailureRate; import heartbeat.controller.report.dto.response.LeadTimeForChanges; import heartbeat.controller.report.dto.response.PipelineCSVInfo; import heartbeat.controller.report.dto.response.ReportResponse; @@ -33,9 +33,9 @@ import heartbeat.service.report.calculator.ClassificationCalculator; import heartbeat.service.report.calculator.CycleTimeCalculator; import heartbeat.service.report.calculator.DeploymentFrequencyCalculator; -import heartbeat.service.report.calculator.DevChangeFailureRateCalculator; +import heartbeat.service.report.calculator.PipelineChangeFailureRateCalculator; import heartbeat.service.report.calculator.LeadTimeForChangesCalculator; -import heartbeat.service.report.calculator.MeanToRecoveryCalculator; +import heartbeat.service.report.calculator.PipelineMeanToRecoveryCalculator; import heartbeat.service.report.calculator.ReworkCalculator; import heartbeat.service.report.calculator.VelocityCalculator; import heartbeat.service.report.calculator.model.FetchedData; @@ -107,10 +107,10 @@ class GenerateReporterServiceTest { VelocityCalculator velocityCalculator; @Mock - DevChangeFailureRateCalculator devChangeFailureRate; + PipelineChangeFailureRateCalculator pipelineChangeFailureRate; @Mock - MeanToRecoveryCalculator meanToRecoveryCalculator; + PipelineMeanToRecoveryCalculator pipelineMeanToRecoveryCalculator; @Mock CycleTimeCalculator cycleTimeCalculator; @@ -679,7 +679,7 @@ void shouldGenerateCsvWithPipelineReportWhenPipeLineMetricIsNotEmpty() { .calendarType(CalendarTypeEnum.REGULAR) .startTime("10000") .endTime("20000") - .metrics(List.of("deployment frequency", "dev change failure rate", "dev mean time to recovery")) + .metrics(List.of("deployment frequency", "pipeline change failure rate", "pipeline mean time to recovery")) .buildKiteSetting(BuildKiteSetting.builder().build()) .csvTimeStamp(TIMESTAMP) .timezone("Asia/Shanghai") @@ -694,11 +694,11 @@ void shouldGenerateCsvWithPipelineReportWhenPipeLineMetricIsNotEmpty() { when(pipelineService.fetchBuildKiteInfo(request)) .thenReturn(FetchedData.BuildKiteData.builder().buildInfosList(List.of()).build()); DeploymentFrequency fakeDeploymentFrequency = DeploymentFrequency.builder().build(); - DevChangeFailureRate fakeDevChangeFailureRate = DevChangeFailureRate.builder().build(); - DevMeanTimeToRecovery fakeMeantime = DevMeanTimeToRecovery.builder().build(); + PipelineChangeFailureRate fakePipelineChangeFailureRate = PipelineChangeFailureRate.builder().build(); + PipelineMeanTimeToRecovery fakeMeantime = PipelineMeanTimeToRecovery.builder().build(); when(deploymentFrequency.calculate(any(), any(), any(), any(), any())).thenReturn(fakeDeploymentFrequency); - when(devChangeFailureRate.calculate(any())).thenReturn(fakeDevChangeFailureRate); - when(meanToRecoveryCalculator.calculate(any(), any())).thenReturn(fakeMeantime); + when(pipelineChangeFailureRate.calculate(any())).thenReturn(fakePipelineChangeFailureRate); + when(pipelineMeanToRecoveryCalculator.calculate(any(), any())).thenReturn(fakeMeantime); generateReporterService.generateDoraReport(TEST_UUID, request); @@ -716,9 +716,9 @@ void shouldGenerateCsvWithPipelineReportWhenPipeLineMetricIsNotEmpty() { ReportResponse response = responseArgumentCaptor.getValue(); - assertEquals(fakeDevChangeFailureRate, response.getDevChangeFailureRate()); - assertEquals(fakeMeantime, response.getDevMeanTimeToRecovery()); - assertEquals(fakeDevChangeFailureRate, response.getDevChangeFailureRate()); + assertEquals(fakePipelineChangeFailureRate, response.getPipelineChangeFailureRate()); + assertEquals(fakeMeantime, response.getPipelineMeanTimeToRecovery()); + assertEquals(fakePipelineChangeFailureRate, response.getPipelineChangeFailureRate()); assertEquals(fakeDeploymentFrequency, response.getDeploymentFrequency()); Awaitility.await().atMost(5, TimeUnit.SECONDS).untilAsserted(() -> { @@ -729,8 +729,8 @@ void shouldGenerateCsvWithPipelineReportWhenPipeLineMetricIsNotEmpty() { timeRangeAndTimeStamp, DORA, true); verify(deploymentFrequency, times(1)).calculate(any(), any(), any(), any(), any()); - verify(devChangeFailureRate, times(1)).calculate(any()); - verify(meanToRecoveryCalculator, times(1)).calculate(any(), any()); + verify(pipelineChangeFailureRate, times(1)).calculate(any()); + verify(pipelineMeanToRecoveryCalculator, times(1)).calculate(any(), any()); }); } @@ -740,7 +740,7 @@ void shouldUpdateMetricCompletedWhenGenerateCsvWithPipelineReportFailed() { .calendarType(CalendarTypeEnum.REGULAR) .startTime("10000") .endTime("20000") - .metrics(List.of("dev change failure rate")) + .metrics(List.of("pipeline change failure rate")) .buildKiteSetting(BuildKiteSetting.builder().build()) .csvTimeStamp(TIMESTAMP) .timezone("Asia/Shanghai") @@ -753,12 +753,12 @@ void shouldUpdateMetricCompletedWhenGenerateCsvWithPipelineReportFailed() { List pipelineCSVInfos = List.of(); when(pipelineService.fetchBuildKiteInfo(request)) .thenReturn(FetchedData.BuildKiteData.builder().buildInfosList(List.of()).build()); - when(devChangeFailureRate.calculate(any())).thenThrow(new NotFoundException("")); + when(pipelineChangeFailureRate.calculate(any())).thenThrow(new NotFoundException("")); generateReporterService.generateDoraReport(TEST_UUID, request); verify(kanbanService, never()).fetchDataFromKanban(request); - verify(devChangeFailureRate, times(1)).calculate(any()); + verify(pipelineChangeFailureRate, times(1)).calculate(any()); verify(fileRepository, times(1)).removeFileByType(ERROR, TEST_UUID, timeRangeAndTimeStamp, FilePrefixType.PIPELINE_REPORT_PREFIX); verify(fileRepository, times(1)).removeFileByType(ERROR, TEST_UUID, timeRangeAndTimeStamp, @@ -838,7 +838,7 @@ void shouldGenerateCsvWithCachedDataWhenBuildKiteDataAlreadyExisted() { .startTime("10000") .endTime("20000") .metrics(List.of(MetricEnum.LEAD_TIME_FOR_CHANGES.getValue(), - MetricEnum.DEV_CHANGE_FAILURE_RATE.getValue())) + MetricEnum.PIPELINE_CHANGE_FAILURE_RATE.getValue())) .codebaseSetting(CodebaseSetting.builder().build()) .buildKiteSetting(BuildKiteSetting.builder().build()) .csvTimeStamp(TIMESTAMP) @@ -1032,8 +1032,8 @@ void shouldThrowNotFoundExceptionWhenFileTimeRangeIsNull() { assertNull(composedReportResponse.getClassificationList()); assertNull(composedReportResponse.getDeploymentFrequency()); assertNull(composedReportResponse.getLeadTimeForChanges()); - assertNull(composedReportResponse.getDevChangeFailureRate()); - assertNull(composedReportResponse.getDevMeanTimeToRecovery()); + assertNull(composedReportResponse.getPipelineChangeFailureRate()); + assertNull(composedReportResponse.getPipelineMeanTimeToRecovery()); assertFalse(composedReportResponse.getAllMetricsCompleted()); assertFalse(composedReportResponse.getBoardMetricsCompleted()); assertFalse(composedReportResponse.getDoraMetricsCompleted()); diff --git a/backend/src/test/java/heartbeat/service/report/MetricCsvFixture.java b/backend/src/test/java/heartbeat/service/report/MetricCsvFixture.java index 520d5d7b43..17e2e8ba03 100644 --- a/backend/src/test/java/heartbeat/service/report/MetricCsvFixture.java +++ b/backend/src/test/java/heartbeat/service/report/MetricCsvFixture.java @@ -1,7 +1,12 @@ package heartbeat.service.report; +import heartbeat.controller.report.dto.response.AvgPipelineChangeFailureRate; +import heartbeat.controller.report.dto.response.AvgPipelineMeanTimeToRecovery; import heartbeat.controller.report.dto.response.Classification; import heartbeat.controller.report.dto.response.ClassificationInfo; +import heartbeat.controller.report.dto.response.PipelineChangeFailureRate; +import heartbeat.controller.report.dto.response.PipelineChangeFailureRateOfPipeline; +import heartbeat.controller.report.dto.response.PipelineMeanTimeToRecovery; import heartbeat.controller.report.dto.response.ReportResponse; import heartbeat.controller.report.dto.response.Rework; import heartbeat.controller.report.dto.response.Velocity; @@ -11,12 +16,7 @@ import heartbeat.controller.report.dto.response.AvgDeploymentFrequency; import heartbeat.controller.report.dto.response.DeploymentFrequencyOfPipeline; import heartbeat.controller.report.dto.response.DailyDeploymentCount; -import heartbeat.controller.report.dto.response.DevChangeFailureRate; -import heartbeat.controller.report.dto.response.AvgDevChangeFailureRate; -import heartbeat.controller.report.dto.response.DevChangeFailureRateOfPipeline; -import heartbeat.controller.report.dto.response.DevMeanTimeToRecovery; -import heartbeat.controller.report.dto.response.AvgDevMeanTimeToRecovery; -import heartbeat.controller.report.dto.response.DevMeanTimeToRecoveryOfPipeline; +import heartbeat.controller.report.dto.response.PipelineMeanTimeToRecoveryOfPipeline; import heartbeat.controller.report.dto.response.LeadTimeForChanges; import heartbeat.controller.report.dto.response.LeadTimeForChangesOfPipelines; import heartbeat.controller.report.dto.response.AvgLeadTimeForChanges; @@ -96,22 +96,22 @@ public static ReportResponse MOCK_METRIC_CSV_DATA() { List.of(DailyDeploymentCount.builder().date("10/16/2023").count(1).build())) .build())) .build()) - .devChangeFailureRate(DevChangeFailureRate.builder() - .avgDevChangeFailureRate(AvgDevChangeFailureRate.builder() + .pipelineChangeFailureRate(PipelineChangeFailureRate.builder() + .avgPipelineChangeFailureRate(AvgPipelineChangeFailureRate.builder() .name("Average") .totalTimes(12) .totalFailedTimes(0) .failureRate(0.0F) .build()) - .devChangeFailureRateOfPipelines(List.of( - DevChangeFailureRateOfPipeline.builder() + .pipelineChangeFailureRateOfPipelines(List.of( + PipelineChangeFailureRateOfPipeline.builder() .name("Heartbeat") .step(":rocket: Deploy prod") .failedTimesOfPipeline(0) .totalTimesOfPipeline(7) .failureRate(0.0F) .build(), - DevChangeFailureRateOfPipeline.builder() + PipelineChangeFailureRateOfPipeline.builder() .name("Heartbeat") .step(":mag: Check Frontend License") .failedTimesOfPipeline(0) @@ -119,16 +119,16 @@ public static ReportResponse MOCK_METRIC_CSV_DATA() { .failureRate(0.0F) .build())) .build()) - .devMeanTimeToRecovery(DevMeanTimeToRecovery.builder() - .avgDevMeanTimeToRecovery( - AvgDevMeanTimeToRecovery.builder().timeToRecovery(BigDecimal.valueOf(0)).build()) - .devMeanTimeToRecoveryOfPipelines(List.of( - DevMeanTimeToRecoveryOfPipeline.builder() + .pipelineMeanTimeToRecovery(PipelineMeanTimeToRecovery.builder() + .avgPipelineMeanTimeToRecovery( + AvgPipelineMeanTimeToRecovery.builder().timeToRecovery(BigDecimal.valueOf(0)).build()) + .pipelineMeanTimeToRecoveryOfPipelines(List.of( + PipelineMeanTimeToRecoveryOfPipeline.builder() .timeToRecovery(BigDecimal.valueOf(0)) .name("Heartbeat") .step(":rocket: Deploy prod") .build(), - DevMeanTimeToRecoveryOfPipeline.builder() + PipelineMeanTimeToRecoveryOfPipeline.builder() .timeToRecovery(BigDecimal.valueOf(0)) .name("Heartbeat") .step(":mag: Check Frontend License") @@ -177,14 +177,14 @@ public static ReportResponse MOCK_METRIC_CSV_DATA_WITH_ONE_PIPELINE() { .dailyDeploymentCounts(List.of(DailyDeploymentCount.builder().date("10/16/2023").count(1).build())) .build())) .build()) - .devChangeFailureRate(DevChangeFailureRate.builder() - .avgDevChangeFailureRate(AvgDevChangeFailureRate.builder() + .pipelineChangeFailureRate(PipelineChangeFailureRate.builder() + .avgPipelineChangeFailureRate(AvgPipelineChangeFailureRate.builder() .name("Average") .totalTimes(12) .totalFailedTimes(0) .failureRate(0.0F) .build()) - .devChangeFailureRateOfPipelines(List.of(DevChangeFailureRateOfPipeline.builder() + .pipelineChangeFailureRateOfPipelines(List.of(PipelineChangeFailureRateOfPipeline.builder() .name("Heartbeat") .step(":rocket: Deploy prod") .failedTimesOfPipeline(0) @@ -192,10 +192,10 @@ public static ReportResponse MOCK_METRIC_CSV_DATA_WITH_ONE_PIPELINE() { .failureRate(0.0F) .build())) .build()) - .devMeanTimeToRecovery(DevMeanTimeToRecovery.builder() - .avgDevMeanTimeToRecovery( - AvgDevMeanTimeToRecovery.builder().timeToRecovery(BigDecimal.valueOf(0)).build()) - .devMeanTimeToRecoveryOfPipelines(List.of(DevMeanTimeToRecoveryOfPipeline.builder() + .pipelineMeanTimeToRecovery(PipelineMeanTimeToRecovery.builder() + .avgPipelineMeanTimeToRecovery( + AvgPipelineMeanTimeToRecovery.builder().timeToRecovery(BigDecimal.valueOf(0)).build()) + .pipelineMeanTimeToRecoveryOfPipelines(List.of(PipelineMeanTimeToRecoveryOfPipeline.builder() .timeToRecovery(BigDecimal.valueOf(0)) .name("Heartbeat") .step(":rocket: Deploy prod") diff --git a/backend/src/test/java/heartbeat/service/report/MeanToRecoveryCalculatorTest.java b/backend/src/test/java/heartbeat/service/report/PipelineMeanToRecoveryCalculatorTest.java similarity index 74% rename from backend/src/test/java/heartbeat/service/report/MeanToRecoveryCalculatorTest.java rename to backend/src/test/java/heartbeat/service/report/PipelineMeanToRecoveryCalculatorTest.java index 595c0b4f31..1f0101d65a 100644 --- a/backend/src/test/java/heartbeat/service/report/MeanToRecoveryCalculatorTest.java +++ b/backend/src/test/java/heartbeat/service/report/PipelineMeanToRecoveryCalculatorTest.java @@ -3,10 +3,10 @@ import heartbeat.client.dto.pipeline.buildkite.DeployInfo; import heartbeat.client.dto.pipeline.buildkite.DeployTimes; import heartbeat.controller.report.dto.request.GenerateReportRequest; -import heartbeat.controller.report.dto.response.AvgDevMeanTimeToRecovery; -import heartbeat.controller.report.dto.response.DevMeanTimeToRecovery; -import heartbeat.controller.report.dto.response.DevMeanTimeToRecoveryOfPipeline; -import heartbeat.service.report.calculator.MeanToRecoveryCalculator; +import heartbeat.controller.report.dto.response.AvgPipelineMeanTimeToRecovery; +import heartbeat.controller.report.dto.response.PipelineMeanTimeToRecovery; +import heartbeat.controller.report.dto.response.PipelineMeanTimeToRecoveryOfPipeline; +import heartbeat.service.report.calculator.PipelineMeanToRecoveryCalculator; import heartbeat.service.report.model.WorkInfo; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -30,10 +30,10 @@ import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) -class MeanToRecoveryCalculatorTest { +class PipelineMeanToRecoveryCalculatorTest { @InjectMocks - private MeanToRecoveryCalculator calculator; + private PipelineMeanToRecoveryCalculator calculator; @Mock private WorkDay workday; @@ -44,10 +44,10 @@ void shouldReturnZeroAvgDevMeanTimeToRecoveryWhenDeployTimesIsEmpty() { GenerateReportRequest request = GenerateReportRequest.builder().build(); - DevMeanTimeToRecovery result = calculator.calculate(deployTimes, request); + PipelineMeanTimeToRecovery result = calculator.calculate(deployTimes, request); - Assertions.assertEquals(BigDecimal.ZERO, result.getAvgDevMeanTimeToRecovery().getTimeToRecovery()); - Assertions.assertTrue(result.getDevMeanTimeToRecoveryOfPipelines().isEmpty()); + Assertions.assertEquals(BigDecimal.ZERO, result.getAvgPipelineMeanTimeToRecovery().getTimeToRecovery()); + Assertions.assertTrue(result.getPipelineMeanTimeToRecoveryOfPipelines().isEmpty()); } @Test @@ -72,26 +72,27 @@ void shouldCalculateDevMeanTimeToRecoveryWhenDeployTimesIsNotEmpty() { return WorkInfo.builder().workTime(secondParam - firstParam).build(); }); - DevMeanTimeToRecovery result = calculator.calculate(deployTimesList, request); + PipelineMeanTimeToRecovery result = calculator.calculate(deployTimesList, request); - AvgDevMeanTimeToRecovery avgDevMeanTimeToRecovery = result.getAvgDevMeanTimeToRecovery(); - Assertions.assertEquals(1, avgDevMeanTimeToRecovery.getTimeToRecovery().compareTo(BigDecimal.valueOf(100000))); + AvgPipelineMeanTimeToRecovery avgPipelineMeanTimeToRecovery = result.getAvgPipelineMeanTimeToRecovery(); + Assertions.assertEquals(1, + avgPipelineMeanTimeToRecovery.getTimeToRecovery().compareTo(BigDecimal.valueOf(100000))); - List devMeanTimeToRecoveryOfPipelines = result - .getDevMeanTimeToRecoveryOfPipelines(); - Assertions.assertEquals(3, devMeanTimeToRecoveryOfPipelines.size()); + List pipelineMeanTimeToRecoveryOfPipelines = result + .getPipelineMeanTimeToRecoveryOfPipelines(); + Assertions.assertEquals(3, pipelineMeanTimeToRecoveryOfPipelines.size()); - DevMeanTimeToRecoveryOfPipeline deploy1Result = devMeanTimeToRecoveryOfPipelines.get(0); + PipelineMeanTimeToRecoveryOfPipeline deploy1Result = pipelineMeanTimeToRecoveryOfPipelines.get(0); Assertions.assertEquals("Pipeline 1", deploy1Result.getName()); Assertions.assertEquals("Step 1", deploy1Result.getStep()); Assertions.assertEquals(0, deploy1Result.getTimeToRecovery().compareTo(BigDecimal.valueOf(180000))); - DevMeanTimeToRecoveryOfPipeline deploy2Result = devMeanTimeToRecoveryOfPipelines.get(1); + PipelineMeanTimeToRecoveryOfPipeline deploy2Result = pipelineMeanTimeToRecoveryOfPipelines.get(1); Assertions.assertEquals("Pipeline 2", deploy2Result.getName()); Assertions.assertEquals("Step 2", deploy2Result.getStep()); Assertions.assertEquals(0, deploy2Result.getTimeToRecovery().compareTo(BigDecimal.valueOf(120000))); - DevMeanTimeToRecoveryOfPipeline deploy3Result = devMeanTimeToRecoveryOfPipelines.get(2); + PipelineMeanTimeToRecoveryOfPipeline deploy3Result = pipelineMeanTimeToRecoveryOfPipelines.get(2); Assertions.assertEquals("Pipeline 3", deploy3Result.getName()); Assertions.assertEquals("Step 3", deploy3Result.getStep()); Assertions.assertEquals(BigDecimal.ZERO, deploy3Result.getTimeToRecovery()); @@ -121,26 +122,27 @@ void shouldCalculateDevMeanTimeToRecoveryWhenDeployTimesIsNotEmptyAndHasCanceled return WorkInfo.builder().workTime(secondParam - firstParam).build(); }); - DevMeanTimeToRecovery result = calculator.calculate(deployTimesList, request); + PipelineMeanTimeToRecovery result = calculator.calculate(deployTimesList, request); - AvgDevMeanTimeToRecovery avgDevMeanTimeToRecovery = result.getAvgDevMeanTimeToRecovery(); - Assertions.assertEquals(1, avgDevMeanTimeToRecovery.getTimeToRecovery().compareTo(BigDecimal.valueOf(80000))); + AvgPipelineMeanTimeToRecovery avgPipelineMeanTimeToRecovery = result.getAvgPipelineMeanTimeToRecovery(); + Assertions.assertEquals(1, + avgPipelineMeanTimeToRecovery.getTimeToRecovery().compareTo(BigDecimal.valueOf(80000))); - List devMeanTimeToRecoveryOfPipelines = result - .getDevMeanTimeToRecoveryOfPipelines(); - Assertions.assertEquals(3, devMeanTimeToRecoveryOfPipelines.size()); + List pipelineMeanTimeToRecoveryOfPipelines = result + .getPipelineMeanTimeToRecoveryOfPipelines(); + Assertions.assertEquals(3, pipelineMeanTimeToRecoveryOfPipelines.size()); - DevMeanTimeToRecoveryOfPipeline deploy1Result = devMeanTimeToRecoveryOfPipelines.get(0); + PipelineMeanTimeToRecoveryOfPipeline deploy1Result = pipelineMeanTimeToRecoveryOfPipelines.get(0); Assertions.assertEquals("Pipeline 1", deploy1Result.getName()); Assertions.assertEquals("Step 1", deploy1Result.getStep()); Assertions.assertEquals(0, deploy1Result.getTimeToRecovery().compareTo(BigDecimal.valueOf(240000))); - DevMeanTimeToRecoveryOfPipeline deploy2Result = devMeanTimeToRecoveryOfPipelines.get(1); + PipelineMeanTimeToRecoveryOfPipeline deploy2Result = pipelineMeanTimeToRecoveryOfPipelines.get(1); Assertions.assertEquals("Pipeline 2", deploy2Result.getName()); Assertions.assertEquals("Step 2", deploy2Result.getStep()); Assertions.assertEquals(BigDecimal.ZERO, deploy2Result.getTimeToRecovery()); - DevMeanTimeToRecoveryOfPipeline deploy3Result = devMeanTimeToRecoveryOfPipelines.get(2); + PipelineMeanTimeToRecoveryOfPipeline deploy3Result = pipelineMeanTimeToRecoveryOfPipelines.get(2); Assertions.assertEquals("Pipeline 3", deploy3Result.getName()); Assertions.assertEquals("Step 3", deploy3Result.getStep()); Assertions.assertEquals(BigDecimal.ZERO, deploy3Result.getTimeToRecovery()); @@ -172,9 +174,9 @@ void shouldReturnDevMeanTimeToRecoveryIsZeroWhenWorkdayIsNegative() { return WorkInfo.builder().workTime(secondParam - firstParam).build(); }); - DevMeanTimeToRecovery result = calculator.calculate(deployTimesList, request); + PipelineMeanTimeToRecovery result = calculator.calculate(deployTimesList, request); - BigDecimal timeToRecovery = result.getAvgDevMeanTimeToRecovery().getTimeToRecovery(); + BigDecimal timeToRecovery = result.getAvgPipelineMeanTimeToRecovery().getTimeToRecovery(); String logs = outputStream.toString(); assertEquals(BigDecimal.ZERO, timeToRecovery); diff --git a/backend/src/test/java/heartbeat/service/report/calculator/CalculateDevChangeFailureRateTest.java b/backend/src/test/java/heartbeat/service/report/calculator/CalculatePipelineChangeFailureRateTest.java similarity index 53% rename from backend/src/test/java/heartbeat/service/report/calculator/CalculateDevChangeFailureRateTest.java rename to backend/src/test/java/heartbeat/service/report/calculator/CalculatePipelineChangeFailureRateTest.java index 27457f8d66..c6f5ce6fcb 100644 --- a/backend/src/test/java/heartbeat/service/report/calculator/CalculateDevChangeFailureRateTest.java +++ b/backend/src/test/java/heartbeat/service/report/calculator/CalculatePipelineChangeFailureRateTest.java @@ -2,7 +2,7 @@ import heartbeat.client.dto.pipeline.buildkite.DeployInfo; import heartbeat.client.dto.pipeline.buildkite.DeployTimes; -import heartbeat.controller.report.dto.response.DevChangeFailureRate; +import heartbeat.controller.report.dto.response.PipelineChangeFailureRate; import heartbeat.service.pipeline.buildkite.builder.DeployInfoBuilder; import heartbeat.service.pipeline.buildkite.builder.DeployTimesBuilder; import org.junit.jupiter.api.Test; @@ -19,7 +19,7 @@ @ExtendWith(MockitoExtension.class) @MockitoSettings(strictness = Strictness.LENIENT) -class CalculateDevChangeFailureRateTest { +class CalculatePipelineChangeFailureRateTest { private static final String JOB_FINISH_TIME_2022 = "2022-09-08T22:45:33.981Z"; @@ -30,39 +30,41 @@ class CalculateDevChangeFailureRateTest { private static final String OTHER_JOB_NAME = "JobName"; @InjectMocks - private DevChangeFailureRateCalculator devChangeFailureRate; + private PipelineChangeFailureRateCalculator pipelineChangeFailureRate; @Test - void testCalculateDevChangeFailureRate() { + void testCalculatePipelineChangeFailureRate() { DeployTimes mockedDeployTimes = DeployTimesBuilder.withDefault() .withPassed(List.of(DeployInfoBuilder.withDefault().withJobFinishTime(JOB_FINISH_TIME_2023).build(), DeployInfoBuilder.withDefault().withJobFinishTime(JOB_FINISH_TIME_2023).build())) .withFailed(List.of(DeployInfo.builder().jobFinishTime(JOB_FINISH_TIME_2022).state(FAILED_STATE).build())) .build(); - DevChangeFailureRate devChangeFailureRate = this.devChangeFailureRate.calculate(List.of(mockedDeployTimes)); + PipelineChangeFailureRate pipelineChangeFailureRate = this.pipelineChangeFailureRate + .calculate(List.of(mockedDeployTimes)); - assertThat(devChangeFailureRate.getAvgDevChangeFailureRate().getFailureRate()).isEqualTo(0.3333F); - assertThat(devChangeFailureRate.getAvgDevChangeFailureRate().getTotalFailedTimes()).isEqualTo(1); - assertThat(devChangeFailureRate.getAvgDevChangeFailureRate().getTotalTimes()).isEqualTo(3); + assertThat(pipelineChangeFailureRate.getAvgPipelineChangeFailureRate().getFailureRate()).isEqualTo(0.3333F); + assertThat(pipelineChangeFailureRate.getAvgPipelineChangeFailureRate().getTotalFailedTimes()).isEqualTo(1); + assertThat(pipelineChangeFailureRate.getAvgPipelineChangeFailureRate().getTotalTimes()).isEqualTo(3); } @Test - void testCalculateDevChangeFailureRateWhenTotalDeployInfosTimesIsZero() { + void testCalculatePipelineChangeFailureRateWhenTotalDeployInfosTimesIsZero() { DeployTimes mockedDeployTimes = DeployTimesBuilder.withDefault() .withPassed(Collections.emptyList()) .withFailed(Collections.emptyList()) .build(); - DevChangeFailureRate devChangeFailureRate = this.devChangeFailureRate.calculate(List.of(mockedDeployTimes)); + PipelineChangeFailureRate pipelineChangeFailureRate = this.pipelineChangeFailureRate + .calculate(List.of(mockedDeployTimes)); - assertThat(devChangeFailureRate.getAvgDevChangeFailureRate().getFailureRate()).isEqualTo(0.0F); - assertThat(devChangeFailureRate.getAvgDevChangeFailureRate().getTotalFailedTimes()).isZero(); - assertThat(devChangeFailureRate.getAvgDevChangeFailureRate().getTotalTimes()).isZero(); + assertThat(pipelineChangeFailureRate.getAvgPipelineChangeFailureRate().getFailureRate()).isEqualTo(0.0F); + assertThat(pipelineChangeFailureRate.getAvgPipelineChangeFailureRate().getTotalFailedTimes()).isZero(); + assertThat(pipelineChangeFailureRate.getAvgPipelineChangeFailureRate().getTotalTimes()).isZero(); } @Test - void testCalculateDevChangeFailureRateWhenHavePassedDeployInfoWhoseJobNameIsNotEqualToPipelineStep() { + void testCalculatePipelineChangeFailureRateWhenHavePassedDeployInfoWhoseJobNameIsNotEqualToPipelineStep() { DeployTimes mockedDeployTimes = DeployTimesBuilder.withDefault() .withPassed(List.of(DeployInfoBuilder.withDefault() .withJobName(OTHER_JOB_NAME) @@ -71,11 +73,12 @@ void testCalculateDevChangeFailureRateWhenHavePassedDeployInfoWhoseJobNameIsNotE .withFailed(List.of(DeployInfo.builder().jobFinishTime(JOB_FINISH_TIME_2022).state(FAILED_STATE).build())) .build(); - DevChangeFailureRate devChangeFailureRate = this.devChangeFailureRate.calculate(List.of(mockedDeployTimes)); + PipelineChangeFailureRate pipelineChangeFailureRate = this.pipelineChangeFailureRate + .calculate(List.of(mockedDeployTimes)); - assertThat(devChangeFailureRate.getAvgDevChangeFailureRate().getFailureRate()).isEqualTo(0.5F); - assertThat(devChangeFailureRate.getAvgDevChangeFailureRate().getTotalFailedTimes()).isEqualTo(1); - assertThat(devChangeFailureRate.getAvgDevChangeFailureRate().getTotalTimes()).isEqualTo(2); + assertThat(pipelineChangeFailureRate.getAvgPipelineChangeFailureRate().getFailureRate()).isEqualTo(0.5F); + assertThat(pipelineChangeFailureRate.getAvgPipelineChangeFailureRate().getTotalFailedTimes()).isEqualTo(1); + assertThat(pipelineChangeFailureRate.getAvgPipelineChangeFailureRate().getTotalTimes()).isEqualTo(2); } } diff --git a/backend/src/test/java/heartbeat/util/MetricsUtilTest.java b/backend/src/test/java/heartbeat/util/MetricsUtilTest.java index 874fc2d3ff..cfad1471f9 100644 --- a/backend/src/test/java/heartbeat/util/MetricsUtilTest.java +++ b/backend/src/test/java/heartbeat/util/MetricsUtilTest.java @@ -16,8 +16,8 @@ void shouldGetRelatedPartMetrics() { List expectedKanbanMetrics = List.of(MetricEnum.VELOCITY.getValue(), MetricEnum.CYCLE_TIME.getValue(), MetricEnum.CLASSIFICATION.getValue(), MetricEnum.REWORK_TIMES.getValue()); - List expectedBuildKiteMetrics = List.of(MetricEnum.DEV_CHANGE_FAILURE_RATE.getValue(), - MetricEnum.DEPLOYMENT_FREQUENCY.getValue(), MetricEnum.DEV_MEAN_TIME_TO_RECOVERY.getValue()); + List expectedBuildKiteMetrics = List.of(MetricEnum.PIPELINE_CHANGE_FAILURE_RATE.getValue(), + MetricEnum.DEPLOYMENT_FREQUENCY.getValue(), MetricEnum.PIPELINE_MEAN_TIME_TO_RECOVERY.getValue()); List expectedCodebaseMetrics = List.of(MetricEnum.LEAD_TIME_FOR_CHANGES.getValue()); Assertions.assertEquals(expectedKanbanMetrics, kanbanMetrics); diff --git a/frontend/__tests__/constants/fileConfig/fileConfig.test.ts b/frontend/__tests__/constants/fileConfig/fileConfig.test.ts index e76c7479bb..ee302456c5 100644 --- a/frontend/__tests__/constants/fileConfig/fileConfig.test.ts +++ b/frontend/__tests__/constants/fileConfig/fileConfig.test.ts @@ -129,4 +129,15 @@ describe('#fileConfig', () => { }), ).toEqual(expected); }); + + it('should convert metrics from dev to pipeline', () => { + const expected = { + ...BASIC_NEW_CONFIG, + metrics: ['Dev mean time to recovery', 'Dev change failure rate'], + calendarType: Calendar.China, + reworkTimesSettings: { reworkState: 'In Dev', excludeStates: ['Review'] }, + }; + const actual = convertToNewFileConfig(expected).metrics; + expect(actual).toStrictEqual(['Pipeline mean time to recovery', 'Pipeline change failure rate']); + }); }); diff --git a/frontend/__tests__/containers/ConfigStep/BasicInfo.test.tsx b/frontend/__tests__/containers/ConfigStep/BasicInfo.test.tsx index f505be840b..f270fb6c27 100644 --- a/frontend/__tests__/containers/ConfigStep/BasicInfo.test.tsx +++ b/frontend/__tests__/containers/ConfigStep/BasicInfo.test.tsx @@ -1,11 +1,11 @@ import { ALL, - DEV_CHANGE_FAILURE_RATE, + PIPELINE_CHANGE_FAILURE_RATE, CLASSIFICATION, CYCLE_TIME, DEPLOYMENT_FREQUENCY, LEAD_TIME_FOR_CHANGES, - DEV_MEAN_TIME_TO_RECOVERY, + PIPELINE_MEAN_TIME_TO_RECOVERY, REQUIRED_DATA, REQUIRED_DATA_LIST, REWORK_TIMES, @@ -103,8 +103,8 @@ describe('MetricsTypeCheckbox', () => { listBox.getByRole('option', { name: REWORK_TIMES }), listBox.getByRole('option', { name: LEAD_TIME_FOR_CHANGES }), listBox.getByRole('option', { name: DEPLOYMENT_FREQUENCY }), - listBox.getByRole('option', { name: DEV_CHANGE_FAILURE_RATE }), - listBox.getByRole('option', { name: DEV_MEAN_TIME_TO_RECOVERY }), + listBox.getByRole('option', { name: PIPELINE_CHANGE_FAILURE_RATE }), + listBox.getByRole('option', { name: PIPELINE_MEAN_TIME_TO_RECOVERY }), ]; await Promise.all(optionsToClick.map((opt) => userEvent.click(opt))); @@ -119,9 +119,12 @@ describe('MetricsTypeCheckbox', () => { const listBox = within(getByRole('listbox')); await userEvent.click(listBox.getByRole('option', { name: ALL })); - await userEvent.click(listBox.getByRole('option', { name: DEV_MEAN_TIME_TO_RECOVERY })); + await userEvent.click(listBox.getByRole('option', { name: PIPELINE_MEAN_TIME_TO_RECOVERY })); - expect(listBox.getByRole('option', { name: DEV_MEAN_TIME_TO_RECOVERY })).toHaveAttribute('aria-selected', 'false'); + expect(listBox.getByRole('option', { name: PIPELINE_MEAN_TIME_TO_RECOVERY })).toHaveAttribute( + 'aria-selected', + 'false', + ); expect(within(listBox.getByRole('option', { name: ALL })).getByTestId('CheckBoxOutlineBlankIcon')).toBeTruthy(); expect(getByText(displayedDataList.join(SELECTED_VALUE_SEPARATOR))).toBeInTheDocument(); }); diff --git a/frontend/__tests__/containers/ReportStep/ReportDetail/dora.test.tsx b/frontend/__tests__/containers/ReportStep/ReportDetail/dora.test.tsx index cd282ba8b8..dddca10da4 100644 --- a/frontend/__tests__/containers/ReportStep/ReportDetail/dora.test.tsx +++ b/frontend/__tests__/containers/ReportStep/ReportDetail/dora.test.tsx @@ -61,16 +61,16 @@ describe('DoraDetail', () => { }); }); - describe('Dev Change Failure Rate', () => { - it('should show devChangeFailureRateList when devChangeFailureRateList data is existing', () => { + describe('Pipeline Change Failure Rate', () => { + it('should show pipelineChangeFailureRateList when devChangeFailureRateList data is existing', () => { (reportMapper as jest.Mock).mockReturnValue({ - devChangeFailureRateList: [{ id: 0, name: 'name1', valueList: [{ value: 1 }] }], + pipelineChangeFailureRateList: [{ id: 0, name: 'name1', valueList: [{ value: 1 }] }], }); render(); - const devChangeFailureRateTable = screen.getByTestId('Dev Change Failure Rate'); - expect(screen.getByText('Dev Change Failure Rate')).toBeInTheDocument(); - expect(devChangeFailureRateTable).toBeInTheDocument(); - expect(within(devChangeFailureRateTable).queryAllByTestId('tr').length).toBe(1); + const pipelineChangeFailureRateTable = screen.getByTestId('Pipeline Change Failure Rate'); + expect(screen.getByText('Pipeline Change Failure Rate')).toBeInTheDocument(); + expect(pipelineChangeFailureRateTable).toBeInTheDocument(); + expect(within(pipelineChangeFailureRateTable).queryAllByTestId('tr').length).toBe(1); }); it('should not show devChangeFailureRateList when devChangeFailureRateList data is not existing', () => { @@ -82,16 +82,16 @@ describe('DoraDetail', () => { }); }); - describe('Dev Mean Time To Recovery', () => { - it('should show devMeanTimeToRecoveryList when devMeanTimeToRecoveryList data is existing', () => { + describe('Pipeline Mean Time To Recovery', () => { + it('should show pipelineMeanTimeToRecoveryList when devMeanTimeToRecoveryList data is existing', () => { (reportMapper as jest.Mock).mockReturnValue({ - devMeanTimeToRecoveryList: [{ id: 0, name: 'name1', valueList: [{ value: 1 }] }], + pipelineMeanTimeToRecoveryList: [{ id: 0, name: 'name1', valueList: [{ value: 1 }] }], }); render(); - const devMeanTimeToRecoveryTable = screen.getByTestId('Dev Mean Time To Recovery'); - expect(screen.getByText('Dev Mean Time To Recovery')).toBeInTheDocument(); - expect(devMeanTimeToRecoveryTable).toBeInTheDocument(); - expect(within(devMeanTimeToRecoveryTable).queryAllByTestId('tr').length).toBe(1); + const pipelineMeanTimeToRecoveryTable = screen.getByTestId('Pipeline Mean Time To Recovery'); + expect(screen.getByText('Pipeline Mean Time To Recovery')).toBeInTheDocument(); + expect(pipelineMeanTimeToRecoveryTable).toBeInTheDocument(); + expect(within(pipelineMeanTimeToRecoveryTable).queryAllByTestId('tr').length).toBe(1); }); it('should not show devMeanTimeToRecoveryList when devMeanTimeToRecoveryList data is not existing', () => { diff --git a/frontend/__tests__/containers/ReportStep/ReportStep.test.tsx b/frontend/__tests__/containers/ReportStep/ReportStep.test.tsx index 9946f16802..2eccf0a08c 100644 --- a/frontend/__tests__/containers/ReportStep/ReportStep.test.tsx +++ b/frontend/__tests__/containers/ReportStep/ReportStep.test.tsx @@ -212,8 +212,8 @@ describe('Report Step', () => { expect(screen.getByText('DORA Metrics')).toBeInTheDocument(); expect(screen.getByText('Lead Time For Changes')).toBeInTheDocument(); expect(screen.getByText('Deployment Frequency')).toBeInTheDocument(); - expect(screen.getByText('Dev Change Failure Rate')).toBeInTheDocument(); - expect(screen.getByText('Dev Mean Time To Recovery')).toBeInTheDocument(); + expect(screen.getByText('Pipeline Change Failure Rate')).toBeInTheDocument(); + expect(screen.getByText('Pipeline Mean Time To Recovery')).toBeInTheDocument(); }); it('should render loading page when report data is empty', () => { @@ -1108,8 +1108,8 @@ describe('Report Step', () => { expect(screen.getByText('DORA Metrics')).toBeInTheDocument(); expect(screen.getByText('Lead Time For Changes')).toBeInTheDocument(); expect(screen.getByText('Deployment Frequency')).toBeInTheDocument(); - expect(screen.getByText('Dev Change Failure Rate')).toBeInTheDocument(); - expect(screen.getByText('Dev Mean Time To Recovery')).toBeInTheDocument(); + expect(screen.getByText('Pipeline Change Failure Rate')).toBeInTheDocument(); + expect(screen.getByText('Pipeline Mean Time To Recovery')).toBeInTheDocument(); }); it('should select DORA tab when click DORA tab from chart page again', async () => { diff --git a/frontend/__tests__/containers/ShareReport/ShareReport.test.tsx b/frontend/__tests__/containers/ShareReport/ShareReport.test.tsx index df15d364c2..e36588bac2 100644 --- a/frontend/__tests__/containers/ShareReport/ShareReport.test.tsx +++ b/frontend/__tests__/containers/ShareReport/ShareReport.test.tsx @@ -77,8 +77,8 @@ describe('Share Report', () => { 'Classification', 'Lead time for changes', 'Deployment frequency', - 'Dev change failure rate', - 'Dev mean time to recovery', + 'Pipeline change failure rate', + 'Pipeline mean time to recovery', ]; reportHook.current.classificationNames = []; }; @@ -101,8 +101,8 @@ describe('Share Report', () => { expect(screen.getByText('DORA Metrics')).toBeInTheDocument(); expect(screen.getByText('Lead Time For Changes')).toBeInTheDocument(); expect(screen.getByText('Deployment Frequency')).toBeInTheDocument(); - expect(screen.getByText('Dev Change Failure Rate')).toBeInTheDocument(); - expect(screen.getByText('Dev Mean Time To Recovery')).toBeInTheDocument(); + expect(screen.getByText('Pipeline Change Failure Rate')).toBeInTheDocument(); + expect(screen.getByText('Pipeline Mean Time To Recovery')).toBeInTheDocument(); expect(reportHook.current.getData).toHaveBeenCalledTimes(1); }); diff --git a/frontend/__tests__/fixtures.ts b/frontend/__tests__/fixtures.ts index 465a90b475..d69c362ebe 100644 --- a/frontend/__tests__/fixtures.ts +++ b/frontend/__tests__/fixtures.ts @@ -75,8 +75,8 @@ export const REQUIRED_DATA_LIST = [ 'Rework times', 'Lead time for changes', 'Deployment frequency', - 'Dev change failure rate', - 'Dev mean time to recovery', + 'Pipeline change failure rate', + 'Pipeline mean time to recovery', ]; export const ALL = 'All'; export const VELOCITY = 'Velocity'; @@ -85,8 +85,8 @@ export const CLASSIFICATION = 'Classification'; export const REWORK_TIMES = 'Rework times'; export const LEAD_TIME_FOR_CHANGES = 'Lead time for changes'; export const DEPLOYMENT_FREQUENCY = 'Deployment frequency'; -export const DEV_CHANGE_FAILURE_RATE = 'Dev change failure rate'; -export const DEV_MEAN_TIME_TO_RECOVERY = 'Dev mean time to recovery'; +export const PIPELINE_CHANGE_FAILURE_RATE = 'Pipeline change failure rate'; +export const PIPELINE_MEAN_TIME_TO_RECOVERY = 'Pipeline mean time to recovery'; export const REQUIRED_DATA = 'Required metrics'; export const TEST_PROJECT_NAME = 'test project Name'; export const ERROR_MESSAGE_COLOR = 'color: #d32f2f'; @@ -474,12 +474,12 @@ export const MOCK_REPORT_RESPONSE_WITH_AVERAGE_EXCEPTION: ReportResponseDTO = { ], totalDeployTimes: 10, }, - devMeanTimeToRecovery: { - avgDevMeanTimeToRecovery: { + pipelineMeanTimeToRecovery: { + avgPipelineMeanTimeToRecovery: { name: 'Total', timeToRecovery: NaN, }, - devMeanTimeToRecoveryOfPipelines: [ + pipelineMeanTimeToRecoveryOfPipelines: [ { name: 'Heartbeat', step: ':react: Build Frontend', @@ -528,14 +528,14 @@ export const MOCK_REPORT_RESPONSE_WITH_AVERAGE_EXCEPTION: ReportResponseDTO = { totalDelayTime: 5989.22, }, }, - devChangeFailureRate: { - avgDevChangeFailureRate: { + pipelineChangeFailureRate: { + avgPipelineChangeFailureRate: { name: 'Average', totalTimes: 6, totalFailedTimes: 0, failureRate: 0.0, }, - devChangeFailureRateOfPipelines: [ + pipelineChangeFailureRateOfPipelines: [ { name: 'fs-platform-onboarding', step: ' :shipit: deploy to PROD', @@ -612,12 +612,12 @@ export const MOCK_REPORT_RESPONSE: ReportResponseDTO = { ], totalDeployTimes: 10, }, - devMeanTimeToRecovery: { - avgDevMeanTimeToRecovery: { + pipelineMeanTimeToRecovery: { + avgPipelineMeanTimeToRecovery: { name: 'Total', timeToRecovery: 14396108.777777776, }, - devMeanTimeToRecoveryOfPipelines: [ + pipelineMeanTimeToRecoveryOfPipelines: [ { name: 'Heartbeat', step: ':react: Build Frontend', @@ -666,14 +666,14 @@ export const MOCK_REPORT_RESPONSE: ReportResponseDTO = { totalDelayTime: 5989.22, }, }, - devChangeFailureRate: { - avgDevChangeFailureRate: { + pipelineChangeFailureRate: { + avgPipelineChangeFailureRate: { name: 'Average', totalTimes: 6, totalFailedTimes: 0, failureRate: 0.0, }, - devChangeFailureRateOfPipelines: [ + pipelineChangeFailureRateOfPipelines: [ { name: 'fs-platform-onboarding', step: ' :shipit: deploy to PROD', @@ -750,12 +750,12 @@ export const MOCK_REPORT_MOCK_PIPELINE_RESPONSE: ReportResponseDTO = { ], totalDeployTimes: 10, }, - devMeanTimeToRecovery: { - avgDevMeanTimeToRecovery: { + pipelineMeanTimeToRecovery: { + avgPipelineMeanTimeToRecovery: { name: 'Total', timeToRecovery: 14396108.777777776, }, - devMeanTimeToRecoveryOfPipelines: [ + pipelineMeanTimeToRecoveryOfPipelines: [ { name: 'mock pipeline name', step: 'mock step1', @@ -794,14 +794,14 @@ export const MOCK_REPORT_MOCK_PIPELINE_RESPONSE: ReportResponseDTO = { totalDelayTime: 5989.22, }, }, - devChangeFailureRate: { - avgDevChangeFailureRate: { + pipelineChangeFailureRate: { + avgPipelineChangeFailureRate: { name: 'Average', totalTimes: 6, totalFailedTimes: 0, failureRate: 0.0, }, - devChangeFailureRateOfPipelines: [ + pipelineChangeFailureRateOfPipelines: [ { name: 'mock pipeline name', step: 'mock step1', @@ -844,8 +844,8 @@ export const EMPTY_REPORT_VALUES: ReportResponseDTO = { cycleTime: null, rework: null, deploymentFrequency: null, - devChangeFailureRate: null, - devMeanTimeToRecovery: null, + pipelineChangeFailureRate: null, + pipelineMeanTimeToRecovery: null, leadTimeForChanges: null, exportValidityTime: null, boardMetricsCompleted: false, @@ -862,8 +862,8 @@ export const DORA_DATA_FAILED_REPORT_VALUES: ReportResponseDTO = { cycleTime: null, rework: null, deploymentFrequency: null, - devChangeFailureRate: null, - devMeanTimeToRecovery: null, + pipelineChangeFailureRate: null, + pipelineMeanTimeToRecovery: null, leadTimeForChanges: null, exportValidityTime: null, boardMetricsCompleted: true, diff --git a/frontend/__tests__/hooks/reportMapper/changeFailureRate.test.tsx b/frontend/__tests__/hooks/reportMapper/changeFailureRate.test.tsx index 8407fde8a3..dfee7aa9c5 100644 --- a/frontend/__tests__/hooks/reportMapper/changeFailureRate.test.tsx +++ b/frontend/__tests__/hooks/reportMapper/changeFailureRate.test.tsx @@ -1,14 +1,14 @@ -import { devChangeFailureRateMapper } from '@src/hooks/reportMapper/devChangeFailureRate'; +import { pipelineChangeFailureRateMapper } from '@src/hooks/reportMapper/devChangeFailureRate'; describe('dev change failure rate data mapper', () => { - const mockDevChangeFailureRateRes = { - avgDevChangeFailureRate: { + const mockPipelineChangeFailureRateRes = { + avgPipelineChangeFailureRate: { name: 'Average', totalTimes: 12, totalFailedTimes: 0, failureRate: 0.0, }, - devChangeFailureRateOfPipelines: [ + pipelineChangeFailureRateOfPipelines: [ { name: 'fs-platform-onboarding', step: ' :shipit: deploy to PROD', @@ -19,7 +19,7 @@ describe('dev change failure rate data mapper', () => { ], }; it('maps response dev change failure rate values to ui display value', () => { - const expectedDevChangeFailureRateValues = [ + const expectedPipelineChangeFailureRateValues = [ { id: 0, name: 'fs-platform-onboarding/ :shipit: deploy to PROD', @@ -39,8 +39,8 @@ describe('dev change failure rate data mapper', () => { ], }, ]; - const mappedDevChangeFailureRate = devChangeFailureRateMapper(mockDevChangeFailureRateRes); + const mappedPipelineChangeFailureRate = pipelineChangeFailureRateMapper(mockPipelineChangeFailureRateRes); - expect(mappedDevChangeFailureRate).toEqual(expectedDevChangeFailureRateValues); + expect(mappedPipelineChangeFailureRate).toEqual(expectedPipelineChangeFailureRateValues); }); }); diff --git a/frontend/__tests__/hooks/reportMapper/meanTimeToRecovery.test.tsx b/frontend/__tests__/hooks/reportMapper/meanTimeToRecovery.test.tsx index 022d0efd24..3bd7ba7af9 100644 --- a/frontend/__tests__/hooks/reportMapper/meanTimeToRecovery.test.tsx +++ b/frontend/__tests__/hooks/reportMapper/meanTimeToRecovery.test.tsx @@ -1,12 +1,12 @@ -import { devMeanTimeToRecoveryMapper } from '@src/hooks/reportMapper/devMeanTimeToRecovery'; +import { pipelineMeanTimeToRecoveryMapper } from '@src/hooks/reportMapper/devMeanTimeToRecovery'; describe('dev mean time to recovery data mapper', () => { - const mockDevMeanTimeToRecovery = { - avgDevMeanTimeToRecovery: { + const mockPipelineMeanTimeToRecovery = { + avgPipelineMeanTimeToRecovery: { name: 'Average', timeToRecovery: 162120031.8, }, - devMeanTimeToRecoveryOfPipelines: [ + pipelineMeanTimeToRecoveryOfPipelines: [ { name: 'fs-platform-onboarding', step: ' :shipit: deploy to PROD', @@ -15,7 +15,7 @@ describe('dev mean time to recovery data mapper', () => { ], }; it('maps response dev change failure rate values to ui display value', () => { - const expectedDevMeanTimeToRecovery = [ + const expectedPipelineMeanTimeToRecovery = [ { id: 0, name: 'fs-platform-onboarding/ :shipit: deploy to PROD', @@ -35,18 +35,18 @@ describe('dev mean time to recovery data mapper', () => { ], }, ]; - const mappedDevMeanTimeToRecovery = devMeanTimeToRecoveryMapper(mockDevMeanTimeToRecovery); + const mappedPipelineMeanTimeToRecovery = pipelineMeanTimeToRecoveryMapper(mockPipelineMeanTimeToRecovery); - expect(mappedDevMeanTimeToRecovery).toEqual(expectedDevMeanTimeToRecovery); + expect(mappedPipelineMeanTimeToRecovery).toEqual(expectedPipelineMeanTimeToRecovery); }); it('should format time when timeToRecovery is greater than 0 but less than 1', () => { - const mockDevMeanTimeToRecovery = { - avgDevMeanTimeToRecovery: { + const mockPipelineMeanTimeToRecovery = { + avgPipelineMeanTimeToRecovery: { name: 'Average', timeToRecovery: 0.32, }, - devMeanTimeToRecoveryOfPipelines: [ + pipelineMeanTimeToRecoveryOfPipelines: [ { name: 'fs-platform-onboarding', step: ' :shipit: deploy to PROD', @@ -54,7 +54,7 @@ describe('dev mean time to recovery data mapper', () => { }, ], }; - const expectedDevMeanTimeToRecovery = [ + const expectedPipelineMeanTimeToRecovery = [ { id: 0, name: 'fs-platform-onboarding/ :shipit: deploy to PROD', @@ -74,18 +74,18 @@ describe('dev mean time to recovery data mapper', () => { ], }, ]; - const mappedDevMeanTimeToRecovery = devMeanTimeToRecoveryMapper(mockDevMeanTimeToRecovery); + const mappedPipelineMeanTimeToRecovery = pipelineMeanTimeToRecoveryMapper(mockPipelineMeanTimeToRecovery); - expect(mappedDevMeanTimeToRecovery).toEqual(expectedDevMeanTimeToRecovery); + expect(mappedPipelineMeanTimeToRecovery).toEqual(expectedPipelineMeanTimeToRecovery); }); it('should map time to 0 minute when it is 0', () => { - const mockDevMeanTimeToRecovery = { - avgDevMeanTimeToRecovery: { + const mockPipelineMeanTimeToRecovery = { + avgPipelineMeanTimeToRecovery: { name: 'Average', timeToRecovery: 0, }, - devMeanTimeToRecoveryOfPipelines: [ + pipelineMeanTimeToRecoveryOfPipelines: [ { name: 'fs-platform-onboarding', step: ' :shipit: deploy to PROD', @@ -93,7 +93,7 @@ describe('dev mean time to recovery data mapper', () => { }, ], }; - const expectedDevMeanTimeToRecovery = [ + const expectedPipelineMeanTimeToRecovery = [ { id: 0, name: 'fs-platform-onboarding/ :shipit: deploy to PROD', @@ -113,8 +113,8 @@ describe('dev mean time to recovery data mapper', () => { ], }, ]; - const mappedDevMeanTimeToRecovery = devMeanTimeToRecoveryMapper(mockDevMeanTimeToRecovery); + const mappedPipelineMeanTimeToRecovery = pipelineMeanTimeToRecoveryMapper(mockPipelineMeanTimeToRecovery); - expect(mappedDevMeanTimeToRecovery).toEqual(expectedDevMeanTimeToRecovery); + expect(mappedPipelineMeanTimeToRecovery).toEqual(expectedPipelineMeanTimeToRecovery); }); }); diff --git a/frontend/__tests__/hooks/reportMapper/report.test.tsx b/frontend/__tests__/hooks/reportMapper/report.test.tsx index 4922fa9b25..a634060985 100644 --- a/frontend/__tests__/hooks/reportMapper/report.test.tsx +++ b/frontend/__tests__/hooks/reportMapper/report.test.tsx @@ -110,7 +110,7 @@ export const EXPECTED_REPORT_VALUES = { ], }, ], - devMeanTimeToRecoveryList: [ + pipelineMeanTimeToRecoveryList: [ { id: 0, name: 'Heartbeat/:react: Build Frontend', @@ -168,7 +168,7 @@ export const EXPECTED_REPORT_VALUES = { ], }, ], - devChangeFailureRateList: [ + pipelineChangeFailureRateList: [ { id: 0, name: 'fs-platform-onboarding/ :shipit: deploy to PROD', diff --git a/frontend/e2e/fixtures/create-new/board-20240607-20240607.csv b/frontend/e2e/fixtures/create-new/board-20240607-20240607.csv index 0ea24673d0..485122cf18 100644 --- a/frontend/e2e/fixtures/create-new/board-20240607-20240607.csv +++ b/frontend/e2e/fixtures/create-new/board-20240607-20240607.csv @@ -1,6 +1,6 @@ -"Issue key","Summary","Issue Type","Status","Status Date","Story Points","assignee","Reporter","Project Key","Project Name","Priority","Parent Summary","Sprint","Labels","Cycle Time","Story testing-1","Design","Vulnerability","Flagged","Fix versions","Partner","Time tracking","Story point estimate","QA","Feature/Operation","Story testing-2","Cycle Time / Story Points","Todo Days","In Dev Days","Waiting Days","Testing Days","Block Days","Review Days","OriginCycleTime: TODO","OriginCycleTime: TESTING","OriginCycleTime: WAIT FOR TEST","OriginCycleTime: DOING","OriginCycleTime: REVIEW","OriginCycleTime: BLOCKED","Rework: total - In dev","Rework: from Block","Rework: from Review","Rework: from Waiting for testing","Rework: from Testing","Rework: from Done" -"ADM-963","[FE] refine display of dora metrics in chart page when user added multiple pipelines","Bug","Done","2024-06-07","1.0","YinYuan Zhou","Yufan Wang","ADM","Auto Dora Metrics","Medium","Precise on Metrics","Sprint37","","0.98","","","","","","","None","1.0","","","","0.98","0.01","0.14","0.84","0","0","0","0.01","0","0.84","0.14","0","0","0","0","0","0","0","0" -,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -"ADM-976","[BE] sharing data report","Story","Review","2024-07-05","2.0","YinYuan Zhou","Yufan Wang","ADM","Auto Dora Metrics","Medium","easy to use","Sprint40","","0","","","","","","","None","2.0","","","","0","6.83","4.19","0","0","0","0.94","6.83","0","0","4.19","0.94","0",,,,,, -"ADM-981","[FE&BE] calculation improvement: dev mean time to recovery","Story","Doing","2024-07-08","1.0","YinYuan Zhou","Yufan Wang","ADM","Auto Dora Metrics","Medium","Precise on Metrics","Sprint40","","0","","","","","","","None","1.0","","","","0","6.00","0.13","0","0","0","0","6.00","0","0","0.13","0","0",,,,,, -"ADM-973","[FE] sharing data report","Story","Doing","2024-07-05","2.0","Man Tang","Yufan Wang","ADM","Auto Dora Metrics","Medium","easy to use","Sprint40","","0","","","","","","","None","2.0","","","","0","8.03","3.13","0","0","2.00","0","8.03","0","0","3.13","0","2.00",,,,,, +"Issue key","Summary","Issue Type","Status","Status Date","Story Points","assignee","Reporter","Project Key","Project Name","Priority","Parent Summary","Sprint","Labels","Cycle Time","Story testing-1","Design","Vulnerability","Flagged","Fix versions","Partner","Time tracking","Story point estimate","QA","Feature/Operation","Story testing-2","Cycle Time / Story Points","Todo Days","In Dev Days","Waiting Days","Testing Days","Block Days","Review Days","OriginCycleTime: TODO","OriginCycleTime: TESTING","OriginCycleTime: WAIT FOR TEST","OriginCycleTime: DOING","OriginCycleTime: REVIEW","Rework: total - In dev","Rework: from Block","Rework: from Review","Rework: from Waiting for testing","Rework: from Testing","Rework: from Done" +"ADM-963","[FE] refine display of dora metrics in chart page when user added multiple pipelines","Bug","Done","2024-06-07","1.0","YinYuan Zhou","Yufan Wang","ADM","Auto Dora Metrics","Medium","Precise on Metrics","Sprint37","","0.98","","","","","","","None","1.0","","","","0.98","0.01","0.14","0.84","0","0","0","0.01","0","0.84","0.14","0","0","0","0","0","0","0" +,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +"ADM-984","[FE&BE] generate classification charts in report page - p2","Story","Testing","2024-07-29","3.0","YinYuan Zhou","Yufan Wang","ADM","Auto Dora Metrics","Medium","Charting","Sprint 41","","0","","","","","","","None","3.0","","","","0","11.71","3.88","0.01","0.11","0","0","11.71","0.11","0.01","3.88","0",,,,,, +"ADM-983","[FE] add explanation pop-up for dora metrics in report page","Story","Doing","2024-07-29","1.0","YinYuan Zhou","Yufan Wang","ADM","Auto Dora Metrics","Medium","easy to use","Sprint 41","","0","","","","","","","None","1.0","","","","0","18.21","0.09","0","0","0","0","18.21","0","0","0.09","0",,,,,, +"ADM-985","[FE] report chart page is displayed first by default","Story","Doing","2024-07-25","3.0","Man Tang","Yufan Wang","ADM","Auto Dora Metrics","Medium","Charting","Sprint 41","","0","","","","","","","None","3.0","","","","0","6.73","2.27","0","0","0","0","6.73","0","0","2.27","0",,,,,, diff --git a/frontend/e2e/fixtures/create-new/config-step.ts b/frontend/e2e/fixtures/create-new/config-step.ts index 5787bdd308..928d412b05 100644 --- a/frontend/e2e/fixtures/create-new/config-step.ts +++ b/frontend/e2e/fixtures/create-new/config-step.ts @@ -23,8 +23,8 @@ export const config = { 'Rework times', 'Lead time for changes', 'Deployment frequency', - 'Dev change failure rate', - 'Dev mean time to recovery', + 'Pipeline change failure rate', + 'Pipeline mean time to recovery', ], board: { type: 'Jira', diff --git a/frontend/e2e/fixtures/create-new/metric-20240603-20240604.csv b/frontend/e2e/fixtures/create-new/metric-20240603-20240604.csv index 7814c222f8..ad6af39a1f 100644 --- a/frontend/e2e/fixtures/create-new/metric-20240603-20240604.csv +++ b/frontend/e2e/fixtures/create-new/metric-20240603-20240604.csv @@ -54,5 +54,5 @@ "Lead time for changes","Heartbeat / Deploy prod / PR Lead Time","10.78" "Lead time for changes","Heartbeat / Deploy prod / Pipeline Lead Time","0.59" "Lead time for changes","Heartbeat / Deploy prod / Total Lead Time","11.38" -"Dev change failure rate","Heartbeat / Deploy prod / Dev change failure rate","0.0000" -"Dev mean time to recovery","Heartbeat / Deploy prod / Dev mean time to recovery","0" +"Pipeline change failure rate","Heartbeat / Deploy prod / Pipeline change failure rate","0.0000" +"Pipeline mean time to recovery","Heartbeat / Deploy prod / Pipeline mean time to recovery","0" diff --git a/frontend/e2e/fixtures/create-new/metric-20240605-20240606.csv b/frontend/e2e/fixtures/create-new/metric-20240605-20240606.csv index b4050a7924..b476302c28 100644 --- a/frontend/e2e/fixtures/create-new/metric-20240605-20240606.csv +++ b/frontend/e2e/fixtures/create-new/metric-20240605-20240606.csv @@ -44,5 +44,5 @@ "Lead time for changes","Heartbeat / Deploy prod / PR Lead Time","1.86" "Lead time for changes","Heartbeat / Deploy prod / Pipeline Lead Time","0.36" "Lead time for changes","Heartbeat / Deploy prod / Total Lead Time","2.22" -"Dev change failure rate","Heartbeat / Deploy prod / Dev change failure rate","0.0000" -"Dev mean time to recovery","Heartbeat / Deploy prod / Dev mean time to recovery","0" +"Pipeline change failure rate","Heartbeat / Deploy prod / Pipeline change failure rate","0.0000" +"Pipeline mean time to recovery","Heartbeat / Deploy prod / Pipeline mean time to recovery","0" diff --git a/frontend/e2e/fixtures/create-new/metric-20240607-20240607.csv b/frontend/e2e/fixtures/create-new/metric-20240607-20240607.csv index a3663f4083..d5a03a015c 100644 --- a/frontend/e2e/fixtures/create-new/metric-20240607-20240607.csv +++ b/frontend/e2e/fixtures/create-new/metric-20240607-20240607.csv @@ -41,5 +41,5 @@ "Lead time for changes","Heartbeat / Deploy prod / PR Lead Time","0" "Lead time for changes","Heartbeat / Deploy prod / Pipeline Lead Time","0" "Lead time for changes","Heartbeat / Deploy prod / Total Lead Time","0" -"Dev change failure rate","Heartbeat / Deploy prod / Dev change failure rate","0.0000" -"Dev mean time to recovery","Heartbeat / Deploy prod / Dev mean time to recovery","0" +"Pipeline change failure rate","Heartbeat / Deploy prod / Pipeline change failure rate","0.0000" +"Pipeline mean time to recovery","Heartbeat / Deploy prod / Pipeline mean time to recovery","0" diff --git a/frontend/e2e/fixtures/create-new/metrics-step.ts b/frontend/e2e/fixtures/create-new/metrics-step.ts index c70dfe03ea..790142bc83 100644 --- a/frontend/e2e/fixtures/create-new/metrics-step.ts +++ b/frontend/e2e/fixtures/create-new/metrics-step.ts @@ -23,8 +23,8 @@ export const config = { 'Rework times', 'Lead time for changes', 'Deployment frequency', - 'Dev change failure rate', - 'Dev mean time to recovery', + 'Pipeline change failure rate', + 'Pipeline mean time to recovery', ], board: { type: 'Jira', diff --git a/frontend/e2e/fixtures/create-new/report-result.ts b/frontend/e2e/fixtures/create-new/report-result.ts index 9c9a3945c4..b7485f5f9e 100644 --- a/frontend/e2e/fixtures/create-new/report-result.ts +++ b/frontend/e2e/fixtures/create-new/report-result.ts @@ -15,7 +15,7 @@ export interface IDoraMetricsResultItem { deploymentTimes: string; deploymentFrequency: string; failureRate: string; - devMeanTimeToRecovery: string; + pipelineMeanTimeToRecovery: string; } export interface IBoardMetricsDetailItem { @@ -584,7 +584,7 @@ export const DORA_METRICS_RESULT_MULTIPLE_RANGES: IDoraMetricsResultItem[] = [ deploymentFrequency: '0.00', deploymentTimes: '0', failureRate: '0.00% (0/0)', - devMeanTimeToRecovery: '0.00', + pipelineMeanTimeToRecovery: '0.00', }, { prLeadTime: '1.86', @@ -593,7 +593,7 @@ export const DORA_METRICS_RESULT_MULTIPLE_RANGES: IDoraMetricsResultItem[] = [ deploymentFrequency: '0.50', deploymentTimes: '1', failureRate: '0.00% (0/1)', - devMeanTimeToRecovery: '0.00', + pipelineMeanTimeToRecovery: '0.00', }, { prLeadTime: '10.78', @@ -602,7 +602,7 @@ export const DORA_METRICS_RESULT_MULTIPLE_RANGES: IDoraMetricsResultItem[] = [ deploymentFrequency: '2.00', deploymentTimes: '4', failureRate: '0.00% (0/4)', - devMeanTimeToRecovery: '0.00', + pipelineMeanTimeToRecovery: '0.00', }, ]; diff --git a/frontend/e2e/fixtures/import-file/chart-result.ts b/frontend/e2e/fixtures/import-file/chart-result.ts index c45062d57c..fd7bd5c03c 100644 --- a/frontend/e2e/fixtures/import-file/chart-result.ts +++ b/frontend/e2e/fixtures/import-file/chart-result.ts @@ -43,12 +43,12 @@ export const DORA_CHART_VALUE: DoraChartType = { color: '#E82107', value: '75.00%', }, - 'Dev Change Failure Rate': { + 'Pipeline Change Failure Rate': { type: 'trend down', color: '#02C4A8', value: '59.99%', }, - 'Dev Mean Time To Recovery': { + 'Pipeline Mean Time To Recovery': { type: 'trend down', color: '#02C4A8', value: '22.19%', @@ -65,12 +65,12 @@ export const DORA_CHART_VALUE: DoraChartType = { color: '#E82107', value: '75.00%', }, - 'Dev Change Failure Rate': { + 'Pipeline Change Failure Rate': { type: 'trend down', color: '#02C4A8', value: '59.99%', }, - 'Dev Mean Time To Recovery': { + 'Pipeline Mean Time To Recovery': { type: 'trend down', color: '#02C4A8', value: '22.19%', diff --git a/frontend/e2e/fixtures/import-file/metric-with-holiday-data.csv b/frontend/e2e/fixtures/import-file/metric-with-holiday-data.csv index 6b673311b6..a9b0b49f79 100644 --- a/frontend/e2e/fixtures/import-file/metric-with-holiday-data.csv +++ b/frontend/e2e/fixtures/import-file/metric-with-holiday-data.csv @@ -41,5 +41,5 @@ "Lead time for changes","Heartbeat / Deploy prod / PR Lead Time","45.48" "Lead time for changes","Heartbeat / Deploy prod / Pipeline Lead Time","0.83" "Lead time for changes","Heartbeat / Deploy prod / Total Lead Time","46.31" -"Dev change failure rate","Heartbeat / Deploy prod / Dev change failure rate","0.1667" -"Dev mean time to recovery","Heartbeat / Deploy prod / Dev mean time to recovery","0.78" +"Pipeline change failure rate","Heartbeat / Deploy prod / Pipeline change failure rate","0.1667" +"Pipeline mean time to recovery","Heartbeat / Deploy prod / Pipeline mean time to recovery","0.78" diff --git a/frontend/e2e/pages/metrics/report-step.ts b/frontend/e2e/pages/metrics/report-step.ts index 00638a7aae..f1e1125e14 100644 --- a/frontend/e2e/pages/metrics/report-step.ts +++ b/frontend/e2e/pages/metrics/report-step.ts @@ -47,7 +47,7 @@ export class ReportStep { readonly totalLeadTime: Locator; readonly deploymentFrequency: Locator; readonly failureRate: Locator; - readonly devMeanTimeToRecovery: Locator; + readonly pipelineMeanTimeToRecovery: Locator; readonly showMoreLinks: Locator; readonly previousButton: Locator; readonly backButton: Locator; @@ -63,9 +63,9 @@ export class ReportStep { readonly cycleTimeRows: Locator; readonly classificationRows: Locator; readonly leadTimeForChangesRows: Locator; - readonly devChangeFailureRateRows: Locator; + readonly pipelineChangeFailureRateRows: Locator; readonly deploymentFrequencyRows: Locator; - readonly devMeanTimeToRecoveryRows: Locator; + readonly pipelineMeanTimeToRecoveryRows: Locator; readonly reworkRows: Locator; readonly downloadDialog: Locator; readonly displayTabsContainer: Locator; @@ -101,12 +101,12 @@ export class ReportStep { readonly cycleTimeAllocationTrendIcon: Locator; readonly cycleTimeTrendIcon: Locator; readonly doraPipelineSelector: Locator; - readonly devMeanTimeToRecoveryTrendContainer: Locator; - readonly devChangeFailureRateTrendContainer: Locator; + readonly pipelineMeanTimeToRecoveryTrendContainer: Locator; + readonly pipelineChangeFailureRateTrendContainer: Locator; readonly deploymentFrequencyTrendContainer: Locator; readonly leadTimeForChangesTrendContainer: Locator; - readonly devMeanTimeToRecoveryTrendIcon: Locator; - readonly devChangeFailureRateTrendIcon: Locator; + readonly pipelineMeanTimeToRecoveryTrendIcon: Locator; + readonly pipelineChangeFailureRateTrendIcon: Locator; readonly deploymentFrequencyTrendIcon: Locator; readonly leadTimeForChangesTrendIcon: Locator; readonly classificationIssueTypeChartSwitchIcon: Locator; @@ -134,9 +134,11 @@ export class ReportStep { this.deploymentFrequency = this.page.locator( '[data-test-id="Deployment Frequency"] [data-test-id="report-section"]', ); - this.failureRate = this.page.locator('[data-test-id="Dev Change Failure Rate"] [data-test-id="report-section"]'); - this.devMeanTimeToRecovery = this.page.locator( - '[data-test-id="Dev Mean Time To Recovery"] [data-test-id="report-section"]', + this.failureRate = this.page.locator( + '[data-test-id="Pipeline Change Failure Rate"] [data-test-id="report-section"]', + ); + this.pipelineMeanTimeToRecovery = this.page.locator( + '[data-test-id="Pipeline Mean Time To Recovery"] [data-test-id="report-section"]', ); this.showMoreLinks = this.page.getByText('show more >'); this.previousButton = page.getByRole('button', { name: 'Previous' }); @@ -154,9 +156,12 @@ export class ReportStep { this.deploymentFrequencyRows = this.page.getByLabel('Deployment Frequency').locator('tbody').getByRole('row'); this.classificationRows = this.page.getByTestId('Classification').locator('tbody').getByRole('row'); this.leadTimeForChangesRows = this.page.getByTestId('Lead Time For Changes').getByRole('row'); - this.devChangeFailureRateRows = this.page.getByTestId('Dev Change Failure Rate').locator('tbody').getByRole('row'); - this.devMeanTimeToRecoveryRows = this.page - .getByTestId('Dev Mean Time To Recovery') + this.pipelineChangeFailureRateRows = this.page + .getByTestId('Pipeline Change Failure Rate') + .locator('tbody') + .getByRole('row'); + this.pipelineMeanTimeToRecoveryRows = this.page + .getByTestId('Pipeline Mean Time To Recovery') .locator('tbody') .getByRole('row'); this.reworkRows = this.page.getByTestId('Rework').getByRole('row'); @@ -200,12 +205,14 @@ export class ReportStep { this.doraPipelineSelector = this.page.getByLabel('Pipeline Selector').first(); this.leadTimeForChangesTrendContainer = this.page.getByLabel('lead time for changes trend container'); this.deploymentFrequencyTrendContainer = this.page.getByLabel('deployment frequency trend container'); - this.devChangeFailureRateTrendContainer = this.page.getByLabel('dev change failure rate trend container'); - this.devMeanTimeToRecoveryTrendContainer = this.page.getByLabel('dev mean time to recovery trend container'); + this.pipelineChangeFailureRateTrendContainer = this.page.getByLabel('pipeline change failure rate trend container'); + this.pipelineMeanTimeToRecoveryTrendContainer = this.page.getByLabel( + 'pipeline mean time to recovery trend container', + ); this.leadTimeForChangesTrendIcon = this.leadTimeForChangesTrendContainer.getByLabel('trend down'); this.deploymentFrequencyTrendIcon = this.deploymentFrequencyTrendContainer.getByLabel('trend down'); - this.devChangeFailureRateTrendIcon = this.devChangeFailureRateTrendContainer.getByLabel('trend down'); - this.devMeanTimeToRecoveryTrendIcon = this.devMeanTimeToRecoveryTrendContainer.getByLabel('trend down'); + this.pipelineChangeFailureRateTrendIcon = this.pipelineChangeFailureRateTrendContainer.getByLabel('trend down'); + this.pipelineMeanTimeToRecoveryTrendIcon = this.pipelineMeanTimeToRecoveryTrendContainer.getByLabel('trend down'); } combineStrings(arr: string[]): string { return arr.join(''); @@ -242,13 +249,13 @@ export class ReportStep { this.combineStrings(['Total Lead Time', doraMetricsDetailData.totalLeadTime]), ); - await expect(this.devChangeFailureRateRows.getByRole('cell').nth(0)).toContainText('Heartbeat/ Deploy prod'); - await expect(this.devChangeFailureRateRows.getByRole('cell').nth(1)).toContainText( + await expect(this.pipelineChangeFailureRateRows.getByRole('cell').nth(0)).toContainText('Heartbeat/ Deploy prod'); + await expect(this.pipelineChangeFailureRateRows.getByRole('cell').nth(1)).toContainText( doraMetricsDetailData.failureRate.replace(' ', ''), ); - await expect(this.devMeanTimeToRecoveryRows.getByRole('cell').nth(0)).toContainText('Heartbeat/ Deploy prod'); - await expect(this.devMeanTimeToRecoveryRows.getByRole('cell').nth(1)).toContainText( - doraMetricsDetailData.devMeanTimeToRecovery, + await expect(this.pipelineMeanTimeToRecoveryRows.getByRole('cell').nth(0)).toContainText('Heartbeat/ Deploy prod'); + await expect(this.pipelineMeanTimeToRecoveryRows.getByRole('cell').nth(1)).toContainText( + doraMetricsDetailData.pipelineMeanTimeToRecovery, ); } @@ -474,28 +481,28 @@ export class ReportStep { await expect(this.totalLeadTime).toBeVisible(); await expect(this.deploymentFrequency).toBeHidden(); await expect(this.failureRate).toBeHidden(); - await expect(this.devMeanTimeToRecovery).toBeHidden(); + await expect(this.pipelineMeanTimeToRecovery).toBeHidden(); } async checkOnlyDeploymentFrequencyPartVisible() { await expect(this.totalLeadTime).toBeHidden(); await expect(this.deploymentFrequency).toBeVisible(); await expect(this.failureRate).toBeHidden(); - await expect(this.devMeanTimeToRecovery).toBeHidden(); + await expect(this.pipelineMeanTimeToRecovery).toBeHidden(); } async checkOnlyChangeFailureRatePartVisible() { await expect(this.totalLeadTime).toBeHidden(); await expect(this.deploymentFrequency).toBeHidden(); await expect(this.failureRate).toBeVisible(); - await expect(this.devMeanTimeToRecovery).toBeHidden(); + await expect(this.pipelineMeanTimeToRecovery).toBeHidden(); } async checkOnlyMeanTimeToRecoveryPartVisible() { await expect(this.totalLeadTime).toBeHidden(); await expect(this.deploymentFrequency).toBeHidden(); await expect(this.failureRate).toBeHidden(); - await expect(this.devMeanTimeToRecovery).toBeVisible(); + await expect(this.pipelineMeanTimeToRecovery).toBeVisible(); } async checkExportMetricDataButtonClickable() { @@ -626,7 +633,7 @@ export class ReportStep { totalLeadTime, deploymentFrequency, failureRate, - devMeanTimeToRecovery, + pipelineMeanTimeToRecovery, deploymentTimes, }: IDoraMetricsResultItem) { await expect(this.prLeadTime).toContainText(`${prLeadTime}PR Lead Time(Hours)`); @@ -636,7 +643,7 @@ export class ReportStep { `${deploymentFrequency}Deployments/Days${deploymentTimes}Deployment times`, ); await expect(this.failureRate).toContainText(failureRate); - await expect(this.devMeanTimeToRecovery).toContainText(`${devMeanTimeToRecovery}(Hours)`); + await expect(this.pipelineMeanTimeToRecovery).toContainText(`${pipelineMeanTimeToRecovery}(Hours)`); } async checkDoraMetricsForMultipleRanges(data: IDoraMetricsResultItem[]) { @@ -827,18 +834,18 @@ export class ReportStep { pipeline, showLeadTimeForChangeChart, showDeploymentFrequencyChart, - showDevChangeFailureRateTrendContainer, - showDevChangeFailureRateChart, - showDevMeanTimeToRecoveryChart, - showDevMeanTimeToRecoveryTrendContainer, + showPipelineChangeFailureRateTrendContainer, + showPipelineChangeFailureRateChart, + showPipelineMeanTimeToRecoveryChart, + showPipelineMeanTimeToRecoveryTrendContainer, }: { pipeline: string; showLeadTimeForChangeChart: boolean; showDeploymentFrequencyChart: boolean; - showDevChangeFailureRateTrendContainer: boolean; - showDevChangeFailureRateChart: boolean; - showDevMeanTimeToRecoveryTrendContainer: boolean; - showDevMeanTimeToRecoveryChart: boolean; + showPipelineChangeFailureRateTrendContainer: boolean; + showPipelineChangeFailureRateChart: boolean; + showPipelineMeanTimeToRecoveryTrendContainer: boolean; + showPipelineMeanTimeToRecoveryChart: boolean; }) { const pipelineDoraChartValue = DORA_CHART_VALUE[pipeline]; expect(await this.displayBoardChartTab.getAttribute('aria-selected')).toEqual('false'); @@ -887,48 +894,48 @@ export class ReportStep { await expect(this.deploymentFrequencyTrendIcon).not.toBeVisible(); } - if (showDevChangeFailureRateChart) { + if (showPipelineChangeFailureRateChart) { await expect(this.changeFailureRateChart).toBeVisible(); - if (showDevChangeFailureRateTrendContainer) { - await expect(this.devChangeFailureRateTrendContainer).toBeVisible(); - await expect(this.devChangeFailureRateTrendContainer).toHaveAttribute( + if (showPipelineChangeFailureRateTrendContainer) { + await expect(this.pipelineChangeFailureRateTrendContainer).toBeVisible(); + await expect(this.pipelineChangeFailureRateTrendContainer).toHaveAttribute( 'color', - pipelineDoraChartValue['Dev Change Failure Rate'].color, + pipelineDoraChartValue['Pipeline Change Failure Rate'].color, ); - await expect(this.devChangeFailureRateTrendIcon).toBeVisible(); - await expect(this.devChangeFailureRateTrendContainer).toContainText( - pipelineDoraChartValue['Dev Change Failure Rate'].value, + await expect(this.pipelineChangeFailureRateTrendIcon).toBeVisible(); + await expect(this.pipelineChangeFailureRateTrendContainer).toContainText( + pipelineDoraChartValue['Pipeline Change Failure Rate'].value, ); } else { - await expect(this.devChangeFailureRateTrendContainer).not.toBeVisible(); - await expect(this.devChangeFailureRateTrendIcon).not.toBeVisible(); + await expect(this.pipelineChangeFailureRateTrendContainer).not.toBeVisible(); + await expect(this.pipelineChangeFailureRateTrendIcon).not.toBeVisible(); } } else { await expect(this.changeFailureRateChart).not.toBeVisible(); - await expect(this.devChangeFailureRateTrendContainer).not.toBeVisible(); - await expect(this.devChangeFailureRateTrendIcon).not.toBeVisible(); + await expect(this.pipelineChangeFailureRateTrendContainer).not.toBeVisible(); + await expect(this.pipelineChangeFailureRateTrendIcon).not.toBeVisible(); } - if (showDevMeanTimeToRecoveryChart) { + if (showPipelineMeanTimeToRecoveryChart) { await expect(this.meanTimeToRecoveryChart).toBeVisible(); - if (showDevMeanTimeToRecoveryTrendContainer) { - await expect(this.devMeanTimeToRecoveryTrendContainer).toBeVisible(); - await expect(this.devMeanTimeToRecoveryTrendContainer).toHaveAttribute( + if (showPipelineMeanTimeToRecoveryTrendContainer) { + await expect(this.pipelineMeanTimeToRecoveryTrendContainer).toBeVisible(); + await expect(this.pipelineMeanTimeToRecoveryTrendContainer).toHaveAttribute( 'color', - pipelineDoraChartValue['Dev Mean Time To Recovery'].color, + pipelineDoraChartValue['Pipeline Mean Time To Recovery'].color, ); - await expect(this.devMeanTimeToRecoveryTrendIcon).toBeVisible(); - await expect(this.devMeanTimeToRecoveryTrendContainer).toContainText( - pipelineDoraChartValue['Dev Mean Time To Recovery'].value, + await expect(this.pipelineMeanTimeToRecoveryTrendIcon).toBeVisible(); + await expect(this.pipelineMeanTimeToRecoveryTrendContainer).toContainText( + pipelineDoraChartValue['Pipeline Mean Time To Recovery'].value, ); } else { - await expect(this.devMeanTimeToRecoveryTrendContainer).not.toBeVisible(); - await expect(this.devMeanTimeToRecoveryTrendIcon).not.toBeVisible(); + await expect(this.pipelineMeanTimeToRecoveryTrendContainer).not.toBeVisible(); + await expect(this.pipelineMeanTimeToRecoveryTrendIcon).not.toBeVisible(); } } else { await expect(this.meanTimeToRecoveryChart).not.toBeVisible(); - await expect(this.devMeanTimeToRecoveryTrendContainer).not.toBeVisible(); - await expect(this.devMeanTimeToRecoveryTrendIcon).not.toBeVisible(); + await expect(this.pipelineMeanTimeToRecoveryTrendContainer).not.toBeVisible(); + await expect(this.pipelineMeanTimeToRecoveryTrendIcon).not.toBeVisible(); } } @@ -991,12 +998,12 @@ export class ReportStep { await singleOption.nth(i).click(); this.checkChartDoraTabStatus({ pipeline: pipelines[i], - showDevMeanTimeToRecoveryTrendContainer: showDevMeanTimeToRecoveryTrendContainer, + showPipelineMeanTimeToRecoveryTrendContainer: showDevMeanTimeToRecoveryTrendContainer, showLeadTimeForChangeChart: showLeadTimeForChangeChart, showDeploymentFrequencyChart: showDeploymentFrequencyChart, - showDevChangeFailureRateTrendContainer: showDevChangeFailureRateTrendContainer, - showDevChangeFailureRateChart: showDevChangeFailureRateChart, - showDevMeanTimeToRecoveryChart: showDevMeanTimeToRecoveryChart, + showPipelineChangeFailureRateTrendContainer: showDevChangeFailureRateTrendContainer, + showPipelineChangeFailureRateChart: showDevChangeFailureRateChart, + showPipelineMeanTimeToRecoveryChart: showDevMeanTimeToRecoveryChart, }); } } diff --git a/frontend/e2e/specs/major-path/import-project-from-file.spec.ts b/frontend/e2e/specs/major-path/import-project-from-file.spec.ts index 91437ef12f..515070f598 100644 --- a/frontend/e2e/specs/major-path/import-project-from-file.spec.ts +++ b/frontend/e2e/specs/major-path/import-project-from-file.spec.ts @@ -244,7 +244,7 @@ test('Import project from file with holiday', async ({ homePage, configStep, met totalLeadTime: DORA_METRICS_WITH_HOLIDAY_RESULT.TotalLeadTime, deploymentFrequency: DORA_METRICS_WITH_HOLIDAY_RESULT.DeploymentFrequency, failureRate: DORA_METRICS_WITH_HOLIDAY_RESULT.FailureRate, - devMeanTimeToRecovery: DORA_METRICS_WITH_HOLIDAY_RESULT.DevMeanTimeToRecovery, + pipelineMeanTimeToRecovery: DORA_METRICS_WITH_HOLIDAY_RESULT.DevMeanTimeToRecovery, deploymentTimes: DORA_METRICS_WITH_HOLIDAY_RESULT.DeploymentTimes, }); await reportStep.checkDownloadWithHolidayReports(); diff --git a/frontend/e2e/specs/side-path/unhappy-path.spec.ts b/frontend/e2e/specs/side-path/unhappy-path.spec.ts index c026e50d84..3c922465f1 100644 --- a/frontend/e2e/specs/side-path/unhappy-path.spec.ts +++ b/frontend/e2e/specs/side-path/unhappy-path.spec.ts @@ -88,7 +88,7 @@ test('unhappy path when import file', async ({ homePage, configStep, metricsStep totalLeadTime: DORA_METRICS_RESULT.TotalLeadTime, deploymentFrequency: DORA_METRICS_RESULT.DeploymentFrequency, failureRate: DORA_METRICS_RESULT.FailureRate, - devMeanTimeToRecovery: DORA_METRICS_RESULT.DevMeanTimeToRecovery, + pipelineMeanTimeToRecovery: DORA_METRICS_RESULT.DevMeanTimeToRecovery, deploymentTimes: DORA_METRICS_RESULT.DeploymentTimes, }); }); diff --git a/frontend/src/clients/report/ReportClient.ts b/frontend/src/clients/report/ReportClient.ts index f6c2efdc23..a57dad9369 100644 --- a/frontend/src/clients/report/ReportClient.ts +++ b/frontend/src/clients/report/ReportClient.ts @@ -72,21 +72,21 @@ export class ReportClient extends HttpClient { totalDelayTime: 1, }, }, - devChangeFailureRate: { - avgDevChangeFailureRate: { + pipelineChangeFailureRate: { + avgPipelineChangeFailureRate: { name: '', totalTimes: 0, totalFailedTimes: 0, failureRate: 0.0, }, - devChangeFailureRateOfPipelines: [], + pipelineChangeFailureRateOfPipelines: [], }, reportMetricsError: { boardMetricsError: null, pipelineMetricsError: null, sourceControlMetricsError: null, }, - devMeanTimeToRecovery: null, + pipelineMeanTimeToRecovery: null, exportValidityTime: null, boardMetricsCompleted: false, doraMetricsCompleted: false, diff --git a/frontend/src/clients/report/dto/response.ts b/frontend/src/clients/report/dto/response.ts index 73487571cb..06e91c8e26 100644 --- a/frontend/src/clients/report/dto/response.ts +++ b/frontend/src/clients/report/dto/response.ts @@ -7,9 +7,9 @@ export interface ReportResponseDTO { rework: Nullable; classificationList: Nullable; deploymentFrequency: Nullable; - devMeanTimeToRecovery: Nullable; + pipelineMeanTimeToRecovery: Nullable; leadTimeForChanges: Nullable; - devChangeFailureRate: Nullable; + pipelineChangeFailureRate: Nullable; exportValidityTime: Nullable; boardMetricsCompleted: boolean | null; doraMetricsCompleted: boolean | null; @@ -75,9 +75,9 @@ export interface LeadTimeForChangesResponse { avgLeadTimeForChanges: AvgLeadTime; } -export interface DevChangeFailureRateResponse { - avgDevChangeFailureRate: AvgFailureRate; - devChangeFailureRateOfPipelines: FailureRateOfPipeline[]; +export interface PipelineChangeFailureRateResponse { + avgPipelineChangeFailureRate: AvgFailureRate; + pipelineChangeFailureRateOfPipelines: FailureRateOfPipeline[]; } export interface Swimlane { @@ -138,20 +138,20 @@ export interface AvgFailureRate { failureRate: number; } -export interface DevMeanTimeToRecoveryOfPipeline { +export interface PipelineMeanTimeToRecoveryOfPipeline { name: string; step: string; timeToRecovery: number; } -export interface AvgDevMeanTimeToRecovery { +export interface AvgPipelineMeanTimeToRecovery { name: string; timeToRecovery: number; } -export interface DevMeanTimeToRecoveryResponse { - avgDevMeanTimeToRecovery: AvgDevMeanTimeToRecovery; - devMeanTimeToRecoveryOfPipelines: DevMeanTimeToRecoveryOfPipeline[]; +export interface PipelineMeanTimeToRecoveryResponse { + avgPipelineMeanTimeToRecovery: AvgPipelineMeanTimeToRecovery; + pipelineMeanTimeToRecoveryOfPipelines: PipelineMeanTimeToRecoveryOfPipeline[]; } export interface ClassificationInfoList { @@ -173,9 +173,9 @@ export interface ReportResponse { reworkList?: ReportDataWithTwoColumns[] | null; classification?: ReportDataWithThreeColumns[] | null; deploymentFrequencyList?: ReportDataWithTwoColumns[] | null; - devMeanTimeToRecoveryList?: ReportDataWithTwoColumns[] | null; + pipelineMeanTimeToRecoveryList?: ReportDataWithTwoColumns[] | null; leadTimeForChangesList?: ReportDataWithThreeColumns[] | null; - devChangeFailureRateList?: ReportDataWithTwoColumns[] | null; + pipelineChangeFailureRateList?: ReportDataWithTwoColumns[] | null; exportValidityTimeMin?: number | null; classificationCardCount?: ReportDataWithThreeColumns[] | null; } diff --git a/frontend/src/components/Common/ReportForTwoColumns/index.tsx b/frontend/src/components/Common/ReportForTwoColumns/index.tsx index dceffbb968..17eac30297 100644 --- a/frontend/src/components/Common/ReportForTwoColumns/index.tsx +++ b/frontend/src/components/Common/ReportForTwoColumns/index.tsx @@ -77,7 +77,7 @@ export const ReportForTwoColumns = ({ title, data }: ReportForTwoColumnsProps) = }; const getTitleUnit = (title: string) => { - if (title === MetricsTitle.DevMeanTimeToRecovery) { + if (title === MetricsTitle.PipelineMeanTimeToRecovery) { return ReportSuffixUnits.Hours; } else { return ''; diff --git a/frontend/src/constants/fileConfig.ts b/frontend/src/constants/fileConfig.ts index e508bc647c..d03ac32016 100644 --- a/frontend/src/constants/fileConfig.ts +++ b/frontend/src/constants/fileConfig.ts @@ -174,8 +174,21 @@ export const convertToNewFileConfig = (fileConfig: OldFileConfig | NewFileConfig } else if (fileConfig.calendarType?.toLocaleLowerCase() === CALENDAR_LABEL[Calendar.China].toLocaleLowerCase()) { fileConfig.calendarType = Calendar.China; } + const metrics: string[] = []; + if (fileConfig.metrics) { + fileConfig.metrics.forEach((it) => { + if (it === 'Dev mean time to recovery') { + metrics.push('Pipeline mean time to recovery'); + } else if (it === 'Dev change failure rate') { + metrics.push('Pipeline change failure rate'); + } else { + metrics.push(it); + } + }); + } return { ...fileConfig, + metrics, reworkTimesSettings: filterExcludeReworkStatus(fileConfig.reworkTimesSettings), } as NewFileConfig; }; diff --git a/frontend/src/constants/resources.ts b/frontend/src/constants/resources.ts index 54977d92d7..cbb8c3e962 100644 --- a/frontend/src/constants/resources.ts +++ b/frontend/src/constants/resources.ts @@ -68,8 +68,8 @@ export enum RequiredData { ReworkTimes = 'Rework times', LeadTimeForChanges = 'Lead time for changes', DeploymentFrequency = 'Deployment frequency', - DevChangeFailureRate = 'Dev change failure rate', - DevMeanTimeToRecovery = 'Dev mean time to recovery', + PipelineChangeFailureRate = 'Pipeline change failure rate', + PipelineMeanTimeToRecovery = 'Pipeline mean time to recovery', } export const IMPORT_METRICS_MAPPING: Record = { @@ -79,10 +79,10 @@ export const IMPORT_METRICS_MAPPING: Record = { 'Rework times': 'Rework times', 'Lead time for changes': 'Lead time for changes', 'Deployment frequency': 'Deployment frequency', - 'Dev change failure rate': 'Dev change failure rate', - 'Dev mean time to recovery': 'Dev mean time to recovery', - 'Change failure rate': 'Dev change failure rate', - 'Mean time to recovery': 'Dev mean time to recovery', + 'Pipeline change failure rate': 'Pipeline change failure rate', + 'Pipeline mean time to recovery': 'Pipeline mean time to recovery', + 'Change failure rate': 'Pipeline change failure rate', + 'Mean time to recovery': 'Pipeline mean time to recovery', }; export enum MetricsTitle { @@ -92,8 +92,8 @@ export enum MetricsTitle { Rework = 'Rework', LeadTimeForChanges = 'Lead Time For Changes', DeploymentFrequency = 'Deployment Frequency', - DevChangeFailureRate = 'Dev Change Failure Rate', - DevMeanTimeToRecovery = 'Dev Mean Time To Recovery', + PipelineChangeFailureRate = 'Pipeline Change Failure Rate', + PipelineMeanTimeToRecovery = 'Pipeline Mean Time To Recovery', } export enum ChartType { @@ -164,15 +164,15 @@ export const SOURCE_CONTROL_METRICS: string[] = [RequiredData.LeadTimeForChanges export const PIPELINE_METRICS: string[] = [ RequiredData.DeploymentFrequency, - RequiredData.DevChangeFailureRate, - RequiredData.DevMeanTimeToRecovery, + RequiredData.PipelineChangeFailureRate, + RequiredData.PipelineMeanTimeToRecovery, ]; export const DORA_METRICS: string[] = [ RequiredData.LeadTimeForChanges, RequiredData.DeploymentFrequency, - RequiredData.DevChangeFailureRate, - RequiredData.DevMeanTimeToRecovery, + RequiredData.PipelineChangeFailureRate, + RequiredData.PipelineMeanTimeToRecovery, ]; export const BOARD_METRICS: string[] = [ diff --git a/frontend/src/containers/ConfigStep/Form/literal.ts b/frontend/src/containers/ConfigStep/Form/literal.ts index 24cdb92cb6..8939ceefb8 100644 --- a/frontend/src/containers/ConfigStep/Form/literal.ts +++ b/frontend/src/containers/ConfigStep/Form/literal.ts @@ -15,8 +15,8 @@ export const METRICS_LITERAL = [ 'Rework times', 'Lead time for changes', 'Deployment frequency', - 'Dev change failure rate', - 'Dev mean time to recovery', + 'Pipeline change failure rate', + 'Pipeline mean time to recovery', ]; export const BOARD_TYPE_LITERAL = ['Jira']; export const PIPELINE_TOOL_TYPE_LITERAL = ['BuildKite']; diff --git a/frontend/src/containers/MetricsStep/index.tsx b/frontend/src/containers/MetricsStep/index.tsx index 69396e9ce6..81197ba8f9 100644 --- a/frontend/src/containers/MetricsStep/index.tsx +++ b/frontend/src/containers/MetricsStep/index.tsx @@ -173,9 +173,9 @@ const MetricsStep = () => { )} {(requiredData.includes(RequiredData.DeploymentFrequency) || - requiredData.includes(RequiredData.DevChangeFailureRate) || + requiredData.includes(RequiredData.PipelineChangeFailureRate) || requiredData.includes(RequiredData.LeadTimeForChanges) || - requiredData.includes(RequiredData.DevMeanTimeToRecovery)) && ( + requiredData.includes(RequiredData.PipelineMeanTimeToRecovery)) && ( Pipeline configuration diff --git a/frontend/src/containers/MetricsStepper/index.tsx b/frontend/src/containers/MetricsStepper/index.tsx index 946975357b..f9459afb86 100644 --- a/frontend/src/containers/MetricsStepper/index.tsx +++ b/frontend/src/containers/MetricsStepper/index.tsx @@ -149,9 +149,9 @@ const MetricsStepper = () => { metricsConfig.cycleTimeSettings.filter(({ value }) => value === METRICS_CONSTANTS.doneValue).length > 1; const isShowDeploymentFrequency = requiredData.includes(RequiredData.DeploymentFrequency) || - requiredData.includes(RequiredData.DevChangeFailureRate) || + requiredData.includes(RequiredData.PipelineChangeFailureRate) || requiredData.includes(RequiredData.LeadTimeForChanges) || - requiredData.includes(RequiredData.DevMeanTimeToRecovery); + requiredData.includes(RequiredData.PipelineMeanTimeToRecovery); const isCrewsSettingValid = metricsConfig.users.length > 0; const isRealDoneValid = metricsConfig.doneColumn.length > 0; diff --git a/frontend/src/containers/ReportStep/DoraMetrics/index.tsx b/frontend/src/containers/ReportStep/DoraMetrics/index.tsx index 5a32e4fd1b..75200ee09b 100644 --- a/frontend/src/containers/ReportStep/DoraMetrics/index.tsx +++ b/frontend/src/containers/ReportStep/DoraMetrics/index.tsx @@ -84,16 +84,16 @@ const DoraMetrics = ({ startToRequestDoraData, onShowDetail, doraReport, errorMe }; const getPipelineItems = () => { - const devMeanTimeToRecovery = doraReport?.devMeanTimeToRecovery; - const devChangeFailureRate = doraReport?.devChangeFailureRate; + const devMeanTimeToRecovery = doraReport?.pipelineMeanTimeToRecovery; + const devChangeFailureRate = doraReport?.pipelineChangeFailureRate; - const devMeanTimeToRecoveryList = metrics.includes(RequiredData.DevMeanTimeToRecovery) + const devMeanTimeToRecoveryList = metrics.includes(RequiredData.PipelineMeanTimeToRecovery) ? [ { - title: MetricsTitle.DevMeanTimeToRecovery, + title: MetricsTitle.PipelineMeanTimeToRecovery, items: devMeanTimeToRecovery && [ { - value: formatMillisecondsToHours(devMeanTimeToRecovery.avgDevMeanTimeToRecovery.timeToRecovery), + value: formatMillisecondsToHours(devMeanTimeToRecovery.avgPipelineMeanTimeToRecovery.timeToRecovery), subtitle: MetricsSubtitle.DevMeanTimeToRecoveryHours, }, ], @@ -101,14 +101,14 @@ const DoraMetrics = ({ startToRequestDoraData, onShowDetail, doraReport, errorMe ] : []; - const devChangeFailureRateList = metrics.includes(RequiredData.DevChangeFailureRate) + const devChangeFailureRateList = metrics.includes(RequiredData.PipelineChangeFailureRate) ? [ { - title: MetricsTitle.DevChangeFailureRate, + title: MetricsTitle.PipelineChangeFailureRate, items: devChangeFailureRate && [ { - value: devChangeFailureRate.avgDevChangeFailureRate.failureRate * 100, - extraValue: `% (${devChangeFailureRate.avgDevChangeFailureRate.totalFailedTimes}/${devChangeFailureRate.avgDevChangeFailureRate.totalTimes})`, + value: devChangeFailureRate.avgPipelineChangeFailureRate.failureRate * 100, + extraValue: `% (${devChangeFailureRate.avgPipelineChangeFailureRate.totalFailedTimes}/${devChangeFailureRate.avgPipelineChangeFailureRate.totalTimes})`, subtitle: MetricsSubtitle.FailureRate, }, ], diff --git a/frontend/src/containers/ReportStep/DoraMetricsChart/index.tsx b/frontend/src/containers/ReportStep/DoraMetricsChart/index.tsx index 05603789b7..6ae8e9447c 100644 --- a/frontend/src/containers/ReportStep/DoraMetricsChart/index.tsx +++ b/frontend/src/containers/ReportStep/DoraMetricsChart/index.tsx @@ -42,8 +42,8 @@ interface DoraMetricsChartProps { enum DORAMetricsChartType { LeadTimeForChanges = 'leadTimeForChangesList', DeploymentFrequency = 'deploymentFrequencyList', - DevChangeFailureRate = 'devChangeFailureRateList', - DevMeanTimeToRecovery = 'devMeanTimeToRecoveryList', + PipelineChangeFailureRate = 'pipelineChangeFailureRateList', + PipelineMeanTimeToRecovery = 'pipelineMeanTimeToRecoveryList', } const AVERAGE = 'Average'; @@ -164,7 +164,7 @@ function extractedChangeFailureRateData( mappedData: ReportResponse[] | undefined, selectedPipeline: string, ) { - const data = mappedData?.map((item) => item.devChangeFailureRateList); + const data = mappedData?.map((item) => item.pipelineChangeFailureRateList); const value = data?.map((items) => { const averageItem = items?.find((item) => selectedPipeline === DEFAULT_SELECTED_PIPELINE ? item.name === AVERAGE : item.name === selectedPipeline, @@ -181,7 +181,7 @@ function extractedChangeFailureRateData( }); const trendInfo = calculateTrendInfo(value, allDateRanges, ChartType.DevChangeFailureRate); return { - legend: RequiredData.DevChangeFailureRate, + legend: RequiredData.PipelineChangeFailureRate, xAxis: allDateRanges, yAxis: { name: 'Failed/Total', @@ -189,7 +189,7 @@ function extractedChangeFailureRateData( alignTick: false, }, series: { - name: RequiredData.DevChangeFailureRate, + name: RequiredData.PipelineChangeFailureRate, type: 'line', data: value!, tooltip: { @@ -206,7 +206,7 @@ function extractedMeanTimeToRecoveryDataData( mappedData: ReportResponse[] | undefined, selectedPipeline: string, ) { - const data = mappedData?.map((item) => item.devMeanTimeToRecoveryList); + const data = mappedData?.map((item) => item.pipelineMeanTimeToRecoveryList); const value = data?.map((items) => { const totalItem = items?.find((item) => selectedPipeline === DEFAULT_SELECTED_PIPELINE ? item.name === TOTAL : item.name === selectedPipeline, @@ -216,7 +216,7 @@ function extractedMeanTimeToRecoveryDataData( }); const trendInfo = calculateTrendInfo(value, allDateRanges, ChartType.DevMeanTimeToRecovery); return { - legend: RequiredData.DevMeanTimeToRecovery, + legend: RequiredData.PipelineMeanTimeToRecovery, xAxis: allDateRanges, yAxis: { name: 'Hours', @@ -224,7 +224,7 @@ function extractedMeanTimeToRecoveryDataData( axisLabel: NO_LABEL, }, series: { - name: RequiredData.DevMeanTimeToRecovery, + name: RequiredData.PipelineMeanTimeToRecovery, type: 'line', data: value!, }, @@ -245,8 +245,8 @@ function isDoraMetricsChartFinish({ | ReportResponse | { deploymentFrequencyList: ChartValueSource[]; - devChangeFailureRateList: ChartValueSource[]; - devMeanTimeToRecoveryList: ChartValueSource[]; + pipelineChangeFailureRateList: ChartValueSource[]; + pipelineMeanTimeToRecoveryList: ChartValueSource[]; exportValidityTimeMin: number; leadTimeForChangesList: ChartValueSource[]; } @@ -256,7 +256,7 @@ function isDoraMetricsChartFinish({ const valueList = mappedData .flatMap((value) => value[type] as unknown as ChartValueSource[]) .filter((value) => - type === DORAMetricsChartType.DevMeanTimeToRecovery ? value?.name === TOTAL : value?.name === AVERAGE, + type === DORAMetricsChartType.PipelineMeanTimeToRecovery ? value?.name === TOTAL : value?.name === AVERAGE, ) .map((value) => value?.valueList); @@ -301,12 +301,12 @@ export const DoraMetricsChart = ({ const isDevChangeFailureRateFinished: boolean = isDoraMetricsChartFinish({ dateRangeLength, mappedData, - type: DORAMetricsChartType.DevChangeFailureRate, + type: DORAMetricsChartType.PipelineChangeFailureRate, }); const isDevMeanTimeToRecoveryValueListFinished: boolean = isDoraMetricsChartFinish({ dateRangeLength, mappedData, - type: DORAMetricsChartType.DevMeanTimeToRecovery, + type: DORAMetricsChartType.PipelineMeanTimeToRecovery, }); const leadTimeForChangeData = extractedStackedBarData(dateRanges, mappedData, selectedPipeline); @@ -359,14 +359,14 @@ export const DoraMetricsChart = ({ isLoading={!isDeploymentFrequencyFinished} /> )} - {metrics.includes(RequiredData.DevChangeFailureRate) && ( + {metrics.includes(RequiredData.PipelineChangeFailureRate) && ( )} - {metrics.includes(RequiredData.DevMeanTimeToRecovery) && ( + {metrics.includes(RequiredData.PipelineMeanTimeToRecovery) && ( { mappedData.deploymentFrequencyList, )} {showThreeColumnSection(MetricsTitle.LeadTimeForChanges, mappedData.leadTimeForChangesList)} - {showTwoColumnSection(MetricsTitle.DevChangeFailureRate, mappedData.devChangeFailureRateList)} - {showTwoColumnSection(MetricsTitle.DevMeanTimeToRecovery, mappedData.devMeanTimeToRecoveryList)} + {showTwoColumnSection(MetricsTitle.PipelineChangeFailureRate, mappedData.pipelineChangeFailureRateList)} + {showTwoColumnSection(MetricsTitle.PipelineMeanTimeToRecovery, mappedData.pipelineMeanTimeToRecoveryList)} ); }); diff --git a/frontend/src/context/config/configSlice.ts b/frontend/src/context/config/configSlice.ts index 38bf035970..eea769f812 100644 --- a/frontend/src/context/config/configSlice.ts +++ b/frontend/src/context/config/configSlice.ts @@ -68,8 +68,8 @@ const getMetricsInfo = (metrics: string[]) => { Classification: CLASSIFICATION, LeadTimeForChanges: LEAD_TIME_FOR_CHANGES, DeploymentFrequency: DEPLOYMENT_FREQUENCY, - DevChangeFailureRate: DEV_CHANGE_FAILURE_RATE, - DevMeanTimeToRecovery: DEV_MEAN_TIME_TO_RECOVERY, + PipelineChangeFailureRate: PIPELINE_CHANGE_FAILURE_RATE, + PipelineMeanTimeToRecovery: PIPELINE_MEAN_TIME_TO_RECOVERY, ReworkTimes: REWORK_TIMES, } = RequiredData; return { @@ -80,8 +80,8 @@ const getMetricsInfo = (metrics: string[]) => { shouldPipelineToolShow: [ LEAD_TIME_FOR_CHANGES, DEPLOYMENT_FREQUENCY, - DEV_CHANGE_FAILURE_RATE, - DEV_MEAN_TIME_TO_RECOVERY, + PIPELINE_CHANGE_FAILURE_RATE, + PIPELINE_MEAN_TIME_TO_RECOVERY, ].some((metric) => metrics.includes(metric)), shouldSourceControlShow: [LEAD_TIME_FOR_CHANGES].some((metric) => metrics.includes(metric)), }; diff --git a/frontend/src/hooks/reportMapper/devChangeFailureRate.ts b/frontend/src/hooks/reportMapper/devChangeFailureRate.ts index 1b8e70a93c..1031446e54 100644 --- a/frontend/src/hooks/reportMapper/devChangeFailureRate.ts +++ b/frontend/src/hooks/reportMapper/devChangeFailureRate.ts @@ -1,13 +1,13 @@ import { ReportDataWithTwoColumns } from '@src/hooks/reportMapper/reportUIDataStructure'; -import { DevChangeFailureRateResponse } from '@src/clients/report/dto/response'; +import { PipelineChangeFailureRateResponse } from '@src/clients/report/dto/response'; -export const devChangeFailureRateMapper = ({ - devChangeFailureRateOfPipelines, - avgDevChangeFailureRate, -}: DevChangeFailureRateResponse) => { +export const pipelineChangeFailureRateMapper = ({ + pipelineChangeFailureRateOfPipelines, + avgPipelineChangeFailureRate, +}: PipelineChangeFailureRateResponse) => { const mappedDevChangeFailureRateValue: ReportDataWithTwoColumns[] = []; - devChangeFailureRateOfPipelines.map((item, index) => { + pipelineChangeFailureRateOfPipelines.map((item, index) => { const devChangeFailureRateValue: ReportDataWithTwoColumns = { id: index, name: `${item.name}/${item.step}`, @@ -22,10 +22,10 @@ export const devChangeFailureRateMapper = ({ mappedDevChangeFailureRateValue.push({ id: mappedDevChangeFailureRateValue.length, - name: avgDevChangeFailureRate.name, + name: avgPipelineChangeFailureRate.name, valueList: [ { - value: `${(avgDevChangeFailureRate.failureRate * 100).toFixed(2)}`, + value: `${(avgPipelineChangeFailureRate.failureRate * 100).toFixed(2)}`, }, ], }); diff --git a/frontend/src/hooks/reportMapper/devMeanTimeToRecovery.ts b/frontend/src/hooks/reportMapper/devMeanTimeToRecovery.ts index e311d65e10..161f0a810d 100644 --- a/frontend/src/hooks/reportMapper/devMeanTimeToRecovery.ts +++ b/frontend/src/hooks/reportMapper/devMeanTimeToRecovery.ts @@ -1,10 +1,10 @@ import { ReportDataWithTwoColumns } from '@src/hooks/reportMapper/reportUIDataStructure'; -import { DevMeanTimeToRecoveryResponse } from '@src/clients/report/dto/response'; +import { PipelineMeanTimeToRecoveryResponse } from '@src/clients/report/dto/response'; -export const devMeanTimeToRecoveryMapper = ({ - devMeanTimeToRecoveryOfPipelines, - avgDevMeanTimeToRecovery, -}: DevMeanTimeToRecoveryResponse) => { +export const pipelineMeanTimeToRecoveryMapper = ({ + pipelineMeanTimeToRecoveryOfPipelines, + avgPipelineMeanTimeToRecovery, +}: PipelineMeanTimeToRecoveryResponse) => { const minutesPerHour = 60; const milliscondMinute = 60000; const formatDuration = (duration: number) => { @@ -14,7 +14,7 @@ export const devMeanTimeToRecoveryMapper = ({ const mappedDevMeanTimeToRecoveryValue: ReportDataWithTwoColumns[] = []; - devMeanTimeToRecoveryOfPipelines.map((item, index) => { + pipelineMeanTimeToRecoveryOfPipelines.map((item, index) => { const devMeanTimeToRecoveryValue: ReportDataWithTwoColumns = { id: index, name: `${item.name}/${item.step}`, @@ -29,10 +29,10 @@ export const devMeanTimeToRecoveryMapper = ({ mappedDevMeanTimeToRecoveryValue.push({ id: mappedDevMeanTimeToRecoveryValue.length, - name: avgDevMeanTimeToRecovery.name, + name: avgPipelineMeanTimeToRecovery.name, valueList: [ { - value: `${formatDuration(avgDevMeanTimeToRecovery.timeToRecovery)}`, + value: `${formatDuration(avgPipelineMeanTimeToRecovery.timeToRecovery)}`, }, ], }); diff --git a/frontend/src/hooks/reportMapper/report.ts b/frontend/src/hooks/reportMapper/report.ts index 46ae305a66..bbefeb42b8 100644 --- a/frontend/src/hooks/reportMapper/report.ts +++ b/frontend/src/hooks/reportMapper/report.ts @@ -1,6 +1,6 @@ +import { pipelineMeanTimeToRecoveryMapper } from '@src/hooks/reportMapper/devMeanTimeToRecovery'; import { classificationCardCountMapper } from '@src/hooks/reportMapper/classificationCardCount'; -import { devMeanTimeToRecoveryMapper } from '@src/hooks/reportMapper/devMeanTimeToRecovery'; -import { devChangeFailureRateMapper } from '@src/hooks/reportMapper/devChangeFailureRate'; +import { pipelineChangeFailureRateMapper } from '@src/hooks/reportMapper/devChangeFailureRate'; import { deploymentFrequencyMapper } from '@src/hooks/reportMapper/deploymentFrequency'; import { leadTimeForChangesMapper } from '@src/hooks/reportMapper/leadTimeForChanges'; import { exportValidityTimeMapper } from '@src/hooks/reportMapper/exportValidityTime'; @@ -15,9 +15,9 @@ export const reportMapper = ({ cycleTime, classificationList, deploymentFrequency, - devMeanTimeToRecovery, + pipelineMeanTimeToRecovery, leadTimeForChanges, - devChangeFailureRate, + pipelineChangeFailureRate, exportValidityTime, rework, }: ReportResponseDTO): ReportResponse => { @@ -31,11 +31,13 @@ export const reportMapper = ({ const deploymentFrequencyList = deploymentFrequency && deploymentFrequencyMapper(deploymentFrequency); - const devMeanTimeToRecoveryList = devMeanTimeToRecovery && devMeanTimeToRecoveryMapper(devMeanTimeToRecovery); + const pipelineMeanTimeToRecoveryList = + pipelineMeanTimeToRecovery && pipelineMeanTimeToRecoveryMapper(pipelineMeanTimeToRecovery); const leadTimeForChangesList = leadTimeForChanges && leadTimeForChangesMapper(leadTimeForChanges); - const devChangeFailureRateList = devChangeFailureRate && devChangeFailureRateMapper(devChangeFailureRate); + const pipelineChangeFailureRateList = + pipelineChangeFailureRate && pipelineChangeFailureRateMapper(pipelineChangeFailureRate); const exportValidityTimeMin = exportValidityTimeMapper(exportValidityTime); @@ -49,9 +51,9 @@ export const reportMapper = ({ reworkList, classification, deploymentFrequencyList, - devMeanTimeToRecoveryList, + pipelineMeanTimeToRecoveryList, leadTimeForChangesList, - devChangeFailureRateList, + pipelineChangeFailureRateList, exportValidityTimeMin, classificationCardCount, };