Skip to content

fix: handle new agent stat format correctly #14576

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 7 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
create alternative usage queries
  • Loading branch information
f0ssel committed Sep 5, 2024
commit 66b94e76517021d24ecb4150666555330dfc9c5e
12 changes: 12 additions & 0 deletions coderd/database/dbauthz/dbauthz.go
Original file line number Diff line number Diff line change
Expand Up @@ -1418,6 +1418,10 @@
return q.db.GetDeploymentWorkspaceAgentStats(ctx, createdAfter)
}

func (q *querier) GetDeploymentWorkspaceAgentUsageStats(ctx context.Context, createdAt time.Time) (database.GetDeploymentWorkspaceAgentUsageStatsRow, error) {

Check failure on line 1421 in coderd/database/dbauthz/dbauthz.go

View workflow job for this annotation

GitHub Actions / lint

unused-receiver: method receiver 'q' is not referenced in method's body, consider removing or renaming it as _ (revive)
panic("not implemented")
}

func (q *querier) GetDeploymentWorkspaceStats(ctx context.Context) (database.GetDeploymentWorkspaceStatsRow, error) {
return q.db.GetDeploymentWorkspaceStats(ctx)
}
Expand Down Expand Up @@ -2360,6 +2364,14 @@
return q.db.GetWorkspaceAgentStatsAndLabels(ctx, createdAfter)
}

func (q *querier) GetWorkspaceAgentUsageStats(ctx context.Context, createdAt time.Time) ([]database.GetWorkspaceAgentUsageStatsRow, error) {

Check failure on line 2367 in coderd/database/dbauthz/dbauthz.go

View workflow job for this annotation

GitHub Actions / lint

unused-receiver: method receiver 'q' is not referenced in method's body, consider removing or renaming it as _ (revive)
panic("not implemented")
}

func (q *querier) GetWorkspaceAgentUsageStatsAndLabels(ctx context.Context, createdAt time.Time) ([]database.GetWorkspaceAgentUsageStatsAndLabelsRow, error) {

Check failure on line 2371 in coderd/database/dbauthz/dbauthz.go

View workflow job for this annotation

GitHub Actions / lint

unused-receiver: method receiver 'q' is not referenced in method's body, consider removing or renaming it as _ (revive)
panic("not implemented")
}

// GetWorkspaceAgentsByResourceIDs
// The workspace/job is already fetched.
func (q *querier) GetWorkspaceAgentsByResourceIDs(ctx context.Context, ids []uuid.UUID) ([]database.WorkspaceAgent, error) {
Expand Down
12 changes: 12 additions & 0 deletions coderd/database/dbmem/dbmem.go
Original file line number Diff line number Diff line change
Expand Up @@ -2432,6 +2432,10 @@
return stat, nil
}

func (q *FakeQuerier) GetDeploymentWorkspaceAgentUsageStats(ctx context.Context, createdAt time.Time) (database.GetDeploymentWorkspaceAgentUsageStatsRow, error) {

Check failure on line 2435 in coderd/database/dbmem/dbmem.go

View workflow job for this annotation

GitHub Actions / lint

unused-receiver: method receiver 'q' is not referenced in method's body, consider removing or renaming it as _ (revive)
panic("not implemented")
}

func (q *FakeQuerier) GetDeploymentWorkspaceStats(ctx context.Context) (database.GetDeploymentWorkspaceStatsRow, error) {
q.mutex.RLock()
defer q.mutex.RUnlock()
Expand Down Expand Up @@ -5634,6 +5638,14 @@
return stats, nil
}

func (q *FakeQuerier) GetWorkspaceAgentUsageStats(ctx context.Context, createdAt time.Time) ([]database.GetWorkspaceAgentUsageStatsRow, error) {

Check failure on line 5641 in coderd/database/dbmem/dbmem.go

View workflow job for this annotation

GitHub Actions / lint

unused-receiver: method receiver 'q' is not referenced in method's body, consider removing or renaming it as _ (revive)
panic("not implemented")
}

func (q *FakeQuerier) GetWorkspaceAgentUsageStatsAndLabels(ctx context.Context, createdAt time.Time) ([]database.GetWorkspaceAgentUsageStatsAndLabelsRow, error) {

Check failure on line 5645 in coderd/database/dbmem/dbmem.go

View workflow job for this annotation

GitHub Actions / lint

unused-receiver: method receiver 'q' is not referenced in method's body, consider removing or renaming it as _ (revive)
panic("not implemented")
}

func (q *FakeQuerier) GetWorkspaceAgentsByResourceIDs(ctx context.Context, resourceIDs []uuid.UUID) ([]database.WorkspaceAgent, error) {
q.mutex.RLock()
defer q.mutex.RUnlock()
Expand Down
21 changes: 21 additions & 0 deletions coderd/database/dbmetrics/dbmetrics.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions coderd/database/dbmock/dbmock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion coderd/database/dump.sql

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE workspace_agent_stats DROP COLUMN usage;
1 change: 1 addition & 0 deletions coderd/database/migrations/000249_agent_stats_usage.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE workspace_agent_stats ADD COLUMN usage boolean NOT NULL DEFAULT false;
1 change: 1 addition & 0 deletions coderd/database/models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions coderd/database/querier.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading