Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // MinWait is the minimum interval between fetches. MinWait time.Duration `json:"duration_min"` // MaxWait is the maximum interval between fetches. MaxWait time.Duration `json:"duration_max"` // Trace is whether to trace the requests. Trace bool `json:"trace"` // Logger is the logger to use. Logger slog.Logger `json:"-"` // RollTable is the set of actions to perform RollTable RollTable `json:"roll_table"` }
type Params ¶
type Params struct {
// contains filtered or unexported fields
}
Params is a set of parameters to pass to the actions in a rollTable.
type PromMetrics ¶
type PromMetrics struct {
// contains filtered or unexported fields
}
func NewMetrics ¶
func NewMetrics(reg prometheus.Registerer) *PromMetrics
func (*PromMetrics) IncErrors ¶
func (p *PromMetrics) IncErrors(action string)
func (*PromMetrics) IncStatuses ¶
func (p *PromMetrics) IncStatuses(action string, code string)
func (*PromMetrics) ObserveDuration ¶
func (p *PromMetrics) ObserveDuration(action string, d time.Duration)
type RollTable ¶
type RollTable []RollTableEntry
RollTable is a slice of rollTableEntry.
var DefaultActions RollTable = []RollTableEntry{
{0, fetchWorkspaces, "fetch workspaces"},
{1, fetchUsers, "fetch users"},
{2, fetchTemplates, "fetch templates"},
{3, authCheckAsOwner, "authcheck owner"},
{4, authCheckAsNonOwner, "authcheck not owner"},
{5, fetchAuditLog, "fetch audit log"},
{6, fetchActiveUsers, "fetch active users"},
{7, fetchSuspendedUsers, "fetch suspended users"},
{8, fetchTemplateVersion, "fetch template version"},
{9, fetchWorkspace, "fetch workspace"},
{10, fetchTemplate, "fetch template"},
{11, fetchUserByID, "fetch user by ID"},
{12, fetchUserByUsername, "fetch user by username"},
{13, fetchWorkspaceBuild, "fetch workspace build"},
{14, fetchDeploymentConfig, "fetch deployment config"},
{15, fetchWorkspaceQuotaForUser, "fetch workspace quota for user"},
{16, fetchDeploymentStats, "fetch deployment stats"},
{17, fetchWorkspaceLogs, "fetch workspace logs"},
}
DefaultActions is a table of actions to perform. D&D nerds will feel right at home here :-) Note that the order of the table is important! Entries must be in ascending order.
type RollTableEntry ¶
type RollTableEntry struct { // Roll is the minimum number required to perform the action. Roll int // Fn is the function to call. Fn func(ctx context.Context, p *Params) error // Label is used for logging. Label string }
RollTableEntry is an entry in the roll table.
Click to show internal directories.
Click to hide internal directories.