Skip to content

Commit

Permalink
Merge pull request #854 from DeveloperMetrics/ImprovingSummaryItem
Browse files Browse the repository at this point in the history
Improving DORA summary item functionality with extra properties for metrics
  • Loading branch information
samsmithnz authored May 25, 2023
2 parents bf1dafd + 990ad18 commit e47d832
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/DevOpsMetrics.Core/Models/Common/DORASummaryItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ public string Repo
{
get; set;
}
public float DeploymentFrequency
{
get; set;
}
public string DeploymentFrequencyBadgeURL
{
get; set;
Expand All @@ -18,6 +22,10 @@ public string DeploymentFrequencyBadgeWithMetricURL
{
get; set;
}
public float LeadTimeForChanges
{
get; set;
}
public string LeadTimeForChangesBadgeURL
{
get; set;
Expand All @@ -26,6 +34,10 @@ public string LeadTimeForChangesBadgeWithMetricURL
{
get; set;
}
public float MeanTimeToRestore
{
get; set;
}
public string MeanTimeToRestoreBadgeURL
{
get; set;
Expand All @@ -34,6 +46,10 @@ public string MeanTimeToRestoreBadgeWithMetricURL
{
get; set;
}
public float ChangeFailureRate
{
get; set;
}
public string ChangeFailureRateBadgeURL
{
get; set;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,16 @@ public async Task<ProcessingResult> UpdateDORASummaryItem(
{
Owner = owner,
Repo = repo,
DeploymentFrequency = deploymentFrequencyModel.DeploymentsPerDayMetric,
DeploymentFrequencyBadgeURL = deploymentFrequencyModel.BadgeURL,
DeploymentFrequencyBadgeWithMetricURL = deploymentFrequencyModel.BadgeWithMetricURL,
LeadTimeForChanges = leadTimeForChangesModel.LeadTimeForChangesMetric,
LeadTimeForChangesBadgeURL = leadTimeForChangesModel.BadgeURL,
LeadTimeForChangesBadgeWithMetricURL = leadTimeForChangesModel.BadgeWithMetricURL,
MeanTimeToRestore = meanTimeToRestoreModel.MTTRAverageDurationInHours,
MeanTimeToRestoreBadgeURL = meanTimeToRestoreModel.BadgeURL,
MeanTimeToRestoreBadgeWithMetricURL = meanTimeToRestoreModel.BadgeWithMetricURL,
ChangeFailureRate = changeFailureRateModel.ChangeFailureRateMetric,
ChangeFailureRateBadgeURL = changeFailureRateModel.BadgeURL,
ChangeFailureRateBadgeWithMetricURL = changeFailureRateModel.BadgeWithMetricURL
};
Expand Down
7 changes: 7 additions & 0 deletions src/DevOpsMetrics.Tests/Service/DORASummaryControllerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,15 @@ public async Task DORASummaryControllerGitHubUpdateIntegrationTest()
branch, workflowName, workflowId, resourceGroup, numberOfDays, maxNumberOfItems,
null, true, true);

DORASummaryItem doraSummaryItem = controller.GetDORASummaryItem(organization, repository);

//Assert
Assert.IsNotNull(model);
Assert.IsNotNull(doraSummaryItem);
Assert.IsTrue(doraSummaryItem.DeploymentFrequency >= 0);
Assert.IsTrue(doraSummaryItem.LeadTimeForChanges >= 0);
Assert.IsTrue(doraSummaryItem.MeanTimeToRestore >= 0);
Assert.IsTrue(doraSummaryItem.ChangeFailureRate >= -1); //Change failure rate is -1 when there is no data (since 0 means something different from this metric)
}

[TestMethod]
Expand Down

0 comments on commit e47d832

Please sign in to comment.