mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: move Batcher and Tracker to workspacestats (#13418)
This commit is contained in:
@@ -7,8 +7,6 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
"google.golang.org/protobuf/types/known/durationpb"
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
||||
"cdr.dev/slog"
|
||||
agentproto "github.com/coder/coder/v2/agent/proto"
|
||||
"github.com/coder/coder/v2/coderd/database"
|
||||
@@ -16,10 +14,6 @@ import (
|
||||
"github.com/coder/coder/v2/coderd/workspacestats"
|
||||
)
|
||||
|
||||
type StatsBatcher interface {
|
||||
Add(now time.Time, agentID uuid.UUID, templateID uuid.UUID, userID uuid.UUID, workspaceID uuid.UUID, st *agentproto.Stats) error
|
||||
}
|
||||
|
||||
type StatsAPI struct {
|
||||
AgentFn func(context.Context) (database.WorkspaceAgent, error)
|
||||
Database database.Store
|
||||
|
||||
@@ -39,7 +39,7 @@ type statsBatcher struct {
|
||||
lastStats *agentproto.Stats
|
||||
}
|
||||
|
||||
var _ agentapi.StatsBatcher = &statsBatcher{}
|
||||
var _ workspacestats.Batcher = &statsBatcher{}
|
||||
|
||||
func (b *statsBatcher) Add(now time.Time, agentID uuid.UUID, templateID uuid.UUID, userID uuid.UUID, workspaceID uuid.UUID, st *agentproto.Stats) error {
|
||||
b.mu.Lock()
|
||||
|
||||
Reference in New Issue
Block a user