support

package
v2.33.3 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: AGPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanGenerateFull added in v2.32.0

func CanGenerateFull(ctx context.Context, client *codersdk.Client) (bool, error)

CanGenerateFull checks if the user can generate a 'full' support bundle or only has permissions to generate a 'partial' bundle.

func VersionSupportsPprof added in v2.30.0

func VersionSupportsPprof(version string) bool

VersionSupportsPprof checks if the given version supports pprof endpoints.

Types

type Agent added in v2.10.0

type Agent struct {
	Agent               *codersdk.WorkspaceAgent                       `json:"agent"`
	ConnectionInfo      *workspacesdk.AgentConnectionInfo              `json:"connection_info"`
	ListeningPorts      *codersdk.WorkspaceAgentListeningPortsResponse `json:"listening_ports"`
	Logs                []byte                                         `json:"logs"`
	ClientMagicsockHTML []byte                                         `json:"client_magicsock_html"`
	AgentMagicsockHTML  []byte                                         `json:"agent_magicsock_html"`
	Manifest            *agentsdk.Manifest                             `json:"manifest"`
	PeerDiagnostics     *tailnet.PeerDiagnostics                       `json:"peer_diagnostics"`
	PingResult          *ipnstate.PingResult                           `json:"ping_result"`
	Prometheus          []byte                                         `json:"prometheus"`
	StartupLogs         []codersdk.WorkspaceAgentLog                   `json:"startup_logs"`
}

func AgentInfo added in v2.10.0

func AgentInfo(ctx context.Context, client *codersdk.Client, log slog.Logger, agentID uuid.UUID) Agent

type Bundle

type Bundle struct {
	Deployment    Deployment   `json:"deployment"`
	Network       Network      `json:"network"`
	Workspace     Workspace    `json:"workspace"`
	Agent         Agent        `json:"agent"`
	Logs          []string     `json:"logs"`
	CLILogs       []byte       `json:"cli_logs"`
	NamedTemplate TemplateDump `json:"named_template"`
	Pprof         Pprof        `json:"pprof"`
}

Bundle is a set of information discovered about a deployment. Even though we do attempt to sanitize data, it may still contain sensitive information and should thus be treated as secret.

func Run

func Run(ctx context.Context, d *Deps) (*Bundle, error)

Run generates a support bundle with the given dependencies.

type Deployment

type Deployment struct {
	BuildInfo      *codersdk.BuildInfoResponse  `json:"build"`
	Config         *codersdk.DeploymentConfig   `json:"config"`
	Experiments    codersdk.Experiments         `json:"experiments"`
	HealthReport   *healthsdk.HealthcheckReport `json:"health_report"`
	Licenses       []codersdk.License           `json:"licenses"`
	Stats          *codersdk.DeploymentStats    `json:"stats"`
	Entitlements   *codersdk.Entitlements       `json:"entitlements"`
	HealthSettings *healthsdk.HealthSettings    `json:"health_settings"`
	Workspaces     *codersdk.WorkspacesResponse `json:"workspaces"`
	Prometheus     []byte                       `json:"prometheus"`
}

func DeploymentInfo

func DeploymentInfo(ctx context.Context, client *codersdk.Client, log slog.Logger, workspacesCap int) Deployment

type Deps

type Deps struct {
	// Source from which to obtain information.
	Client *codersdk.Client
	// Log is where to log any informational or warning messages.
	Log slog.Logger
	// WorkspaceID is the optional workspace against which to run connection tests.
	WorkspaceID uuid.UUID
	// AgentID is the optional agent ID against which to run connection tests.
	// Defaults to the first agent of the workspace, if not specified.
	AgentID uuid.UUID
	// WorkspacesTotalCap limits the TOTAL number of workspaces aggregated into the bundle.
	// > 0  => cap at this number (default flag value should be 1000 via CLI).
	// <= 0 => no cap (fetch/keep all available workspaces).
	WorkspacesTotalCap int
	// TemplateID optionally specifies a template to capture (active version).
	TemplateID uuid.UUID
	// CollectPprof toggles server and agent pprof collection.
	CollectPprof bool
}

Deps is a set of dependencies for discovering information

type Netcheck added in v2.11.0

type Netcheck struct {
	Report *netcheck.Report `json:"report"`
	Error  string           `json:"error"`
	Logs   []string         `json:"logs"`
}

type Network

type Network struct {
	ConnectionInfo   workspacesdk.AgentConnectionInfo
	CoordinatorDebug string                     `json:"coordinator_debug"`
	Netcheck         *derphealth.Report         `json:"netcheck"`
	TailnetDebug     string                     `json:"tailnet_debug"`
	Interfaces       healthsdk.InterfacesReport `json:"interfaces"`
}

func NetworkInfo

func NetworkInfo(ctx context.Context, client *codersdk.Client, log slog.Logger) Network

type Pprof added in v2.30.0

type Pprof struct {
	Server *PprofCollection `json:"server,omitempty"`
	Agent  *PprofCollection `json:"agent,omitempty"`
}

type PprofCollection added in v2.30.0

type PprofCollection struct {
	Heap         []byte    `json:"heap,omitempty"`
	Allocs       []byte    `json:"allocs,omitempty"`
	Profile      []byte    `json:"profile,omitempty"`
	Block        []byte    `json:"block,omitempty"`
	Mutex        []byte    `json:"mutex,omitempty"`
	Goroutine    []byte    `json:"goroutine,omitempty"`
	Threadcreate []byte    `json:"threadcreate,omitempty"`
	Trace        []byte    `json:"trace,omitempty"`
	Cmdline      string    `json:"cmdline,omitempty"`
	Symbol       string    `json:"symbol,omitempty"`
	CollectedAt  time.Time `json:"collected_at"`
	EndpointURL  string    `json:"endpoint_url"`
}

func PprofInfo added in v2.30.0

func PprofInfo(ctx context.Context, client *codersdk.Client, log slog.Logger) *PprofCollection

func PprofInfoFromAgent added in v2.30.0

func PprofInfoFromAgent(ctx context.Context, conn workspacesdk.AgentConn, log slog.Logger) *PprofCollection

func PprofInfoFromArchive added in v2.32.0

func PprofInfoFromArchive(ctx context.Context, client *codersdk.Client, log slog.Logger, duration time.Duration) (*PprofCollection, error)

PprofInfoFromArchive uses the consolidated /api/v2/debug/profile endpoint to collect pprof data in a single request. The server temporarily enables block/mutex profiling, runs time-based profiles for the given duration, takes snapshots, and returns a tar.gz archive.

type TemplateDump added in v2.30.0

type TemplateDump struct {
	Template           codersdk.Template        `json:"template"`
	TemplateVersion    codersdk.TemplateVersion `json:"template_version"`
	TemplateFileBase64 string                   `json:"template_file_base64"`
}

type Workspace

type Workspace struct {
	Workspace          codersdk.Workspace                 `json:"workspace"`
	Parameters         []codersdk.WorkspaceBuildParameter `json:"parameters"`
	Template           codersdk.Template                  `json:"template"`
	TemplateVersion    codersdk.TemplateVersion           `json:"template_version"`
	TemplateFileBase64 string                             `json:"template_file_base64"`
	BuildLogs          []codersdk.ProvisionerJobLog       `json:"build_logs"`
}

func WorkspaceInfo

func WorkspaceInfo(ctx context.Context, client *codersdk.Client, log slog.Logger, workspaceID uuid.UUID) Workspace

Jump to

Keyboard shortcuts

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