Skip to content

Commit affed66

Browse files
authored
feat(q_dev):delete user metrics (#8493)
* feat: delete user metrics * feat: modify dashboard for qdev
1 parent afd0735 commit affed66

File tree

7 files changed

+55
-686
lines changed

7 files changed

+55
-686
lines changed

backend/plugins/q_dev/impl/impl.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ func (p QDev) GetTablesInfo() []dal.Tabler {
5252
return []dal.Tabler{
5353
&models.QDevConnection{},
5454
&models.QDevUserData{},
55-
&models.QDevUserMetrics{},
5655
&models.QDevS3FileMeta{},
5756
}
5857
}
@@ -81,7 +80,6 @@ func (p QDev) SubTaskMetas() []plugin.SubTaskMeta {
8180
return []plugin.SubTaskMeta{
8281
tasks.CollectQDevS3FilesMeta,
8382
tasks.ExtractQDevS3DataMeta,
84-
tasks.ConvertQDevUserMetricsMeta,
8583
}
8684
}
8785

backend/plugins/q_dev/impl/impl_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,19 @@ import (
2727

2828
func TestQDev_BasicPluginMethods(t *testing.T) {
2929
plugin := &QDev{}
30-
30+
3131
assert.Equal(t, "q_dev", plugin.Name())
3232
assert.Equal(t, "To collect and enrich data from AWS Q Developer usage metrics", plugin.Description())
3333
assert.Equal(t, "github.com/apache/incubator-devlake/plugins/q_dev", plugin.RootPkgPath())
34-
34+
3535
// Test table info
3636
tables := plugin.GetTablesInfo()
37-
assert.Len(t, tables, 4)
38-
37+
assert.Len(t, tables, 3)
38+
3939
// Test subtask metas
4040
subtasks := plugin.SubTaskMetas()
41-
assert.Len(t, subtasks, 3)
42-
41+
assert.Len(t, subtasks, 2)
42+
4343
// Test API resources
4444
apiResources := plugin.ApiResources()
4545
assert.NotEmpty(t, apiResources)
@@ -62,11 +62,11 @@ func TestQDev_TaskDataStructure(t *testing.T) {
6262
Region: "us-west-2",
6363
},
6464
}
65-
65+
6666
assert.NotNil(t, taskData.Options)
6767
assert.NotNil(t, taskData.S3Client)
6868
assert.NotNil(t, taskData.IdentityClient)
69-
69+
7070
assert.Equal(t, uint64(1), taskData.Options.ConnectionId)
7171
assert.Equal(t, "test/", taskData.Options.S3Prefix)
7272
assert.Equal(t, "test-bucket", taskData.S3Client.Bucket)
@@ -85,7 +85,7 @@ func TestQDev_TaskDataWithoutIdentityClient(t *testing.T) {
8585
},
8686
IdentityClient: nil, // No identity client
8787
}
88-
88+
8989
assert.NotNil(t, taskData.Options)
9090
assert.NotNil(t, taskData.S3Client)
9191
assert.Nil(t, taskData.IdentityClient)
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
Licensed to the Apache Software Foundation (ASF) under one or more
3+
contributor license agreements. See the NOTICE file distributed with
4+
this work for additional information regarding copyright ownership.
5+
The ASF licenses this file to You under the Apache License, Version 2.0
6+
(the "License"); you may not use this file except in compliance with
7+
the License. You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
*/
17+
18+
package migrationscripts
19+
20+
import (
21+
"github.com/apache/incubator-devlake/core/context"
22+
"github.com/apache/incubator-devlake/core/errors"
23+
"github.com/apache/incubator-devlake/core/plugin"
24+
)
25+
26+
var _ plugin.MigrationScript = (*deleteUserMetrics)(nil)
27+
28+
type deleteUserMetrics struct{}
29+
30+
func (*deleteUserMetrics) Up(basicRes context.BasicRes) errors.Error {
31+
db := basicRes.GetDal()
32+
33+
// Drop the QDevUserMetrics table
34+
// Ignore error if table doesn't exist
35+
_ = db.Exec("DROP TABLE IF EXISTS _tool_q_dev_user_metrics")
36+
37+
return nil
38+
}
39+
40+
func (*deleteUserMetrics) Version() uint64 {
41+
return 20250709000001
42+
}
43+
44+
func (*deleteUserMetrics) Name() string {
45+
return "delete QDevUserMetrics table"
46+
}

backend/plugins/q_dev/models/user_metrics.go

Lines changed: 0 additions & 68 deletions
This file was deleted.

backend/plugins/q_dev/models/user_metrics_test.go

Lines changed: 0 additions & 155 deletions
This file was deleted.

0 commit comments

Comments
 (0)