system

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WSKindProjectLogs    = "project_logs"
	WSKindContainerLogs  = "container_logs"
	WSKindContainerStats = "container_stats"
	WSKindContainerExec  = "container_exec"
	WSKindSystemStats    = "system_stats"
	WSKindServiceLogs    = "service_logs"
)

WebSocket connection kind constants.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConvertDockerRunRequest

type ConvertDockerRunRequest struct {
	DockerRunCommand string `json:"dockerRunCommand" binding:"required"`
}

type ConvertDockerRunResponse

type ConvertDockerRunResponse struct {
	Success       bool   `json:"success"`
	DockerCompose string `json:"dockerCompose"`
	EnvVars       string `json:"envVars"`
	ServiceName   string `json:"serviceName"`
}

type Diagnostics

type Diagnostics struct {
	// Timestamp is when the snapshot was taken.
	//
	// Required: true
	Timestamp time.Time `json:"timestamp"`
	// Runtime holds Go runtime and scheduler counters.
	//
	// Required: true
	Runtime RuntimeInfo `json:"runtime"`
	// Memory holds a subset of runtime.MemStats.
	//
	// Required: true
	Memory MemoryInfo `json:"memory"`
	// GC holds garbage-collector statistics.
	//
	// Required: true
	GC GCInfo `json:"gc"`
	// WebSocket holds active WebSocket connection metrics.
	//
	// Required: true
	WebSocket WebSocketDiagnostics `json:"websocket"`
}

Diagnostics is a point-in-time snapshot of the Go runtime, garbage collector, and active WebSocket connections. It is returned by the diagnostics REST endpoint and pushed over the live diagnostics WebSocket stream.

type DockerComposeConfig

type DockerComposeConfig struct {
	Services map[string]DockerComposeService `yaml:"services" json:"services"`
}

type DockerComposeDeploy

type DockerComposeDeploy struct {
	Resources *DockerComposeResources `yaml:"resources,omitempty" json:"resources,omitempty"`
}

type DockerComposeHealthcheck

type DockerComposeHealthcheck struct {
	Test string `yaml:"test" json:"test"`
}

type DockerComposeResourceLimits

type DockerComposeResourceLimits struct {
	Memory string `yaml:"memory,omitempty" json:"memory,omitempty"`
	CPUs   string `yaml:"cpus,omitempty" json:"cpus,omitempty"`
}

type DockerComposeResources

type DockerComposeResources struct {
	Limits *DockerComposeResourceLimits `yaml:"limits,omitempty" json:"limits,omitempty"`
}

type DockerComposeService

type DockerComposeService struct {
	Image         string                    `yaml:"image" json:"image"`
	ContainerName string                    `yaml:"container_name,omitempty" json:"container_name,omitempty"`
	Ports         []string                  `yaml:"ports,omitempty" json:"ports,omitempty"`
	Volumes       []string                  `yaml:"volumes,omitempty" json:"volumes,omitempty"`
	Environment   []string                  `yaml:"environment,omitempty" json:"environment,omitempty"`
	Networks      []string                  `yaml:"networks,omitempty" json:"networks,omitempty"`
	Restart       string                    `yaml:"restart,omitempty" json:"restart,omitempty"`
	WorkingDir    string                    `yaml:"working_dir,omitempty" json:"working_dir,omitempty"`
	User          string                    `yaml:"user,omitempty" json:"user,omitempty"`
	Entrypoint    string                    `yaml:"entrypoint,omitempty" json:"entrypoint,omitempty"`
	Command       string                    `yaml:"command,omitempty" json:"command,omitempty"`
	StdinOpen     bool                      `yaml:"stdin_open,omitempty" json:"stdin_open,omitempty"`
	TTY           bool                      `yaml:"tty,omitempty" json:"tty,omitempty"`
	Privileged    bool                      `yaml:"privileged,omitempty" json:"privileged,omitempty"`
	Labels        []string                  `yaml:"labels,omitempty" json:"labels,omitempty"`
	Healthcheck   *DockerComposeHealthcheck `yaml:"healthcheck,omitempty" json:"healthcheck,omitempty"`
	Deploy        *DockerComposeDeploy      `yaml:"deploy,omitempty" json:"deploy,omitempty"`
}

type DockerRunCommand

type DockerRunCommand struct {
	Image       string   `json:"image"`
	Name        string   `json:"name,omitempty"`
	Ports       []string `json:"ports,omitempty"`
	Volumes     []string `json:"volumes,omitempty"`
	Environment []string `json:"environment,omitempty"`
	Networks    []string `json:"networks,omitempty"`
	Restart     string   `json:"restart,omitempty"`
	Workdir     string   `json:"workdir,omitempty"`
	User        string   `json:"user,omitempty"`
	Entrypoint  string   `json:"entrypoint,omitempty"`
	Command     string   `json:"command,omitempty"`
	Detached    bool     `json:"detached,omitempty"`
	Interactive bool     `json:"interactive,omitempty"`
	TTY         bool     `json:"tty,omitempty"`
	Remove      bool     `json:"remove,omitempty"`
	Privileged  bool     `json:"privileged,omitempty"`
	Labels      []string `json:"labels,omitempty"`
	HealthCheck string   `json:"healthCheck,omitempty"`
	MemoryLimit string   `json:"memoryLimit,omitempty"`
	CPULimit    string   `json:"cpuLimit,omitempty"`
}

type GCInfo

type GCInfo struct {
	// LastGC is the time of the most recent collection.
	LastGC time.Time `json:"lastGc"`
	// NumGC is the total number of completed GC cycles.
	NumGC int64 `json:"numGc"`
	// PauseTotalNs is the cumulative stop-the-world pause time in nanoseconds.
	PauseTotalNs int64 `json:"pauseTotalNs"`
	// RecentPausesNs lists the most recent GC pause durations (ns), newest first.
	RecentPausesNs []int64 `json:"recentPausesNs"`
}

GCInfo holds garbage-collector statistics from runtime/debug.ReadGCStats.

type GPUStats

type GPUStats struct {
	// Name is the GPU model or identifier.
	//
	// Required: true
	Name string `json:"name"`
	// Index is the zero-based GPU index.
	//
	// Required: true
	Index int `json:"index"`
	// MemoryUsed is the GPU memory currently used, in bytes.
	//
	// Required: true
	MemoryUsed float64 `json:"memoryUsed"`
	// MemoryTotal is the total GPU memory available, in bytes.
	//
	// Required: true
	MemoryTotal float64 `json:"memoryTotal"`
}

GPUStats represents resource statistics for a single GPU.

type HealthResponse

type HealthResponse struct {
	// Status indicates the health status (e.g., "UP", "DOWN").
	//
	// Required: true
	Status string `json:"status"`
}

HealthResponse contains the health status of the API.

type LogEntry

type LogEntry struct {
	// Time is when the record was emitted.
	//
	// Required: true
	Time time.Time `json:"time"`
	// Level is the slog level name (DEBUG, INFO, WARN, ERROR).
	//
	// Required: true
	Level string `json:"level"`
	// Message is the log message.
	//
	// Required: true
	Message string `json:"message"`
	// Attrs holds the record's structured attributes, if any.
	Attrs map[string]any `json:"attrs,omitempty"`
}

LogEntry is a single captured backend log record, exposed via the recent-logs endpoint and the live log WebSocket stream.

type MemoryInfo

type MemoryInfo struct {
	Alloc         uint64  `json:"alloc"`
	TotalAlloc    uint64  `json:"totalAlloc"`
	Sys           uint64  `json:"sys"`
	HeapAlloc     uint64  `json:"heapAlloc"`
	HeapSys       uint64  `json:"heapSys"`
	HeapInuse     uint64  `json:"heapInuse"`
	HeapIdle      uint64  `json:"heapIdle"`
	HeapReleased  uint64  `json:"heapReleased"`
	HeapObjects   uint64  `json:"heapObjects"`
	StackInuse    uint64  `json:"stackInuse"`
	StackSys      uint64  `json:"stackSys"`
	MSpanInuse    uint64  `json:"mspanInuse"`
	MCacheInuse   uint64  `json:"mcacheInuse"`
	NextGC        uint64  `json:"nextGc"`
	NumGC         uint32  `json:"numGc"`
	NumForcedGC   uint32  `json:"numForcedGc"`
	GCCPUFraction float64 `json:"gcCpuFraction"`
}

MemoryInfo is the subset of runtime.MemStats surfaced in diagnostics. All byte counts are raw bytes.

type PruneAllRequest

type PruneAllRequest struct {
	Containers *PruneContainersOptions `json:"containers,omitempty"`
	Images     *PruneImagesOptions     `json:"images,omitempty"`
	Volumes    *PruneVolumesOptions    `json:"volumes,omitempty"`
	Networks   *PruneNetworksOptions   `json:"networks,omitempty"`
	BuildCache *PruneBuildCacheOptions `json:"buildCache,omitempty"`
}

PruneAllRequest is used to request pruning of Docker system resources.

func (*PruneAllRequest) UnmarshalJSON

func (r *PruneAllRequest) UnmarshalJSON(data []byte) error

type PruneAllResult

type PruneAllResult struct {
	// ContainersPruned is a list of container IDs that were pruned.
	//
	// Required: false
	ContainersPruned []string `json:"containersPruned,omitempty"`

	// ImagesDeleted is a list of image IDs that were deleted.
	//
	// Required: false
	ImagesDeleted []string `json:"imagesDeleted,omitempty"`

	// VolumesDeleted is a list of volume IDs that were deleted.
	//
	// Required: false
	VolumesDeleted []string `json:"volumesDeleted,omitempty"`

	// NetworksDeleted is a list of network IDs that were deleted.
	//
	// Required: false
	NetworksDeleted []string `json:"networksDeleted,omitempty"`

	// SpaceReclaimed is the amount of space reclaimed in bytes.
	//
	// Required: true
	SpaceReclaimed uint64 `json:"spaceReclaimed"`

	// ContainerSpaceReclaimed is the amount of space reclaimed from containers in bytes.
	//
	// Required: false
	ContainerSpaceReclaimed uint64 `json:"containerSpaceReclaimed,omitempty"`

	// ImageSpaceReclaimed is the amount of space reclaimed from images in bytes.
	//
	// Required: false
	ImageSpaceReclaimed uint64 `json:"imageSpaceReclaimed,omitempty"`

	// VolumeSpaceReclaimed is the amount of space reclaimed from volumes in bytes.
	//
	// Required: false
	VolumeSpaceReclaimed uint64 `json:"volumeSpaceReclaimed,omitempty"`

	// BuildCacheSpaceReclaimed is the amount of space reclaimed from build cache in bytes.
	//
	// Required: false
	BuildCacheSpaceReclaimed uint64 `json:"buildCacheSpaceReclaimed,omitempty"`

	// Success indicates if the prune operation was successful.
	//
	// Required: true
	Success bool `json:"success"`

	// Errors is a list of any errors encountered during the prune operation.
	//
	// Required: false
	Errors []string `json:"errors,omitempty"`

	// ActivityID is the background activity that tracked this prune operation.
	//
	// Required: false
	ActivityID *string `json:"activityId,omitempty"`
}

PruneAllResult is the result of a prune operation on Docker system resources.

type PruneBuildCacheMode

type PruneBuildCacheMode string
const (
	PruneBuildCacheModeNone      PruneBuildCacheMode = "none"
	PruneBuildCacheModeUnused    PruneBuildCacheMode = "unused"
	PruneBuildCacheModeAll       PruneBuildCacheMode = "all"
	PruneBuildCacheModeOlderThan PruneBuildCacheMode = "olderThan"
)

type PruneBuildCacheOptions

type PruneBuildCacheOptions struct {
	Mode  PruneBuildCacheMode `json:"mode"`
	Until string              `json:"until,omitempty"`
}

type PruneContainerMode

type PruneContainerMode string
const (
	PruneContainerModeNone      PruneContainerMode = "none"
	PruneContainerModeStopped   PruneContainerMode = "stopped"
	PruneContainerModeOlderThan PruneContainerMode = "olderThan"
)

type PruneContainersOptions

type PruneContainersOptions struct {
	Mode  PruneContainerMode `json:"mode"`
	Until string             `json:"until,omitempty"`
}

type PruneImageMode

type PruneImageMode string
const (
	PruneImageModeNone      PruneImageMode = "none"
	PruneImageModeDangling  PruneImageMode = "dangling"
	PruneImageModeAll       PruneImageMode = "all"
	PruneImageModeOlderThan PruneImageMode = "olderThan"
)

type PruneImagesOptions

type PruneImagesOptions struct {
	Mode  PruneImageMode `json:"mode"`
	Until string         `json:"until,omitempty"`
}

type PruneNetworkMode

type PruneNetworkMode string
const (
	PruneNetworkModeNone      PruneNetworkMode = "none"
	PruneNetworkModeUnused    PruneNetworkMode = "unused"
	PruneNetworkModeOlderThan PruneNetworkMode = "olderThan"
)

type PruneNetworksOptions

type PruneNetworksOptions struct {
	Mode  PruneNetworkMode `json:"mode"`
	Until string           `json:"until,omitempty"`
}

type PruneVolumeMode

type PruneVolumeMode string
const (
	PruneVolumeModeNone      PruneVolumeMode = "none"
	PruneVolumeModeAnonymous PruneVolumeMode = "anonymous"
	PruneVolumeModeAll       PruneVolumeMode = "all"
)

type PruneVolumesOptions

type PruneVolumesOptions struct {
	Mode PruneVolumeMode `json:"mode"`
}

type RuntimeInfo

type RuntimeInfo struct {
	Goroutines         int    `json:"goroutines"`
	WSWorkerGoroutines int    `json:"wsWorkerGoroutines"`
	GOMAXPROCS         int    `json:"gomaxprocs"`
	NumCPU             int    `json:"numCpu"`
	GoVersion          string `json:"goVersion"`
	OS                 string `json:"os"`
	Arch               string `json:"arch"`
	NumCgoCall         int64  `json:"numCgoCall"`
	UptimeSeconds      int64  `json:"uptimeSeconds"`
}

RuntimeInfo describes the Go runtime, build, and scheduler state.

type SystemStats

type SystemStats struct {
	// CPUUsage is the total CPU usage percentage.
	//
	// Required: true
	CPUUsage float64 `json:"cpuUsage"`
	// MemoryUsage is the used system memory, in bytes.
	//
	// Required: true
	MemoryUsage uint64 `json:"memoryUsage"`
	// MemoryTotal is the total system memory, in bytes.
	//
	// Required: true
	MemoryTotal uint64 `json:"memoryTotal"`
	// DiskUsage is the used disk space, in bytes.
	DiskUsage uint64 `json:"diskUsage,omitempty"`
	// DiskTotal is the total disk space, in bytes.
	DiskTotal uint64 `json:"diskTotal,omitempty"`
	// CPUCount is the number of CPUs available to the system.
	//
	// Required: true
	CPUCount int `json:"cpuCount"`
	// Architecture is the CPU architecture (e.g., amd64).
	//
	// Required: true
	Architecture string `json:"architecture"`
	// Platform is the operating system platform (e.g., linux).
	//
	// Required: true
	Platform string `json:"platform"`
	// Hostname is the system hostname.
	Hostname string `json:"hostname,omitempty"`
	// GPUCount is the number of GPUs detected.
	//
	// Required: true
	GPUCount int `json:"gpuCount"`
	// GPUs contains per-GPU resource statistics.
	GPUs []GPUStats `json:"gpus,omitempty"`
}

SystemStats represents system resource statistics for WebSocket streaming.

type WebSocketConnectionInfo

type WebSocketConnectionInfo struct {
	// ID is the unique identifier for the connection.
	//
	// Required: true
	ID string `json:"id"`
	// Kind is the type of WebSocket connection (e.g. project_logs, container_stats).
	//
	// Required: true
	Kind string `json:"kind"`
	// EnvID is the environment the connection belongs to.
	EnvID string `json:"envId,omitempty"`
	// ResourceID is the ID of the resource being streamed (container, project, etc.).
	ResourceID string `json:"resourceId,omitempty"`
	// ClientIP is the remote address of the client.
	ClientIP string `json:"clientIp,omitempty"`
	// UserID is the authenticated user who opened the connection.
	UserID string `json:"userId,omitempty"`
	// UserAgent is the HTTP User-Agent header from the client.
	UserAgent string `json:"userAgent,omitempty"`
	// StartedAt is when the connection was established.
	//
	// Required: true
	StartedAt time.Time `json:"startedAt"`
}

WebSocketConnectionInfo describes a single active WebSocket connection.

type WebSocketDiagnostics

type WebSocketDiagnostics struct {
	Snapshot    WebSocketMetricsSnapshot  `json:"snapshot"`
	Connections []WebSocketConnectionInfo `json:"connections"`
}

WebSocketDiagnostics aggregates the active WebSocket connection counts and the list of currently-tracked connections.

type WebSocketMetricsSnapshot

type WebSocketMetricsSnapshot struct {
	// ProjectLogsActive is the number of active project-log streams.
	ProjectLogsActive int64 `json:"projectLogsActive"`
	// ContainerLogsActive is the number of active container-log streams.
	ContainerLogsActive int64 `json:"containerLogsActive"`
	// ContainerStats is the number of active container-stats streams.
	ContainerStats int64 `json:"containerStats"`
	// ContainerExec is the number of active container-exec sessions.
	ContainerExec int64 `json:"containerExec"`
	// SystemStats is the number of active system-stats streams.
	SystemStats int64 `json:"systemStats"`
	// ServiceLogsActive is the number of active swarm service-log streams.
	ServiceLogsActive int64 `json:"serviceLogsActive"`
}

WebSocketMetricsSnapshot is a point-in-time copy of active WebSocket connection counts, broken down by kind.

Jump to

Keyboard shortcuts

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