workspaceupdates

package
v2.32.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2026 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WorkspaceUpdatesLatencyMetric = "workspace_updates_latency_seconds"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// User is the configuration for the user to create.
	User createusers.Config `json:"user"`

	// Workspace is the configuration for the workspace to create. The workspace
	// will be built using the new user.
	//
	// OrganizationID is ignored and set to the new user's organization ID.
	Workspace workspacebuild.Config `json:"workspace"`

	// WorkspaceCount is the number of workspaces to create.
	WorkspaceCount int64 `json:"power_user_workspaces"`

	// WorkspaceUpdatesTimeout is how long to wait for all expected workspace updates.
	WorkspaceUpdatesTimeout time.Duration `json:"workspace_updates_timeout"`

	// DialTimeout is how long to wait to successfully dial the Coder Connect
	// endpoint.
	DialTimeout time.Duration `json:"dial_timeout"`

	Metrics *Metrics `json:"-"`

	// DialBarrier is used to ensure all runners have dialed the Coder Connect
	// endpoint before creating their workspace(s).
	DialBarrier *sync.WaitGroup `json:"-"`
}

func (Config) Validate

func (c Config) Validate() error

type Metrics

type Metrics struct {
	WorkspaceUpdatesLatencySeconds prometheus.HistogramVec
	WorkspaceUpdatesErrorsTotal    prometheus.CounterVec
}

func NewMetrics

func NewMetrics(reg prometheus.Registerer) *Metrics

func (*Metrics) AddError

func (m *Metrics) AddError(username string, ownedWorkspaces int64, action string)

func (*Metrics) RecordCompletion

func (m *Metrics) RecordCompletion(elapsed time.Duration, username string, ownedWorkspaces int64, workspace string)

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

func NewRunner

func NewRunner(client *codersdk.Client, cfg Config) *Runner

func (*Runner) Cleanup

func (r *Runner) Cleanup(ctx context.Context, id string, logs io.Writer) error

func (*Runner) GetMetrics

func (r *Runner) GetMetrics() map[string]any

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, id string, logs io.Writer) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL