Skip to content

feat(q_dev):delete user metrics #8493

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions backend/plugins/q_dev/impl/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ func (p QDev) GetTablesInfo() []dal.Tabler {
return []dal.Tabler{
&models.QDevConnection{},
&models.QDevUserData{},
&models.QDevUserMetrics{},
&models.QDevS3FileMeta{},
}
}
Expand Down Expand Up @@ -81,7 +80,6 @@ func (p QDev) SubTaskMetas() []plugin.SubTaskMeta {
return []plugin.SubTaskMeta{
tasks.CollectQDevS3FilesMeta,
tasks.ExtractQDevS3DataMeta,
tasks.ConvertQDevUserMetricsMeta,
}
}

Expand Down
18 changes: 9 additions & 9 deletions backend/plugins/q_dev/impl/impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ import (

func TestQDev_BasicPluginMethods(t *testing.T) {
plugin := &QDev{}

assert.Equal(t, "q_dev", plugin.Name())
assert.Equal(t, "To collect and enrich data from AWS Q Developer usage metrics", plugin.Description())
assert.Equal(t, "github.com/apache/incubator-devlake/plugins/q_dev", plugin.RootPkgPath())

// Test table info
tables := plugin.GetTablesInfo()
assert.Len(t, tables, 4)
assert.Len(t, tables, 3)

// Test subtask metas
subtasks := plugin.SubTaskMetas()
assert.Len(t, subtasks, 3)
assert.Len(t, subtasks, 2)

// Test API resources
apiResources := plugin.ApiResources()
assert.NotEmpty(t, apiResources)
Expand All @@ -62,11 +62,11 @@ func TestQDev_TaskDataStructure(t *testing.T) {
Region: "us-west-2",
},
}

assert.NotNil(t, taskData.Options)
assert.NotNil(t, taskData.S3Client)
assert.NotNil(t, taskData.IdentityClient)

assert.Equal(t, uint64(1), taskData.Options.ConnectionId)
assert.Equal(t, "test/", taskData.Options.S3Prefix)
assert.Equal(t, "test-bucket", taskData.S3Client.Bucket)
Expand All @@ -85,7 +85,7 @@ func TestQDev_TaskDataWithoutIdentityClient(t *testing.T) {
},
IdentityClient: nil, // No identity client
}

assert.NotNil(t, taskData.Options)
assert.NotNil(t, taskData.S3Client)
assert.Nil(t, taskData.IdentityClient)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
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/core/context"
"github.com/apache/incubator-devlake/core/errors"
"github.com/apache/incubator-devlake/core/plugin"
)

var _ plugin.MigrationScript = (*deleteUserMetrics)(nil)

type deleteUserMetrics struct{}

func (*deleteUserMetrics) Up(basicRes context.BasicRes) errors.Error {
db := basicRes.GetDal()

// Drop the QDevUserMetrics table
// Ignore error if table doesn't exist
_ = db.Exec("DROP TABLE IF EXISTS _tool_q_dev_user_metrics")

return nil
}

func (*deleteUserMetrics) Version() uint64 {
return 20250709000001
}

func (*deleteUserMetrics) Name() string {
return "delete QDevUserMetrics table"
}
68 changes: 0 additions & 68 deletions backend/plugins/q_dev/models/user_metrics.go

This file was deleted.

155 changes: 0 additions & 155 deletions backend/plugins/q_dev/models/user_metrics_test.go

This file was deleted.

Loading
Loading