@@ -27,6 +27,7 @@ import (
27
27
"github.com/coder/coder/v2/coderd/notifications"
28
28
"github.com/coder/coder/v2/coderd/schedule"
29
29
"github.com/coder/coder/v2/coderd/wsbuilder"
30
+ "github.com/coder/coder/v2/codersdk"
30
31
)
31
32
32
33
// Executor automatically starts or stops workspaces.
@@ -43,6 +44,7 @@ type Executor struct {
43
44
// NotificationsEnqueuer handles enqueueing notifications for delivery by SMTP, webhook, etc.
44
45
notificationsEnqueuer notifications.Enqueuer
45
46
reg prometheus.Registerer
47
+ experiments codersdk.Experiments
46
48
47
49
metrics executorMetrics
48
50
}
@@ -59,7 +61,7 @@ type Stats struct {
59
61
}
60
62
61
63
// New returns a new wsactions executor.
62
- func NewExecutor (ctx context.Context , db database.Store , ps pubsub.Pubsub , reg prometheus.Registerer , tss * atomic.Pointer [schedule.TemplateScheduleStore ], auditor * atomic.Pointer [audit.Auditor ], acs * atomic.Pointer [dbauthz.AccessControlStore ], log slog.Logger , tick <- chan time.Time , enqueuer notifications.Enqueuer ) * Executor {
64
+ func NewExecutor (ctx context.Context , db database.Store , ps pubsub.Pubsub , reg prometheus.Registerer , tss * atomic.Pointer [schedule.TemplateScheduleStore ], auditor * atomic.Pointer [audit.Auditor ], acs * atomic.Pointer [dbauthz.AccessControlStore ], log slog.Logger , tick <- chan time.Time , enqueuer notifications.Enqueuer , exp codersdk. Experiments ) * Executor {
63
65
factory := promauto .With (reg )
64
66
le := & Executor {
65
67
//nolint:gocritic // Autostart has a limited set of permissions.
@@ -73,6 +75,7 @@ func NewExecutor(ctx context.Context, db database.Store, ps pubsub.Pubsub, reg p
73
75
accessControlStore : acs ,
74
76
notificationsEnqueuer : enqueuer ,
75
77
reg : reg ,
78
+ experiments : exp ,
76
79
metrics : executorMetrics {
77
80
autobuildExecutionDuration : factory .NewHistogram (prometheus.HistogramOpts {
78
81
Namespace : "coderd" ,
@@ -258,6 +261,7 @@ func (e *Executor) runOnce(t time.Time) Stats {
258
261
builder := wsbuilder .New (ws , nextTransition ).
259
262
SetLastWorkspaceBuildInTx (& latestBuild ).
260
263
SetLastWorkspaceBuildJobInTx (& latestJob ).
264
+ Experiments (e .experiments ).
261
265
Reason (reason )
262
266
log .Debug (e .ctx , "auto building workspace" , slog .F ("transition" , nextTransition ))
263
267
if nextTransition == database .WorkspaceTransitionStart &&
0 commit comments