Skip to content

Conversation

@sanposhiho
Copy link
Member

@sanposhiho sanposhiho commented Dec 7, 2020

What this PR does / why we need it:
Create insight data for MTTR

Which issue(s) this PR fixes:

ref #1142

Does this PR introduce a user-facing change?:

NONE

note
This branch is based on create-insight-data-for-change-failure-rate to make the diff easier to understand. So, merge this PR after #1197

@pipecd-bot
Copy link
Collaborator

KAPETANIOS

Failed while validating Kapetanios configuration.

Details
Error: rpc error: code = NotFound desc = not found

@pipecd-bot
Copy link
Collaborator

APPROVE

This pull request is NOT APPROVED. It will be approved when one of the following conditions is met:

  • Received a comment that contains /approve from an approver.
  • Received approval at review changes UI from at least 1 approvers.

@pipecd-bot
Copy link
Collaborator

GO_LINTER

The golinter build is completed with FAILURE. The build will be triggered again when you push any other commits. Or you can trigger it manually by /golinter trigger command right now.

You can check the build log from here.

@pipecd-bot
Copy link
Collaborator

GO_LINTER

The following files are not gofmt-ed. By commenting /golinter fmt, the formatted one will be appended to this pull request automatically.

pkg/app/api/grpcapi/web_api_test.go
--- pkg/app/api/grpcapi/web_api_test.go.orig
+++ pkg/app/api/grpcapi/web_api_test.go
@@ -391,7 +391,6 @@
 	}
 }
 
-
 func TestCalculateInsightData(t *testing.T) {
 	ctrl := gomock.NewController(t)
 	defer ctrl.Finish()

@sanposhiho
Copy link
Member Author

/golinter fmt

@pipecd-bot pipecd-bot added size/L and removed size/XL labels Dec 7, 2020
@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 34.13%. This pull request increases coverage by 0.47%.

File Function Base Head Diff
pkg/app/api/grpcapi/web_api.go WebAPI.calculateInsightData -- 68.00% +68.00%
pkg/app/api/grpcapi/web_api.go WebAPI.getInsightDataForChangeFailureRate -- 88.89% +88.89%
pkg/app/api/grpcapi/web_api.go WebAPI.getInsightDataForMTTR -- 90.91% +90.91%
pkg/app/api/grpcapi/web_api.go calculateAverageMTTR -- 100.00% +100.00%
pkg/app/api/grpcapi/web_api.go WebAPI.GetInsightData 0.00% 0.00% +0.00%
pkg/app/api/grpcapi/web_api.go WebAPI.getInsightDataForDeployFrequency 91.30% 100.00% +8.70%

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 34.13%. This pull request increases coverage by 0.47%.

File Function Base Head Diff
pkg/app/api/grpcapi/web_api.go WebAPI.calculateInsightData -- 68.00% +68.00%
pkg/app/api/grpcapi/web_api.go WebAPI.getInsightDataForChangeFailureRate -- 88.89% +88.89%
pkg/app/api/grpcapi/web_api.go WebAPI.getInsightDataForMTTR -- 90.91% +90.91%
pkg/app/api/grpcapi/web_api.go calculateAverageMTTR -- 100.00% +100.00%
pkg/app/api/grpcapi/web_api.go WebAPI.GetInsightData 0.00% 0.00% +0.00%
pkg/app/api/grpcapi/web_api.go WebAPI.getInsightDataForDeployFrequency 91.30% 100.00% +8.70%

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 34.13%. This pull request increases coverage by 0.47%.

File Function Base Head Diff
pkg/app/api/grpcapi/web_api.go WebAPI.calculateInsightData -- 68.00% +68.00%
pkg/app/api/grpcapi/web_api.go WebAPI.getInsightDataForChangeFailureRate -- 88.89% +88.89%
pkg/app/api/grpcapi/web_api.go WebAPI.getInsightDataForMTTR -- 90.91% +90.91%
pkg/app/api/grpcapi/web_api.go calculateAverageMTTR -- 100.00% +100.00%
pkg/app/api/grpcapi/web_api.go WebAPI.GetInsightData 0.00% 0.00% +0.00%
pkg/app/api/grpcapi/web_api.go WebAPI.getInsightDataForDeployFrequency 91.30% 100.00% +8.70%

@khanhtc1202
Copy link
Member

/lgtm

@pipecd-bot pipecd-bot added the lgtm label Dec 7, 2020
},
{
Field: "ApplicationId",
Operator: "==",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, we can use the "in" operator. With it, you can query a specific field for multiple values in a single query. (Maybe we should clearly define what operator is available.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, fix to use in operator, thanks.

@pipecd-bot pipecd-bot removed the lgtm label Dec 8, 2020
@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 34.08%. This pull request increases coverage by 0.42%.

File Function Base Head Diff
pkg/app/api/grpcapi/web_api.go WebAPI.getInsightData -- 76.00% +76.00%
pkg/app/api/grpcapi/web_api.go WebAPI.getInsightDataForChangeFailureRate -- 88.89% +88.89%
pkg/app/api/grpcapi/web_api.go WebAPI.getInsightDataForMTTR -- 87.50% +87.50%
pkg/app/api/grpcapi/web_api.go calculateAverageMTTR -- 100.00% +100.00%
pkg/app/api/grpcapi/web_api.go WebAPI.GetInsightData 0.00% 0.00% +0.00%
pkg/app/api/grpcapi/web_api.go WebAPI.getInsightDataForDeployFrequency 91.30% 100.00% +8.70%


var applicationIDs []string
if applicationID == "" {
apps, err := a.applicationStore.ListApplications(ctx, datastore.ListOptions{})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to list the apps when the appID was not specified?
Doesn't an empty appID mean all apps of the project?

Copy link
Member Author

@sanposhiho sanposhiho Dec 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simply my mistake.
Since the original function calculateAverageMTTR was to calculate the MTTR of an application, I got all the appId's and calculated the MTTR by getting the deployment from the DB for each application in a loop to use calculateAverageMTTR around.
I changed calculateAverageMTTR to calculate MTTR from a mix of applications when I received nakabonne review, so I should have noticed that I don't need to get all the appId's here.
Thanks :D

@sanposhiho
Copy link
Member Author

Talking with team members and we noticed that there are many other patterns to calcurate MTTR. So, close for now.

@sanposhiho sanposhiho closed this Dec 9, 2020
@pipecd-bot pipecd-bot deleted the create-insight-data-for-mttr branch December 9, 2020 02:18
@sanposhiho sanposhiho restored the create-insight-data-for-mttr branch December 9, 2020 02:18
@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 34.05%. This pull request increases coverage by 0.38%.

File Function Base Head Diff
pkg/app/api/grpcapi/web_api.go WebAPI.getInsightData -- 76.00% +76.00%
pkg/app/api/grpcapi/web_api.go WebAPI.getInsightDataForChangeFailureRate -- 88.89% +88.89%
pkg/app/api/grpcapi/web_api.go WebAPI.getInsightDataForMTTR -- 100.00% +100.00%
pkg/app/api/grpcapi/web_api.go calculateAverageMTTR -- 100.00% +100.00%
pkg/app/api/grpcapi/web_api.go WebAPI.GetInsightData 0.00% 0.00% +0.00%
pkg/app/api/grpcapi/web_api.go WebAPI.getInsightDataForDeployFrequency 91.30% 100.00% +8.70%

@nghialv nghialv deleted the create-insight-data-for-mttr branch December 25, 2020 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants