You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by GitBox <gi...@apache.org> on 2022/11/07 12:10:51 UTC

[GitHub] [incubator-devlake] warren830 opened a new pull request, #3690: feat(dora): use project to filter data

warren830 opened a new pull request, #3690:
URL: https://github.com/apache/incubator-devlake/pull/3690

   # Summary
   
   1. added project_issue_metrics, project_pr_metrics and relevant migration scripts
   2. remove changeLeadTime and related fields form pull_requests
   3. remove deploymentId from issues
   4. use project_name to filter pr/issue in calculate_change_lead_time_test.go and connect_issue_deploy_test.go
   
   
   ### Does this close any open issues?
   Closes #3689 
   
   ### Screenshots
   Include any relevant screenshots here.
   
   ### Other Information
   Any other information that is important to this PR.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] warren830 closed pull request #3690: feat(dora): use project to filter data

Posted by GitBox <gi...@apache.org>.
warren830 closed pull request #3690: feat(dora): use project to filter data
URL: https://github.com/apache/incubator-devlake/pull/3690


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] warren830 commented on pull request #3690: feat(dora): use project to filter data

Posted by GitBox <gi...@apache.org>.
warren830 commented on PR #3690:
URL: https://github.com/apache/incubator-devlake/pull/3690#issuecomment-1321972487

   closed by #3768 #3742 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] warren830 commented on a diff in pull request #3690: feat(dora): use project to filter data

Posted by GitBox <gi...@apache.org>.
warren830 commented on code in PR #3690:
URL: https://github.com/apache/incubator-devlake/pull/3690#discussion_r1019122421


##########
models/migrationscripts/20221107_add_project_xx_meric.go:
##########
@@ -0,0 +1,83 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package migrationscripts
+
+import (
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/apache/incubator-devlake/helpers/migrationhelper"
+	"github.com/apache/incubator-devlake/models/migrationscripts/archived"
+	"github.com/apache/incubator-devlake/plugins/core"
+)
+
+type pullRequest20221107 struct {

Review Comment:
   fixed



##########
models/migrationscripts/20221107_add_project_xx_meric.go:
##########
@@ -0,0 +1,83 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package migrationscripts
+
+import (
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/apache/incubator-devlake/helpers/migrationhelper"
+	"github.com/apache/incubator-devlake/models/migrationscripts/archived"
+	"github.com/apache/incubator-devlake/plugins/core"
+)
+
+type pullRequest20221107 struct {
+	CodingTimespan     *int64
+	ReviewLag          *int64
+	ReviewTimespan     *int64
+	DeployTimespan     *int64
+	ChangeTimespan     *int64
+	OrigCodingTimespan int64
+	OrigReviewLag      int64
+	OrigReviewTimespan int64
+	OrigDeployTimespan int64
+}
+
+func (pullRequest20221107) TableName() string {
+	return "pull_requests"
+}
+
+type issue20221107 struct {

Review Comment:
   fixed
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] warren830 commented on a diff in pull request #3690: feat(dora): use project to filter data

Posted by GitBox <gi...@apache.org>.
warren830 commented on code in PR #3690:
URL: https://github.com/apache/incubator-devlake/pull/3690#discussion_r1015375113


##########
models/domainlayer/crossdomain/project_pr_metrics.go:
##########
@@ -0,0 +1,40 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package crossdomain
+
+import (
+	"github.com/apache/incubator-devlake/models/domainlayer"
+)
+
+type ProjectPrMetrics struct {

Review Comment:
   I think deploymentId should belong to project_issue_metrics? Or we also need it here?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] klesh commented on a diff in pull request #3690: feat(dora): use project to filter data

Posted by GitBox <gi...@apache.org>.
klesh commented on code in PR #3690:
URL: https://github.com/apache/incubator-devlake/pull/3690#discussion_r1015356588


##########
models/migrationscripts/20221107_add_project_xx_meric.go:
##########
@@ -0,0 +1,83 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package migrationscripts
+
+import (
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/apache/incubator-devlake/helpers/migrationhelper"
+	"github.com/apache/incubator-devlake/models/migrationscripts/archived"
+	"github.com/apache/incubator-devlake/plugins/core"
+)
+
+type pullRequest20221107 struct {

Review Comment:
   not necessary



##########
models/migrationscripts/20221107_add_project_xx_meric.go:
##########
@@ -0,0 +1,83 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package migrationscripts
+
+import (
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/apache/incubator-devlake/helpers/migrationhelper"
+	"github.com/apache/incubator-devlake/models/migrationscripts/archived"
+	"github.com/apache/incubator-devlake/plugins/core"
+)
+
+type pullRequest20221107 struct {
+	CodingTimespan     *int64
+	ReviewLag          *int64
+	ReviewTimespan     *int64
+	DeployTimespan     *int64
+	ChangeTimespan     *int64
+	OrigCodingTimespan int64
+	OrigReviewLag      int64
+	OrigReviewTimespan int64
+	OrigDeployTimespan int64
+}
+
+func (pullRequest20221107) TableName() string {
+	return "pull_requests"
+}
+
+type issue20221107 struct {
+	DeploymentId string `gorm:"type:varchar(255)"`
+}
+
+func (issue20221107) TableName() string {
+	return "issues"
+}
+
+type addProjectXXMetric struct{}
+
+func (u *addProjectXXMetric) Up(baseRes core.BasicRes) errors.Error {
+	db := baseRes.GetDal()
+	err := migrationhelper.AutoMigrateTables(
+		baseRes,
+		&archived.ProjectPrMetrics{},
+		&archived.ProjectIssueMetrics{},
+	)
+
+	prColums := []string{
+		`coding_timespan`,
+		`review_lag`,
+		`review_timespan`,
+		`deploy_timespan`,
+		`change_timespan`,
+		`orig_coding_timespan`,
+		`orig_review_lag`,
+		`orig_review_timespan`,
+		`orig_deploy_timespan`,
+	}
+	err = db.DropColumns(pullRequest20221107{}.TableName(), prColums...)
+	err = db.DropColumns(issue20221107{}.TableName(), `deployment_id`)

Review Comment:
   Same as above



##########
models/migrationscripts/20221107_add_project_xx_meric.go:
##########
@@ -0,0 +1,83 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package migrationscripts
+
+import (
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/apache/incubator-devlake/helpers/migrationhelper"
+	"github.com/apache/incubator-devlake/models/migrationscripts/archived"
+	"github.com/apache/incubator-devlake/plugins/core"
+)
+
+type pullRequest20221107 struct {
+	CodingTimespan     *int64
+	ReviewLag          *int64
+	ReviewTimespan     *int64
+	DeployTimespan     *int64
+	ChangeTimespan     *int64
+	OrigCodingTimespan int64
+	OrigReviewLag      int64
+	OrigReviewTimespan int64
+	OrigDeployTimespan int64
+}
+
+func (pullRequest20221107) TableName() string {
+	return "pull_requests"
+}
+
+type issue20221107 struct {

Review Comment:
   no necessary



##########
models/migrationscripts/20221107_add_project_xx_meric.go:
##########
@@ -0,0 +1,83 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package migrationscripts
+
+import (
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/apache/incubator-devlake/helpers/migrationhelper"
+	"github.com/apache/incubator-devlake/models/migrationscripts/archived"
+	"github.com/apache/incubator-devlake/plugins/core"
+)
+
+type pullRequest20221107 struct {
+	CodingTimespan     *int64
+	ReviewLag          *int64
+	ReviewTimespan     *int64
+	DeployTimespan     *int64
+	ChangeTimespan     *int64
+	OrigCodingTimespan int64
+	OrigReviewLag      int64
+	OrigReviewTimespan int64
+	OrigDeployTimespan int64
+}
+
+func (pullRequest20221107) TableName() string {
+	return "pull_requests"
+}
+
+type issue20221107 struct {
+	DeploymentId string `gorm:"type:varchar(255)"`
+}
+
+func (issue20221107) TableName() string {
+	return "issues"
+}
+
+type addProjectXXMetric struct{}
+
+func (u *addProjectXXMetric) Up(baseRes core.BasicRes) errors.Error {
+	db := baseRes.GetDal()
+	err := migrationhelper.AutoMigrateTables(
+		baseRes,
+		&archived.ProjectPrMetrics{},
+		&archived.ProjectIssueMetrics{},
+	)
+
+	prColums := []string{
+		`coding_timespan`,
+		`review_lag`,
+		`review_timespan`,
+		`deploy_timespan`,
+		`change_timespan`,
+		`orig_coding_timespan`,
+		`orig_review_lag`,
+		`orig_review_timespan`,
+		`orig_deploy_timespan`,
+	}
+	err = db.DropColumns(pullRequest20221107{}.TableName(), prColums...)

Review Comment:
   Just pass "pull_requests" to  `db.DropColumns`, the struct is not necessary.



##########
plugins/dora/tasks/change_lead_time_calculator.go:
##########
@@ -34,9 +34,20 @@ import (
 func CalculateChangeLeadTime(taskCtx core.SubTaskContext) errors.Error {
 	db := taskCtx.GetDal()
 	log := taskCtx.GetLogger()
+	data := taskCtx.GetData().(*DoraTaskData)
+	repoClauses := []dal.Clause{

Review Comment:
   The e2ehelper could create tables by CSV files, it should be sufficient for you to do data-mocking.
   Please do so, curate the data, making sure they are correct in terms of input/output, and diverse enough to prevent algo from processing wrong data-set etc.



##########
plugins/dora/tasks/change_lead_time_calculator.go:
##########
@@ -34,9 +34,20 @@ import (
 func CalculateChangeLeadTime(taskCtx core.SubTaskContext) errors.Error {
 	db := taskCtx.GetDal()
 	log := taskCtx.GetLogger()
+	data := taskCtx.GetData().(*DoraTaskData)
+	repoClauses := []dal.Clause{

Review Comment:
   I suggest that you mock some data and create an e2e-test, and work from there.



##########
models/domainlayer/crossdomain/project_pr_metrics.go:
##########
@@ -0,0 +1,40 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package crossdomain
+
+import (
+	"github.com/apache/incubator-devlake/models/domainlayer"
+)
+
+type ProjectPrMetrics struct {

Review Comment:
   missing deploymentId



##########
models/migrationscripts/20221107_add_project_xx_meric.go:
##########
@@ -0,0 +1,83 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package migrationscripts
+
+import (
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/apache/incubator-devlake/helpers/migrationhelper"
+	"github.com/apache/incubator-devlake/models/migrationscripts/archived"
+	"github.com/apache/incubator-devlake/plugins/core"
+)
+
+type pullRequest20221107 struct {
+	CodingTimespan     *int64
+	ReviewLag          *int64
+	ReviewTimespan     *int64
+	DeployTimespan     *int64
+	ChangeTimespan     *int64
+	OrigCodingTimespan int64
+	OrigReviewLag      int64
+	OrigReviewTimespan int64
+	OrigDeployTimespan int64
+}
+
+func (pullRequest20221107) TableName() string {
+	return "pull_requests"
+}
+
+type issue20221107 struct {
+	DeploymentId string `gorm:"type:varchar(255)"`
+}
+
+func (issue20221107) TableName() string {
+	return "issues"
+}
+
+type addProjectXXMetric struct{}
+
+func (u *addProjectXXMetric) Up(baseRes core.BasicRes) errors.Error {
+	db := baseRes.GetDal()
+	err := migrationhelper.AutoMigrateTables(
+		baseRes,
+		&archived.ProjectPrMetrics{},
+		&archived.ProjectIssueMetrics{},
+	)
+
+	prColums := []string{
+		`coding_timespan`,
+		`review_lag`,
+		`review_timespan`,
+		`deploy_timespan`,
+		`change_timespan`,
+		`orig_coding_timespan`,
+		`orig_review_lag`,
+		`orig_review_timespan`,
+		`orig_deploy_timespan`,
+	}
+	err = db.DropColumns(pullRequest20221107{}.TableName(), prColums...)
+	err = db.DropColumns(issue20221107{}.TableName(), `deployment_id`)
+	return errors.Convert(err)
+}
+
+func (*addProjectXXMetric) Version() uint64 {
+	return 20221107000001
+}
+
+func (*addProjectXXMetric) Name() string {
+	return "add dora project xx metrics"

Review Comment:
   How about "add project metric tables for pr and issues"



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org