diagnostics

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

internal/diagnostics/debugger.go

3. Update internal/diagnostics/doctor.go: internal/diagnostics/doctor.go

internal/diagnostics/system_info_linux.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckStatus

type CheckStatus string

CheckStatus represents the status of a diagnostic check

const (
	CheckStatusOK      CheckStatus = "ok"
	CheckStatusWarning CheckStatus = "warning"
	CheckStatusError   CheckStatus = "error"
	CheckStatusSkipped CheckStatus = "skipped"
)

type DebugInfo

type DebugInfo struct {
	Timestamp  time.Time                   `json:"timestamp"`
	System     SystemInfo                  `json:"system"`
	Docker     DockerInfo                  `json:"docker"`
	LocalCloud LocalCloudInfo              `json:"localcloud"`
	Services   map[string]ServiceDebugInfo `json:"services"`
	RecentLogs map[string][]string         `json:"recent_logs"`
	Errors     []ErrorInfo                 `json:"errors"`
}

DebugInfo contains all debug information

type Debugger

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

Debugger collects debug information

func NewDebugger

func NewDebugger(cfg *config.Config) (*Debugger, error)

NewDebugger creates a new debugger

func (*Debugger) CollectDebugInfo

func (d *Debugger) CollectDebugInfo(ctx context.Context, service string) error

CollectDebugInfo collects all debug information

func (*Debugger) GetDebugInfo

func (d *Debugger) GetDebugInfo() *DebugInfo

GetDebugInfo returns the collected debug information

func (*Debugger) SaveToFile

func (d *Debugger) SaveToFile(filename string) error

SaveToFile saves debug info to a file

type DiagnosticResult

type DiagnosticResult struct {
	Check    string
	Status   CheckStatus
	Message  string
	Solution string
	Details  map[string]interface{}
}

DiagnosticResult represents a diagnostic check result

type DiskInfo

type DiskInfo struct {
	Total       uint64  `json:"total"`
	Free        uint64  `json:"free"`
	Used        uint64  `json:"used"`
	PercentUsed float64 `json:"percent_used"`
}

DiskInfo contains disk information

type DockerInfo

type DockerInfo struct {
	Version       string        `json:"version"`
	APIVersion    string        `json:"api_version"`
	ServerVersion types.Version `json:"server_version"`
	Images        int           `json:"images_count"`
	Containers    int           `json:"containers_count"`
	RunningCount  int           `json:"running_count"`
	SystemInfo    types.Info    `json:"system_info"`
}

DockerInfo contains Docker information

type Doctor

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

Doctor performs system diagnostics

func NewDoctor

func NewDoctor(cfg *config.Config) *Doctor

NewDoctor creates a new diagnostic doctor

func (*Doctor) GetResults

func (d *Doctor) GetResults() []DiagnosticResult

GetResults returns diagnostic results

func (*Doctor) HasIssues

func (d *Doctor) HasIssues() bool

HasIssues returns true if any issues were found

func (*Doctor) RunDiagnostics

func (d *Doctor) RunDiagnostics() error

RunDiagnostics runs all diagnostic checks

type ErrorInfo

type ErrorInfo struct {
	Service   string    `json:"service"`
	Error     string    `json:"error"`
	Context   string    `json:"context"`
	Timestamp time.Time `json:"timestamp"`
}

ErrorInfo contains error information

type LocalCloudInfo

type LocalCloudInfo struct {
	Version       string         `json:"version"`
	ProjectName   string         `json:"project_name"`
	ProjectType   string         `json:"project_type"`
	ConfigPath    string         `json:"config_path"`
	Configuration *config.Config `json:"configuration"`
}

LocalCloudInfo contains LocalCloud specific information

type MemoryInfo

type MemoryInfo struct {
	Total       uint64  `json:"total"`
	Free        uint64  `json:"free"`
	Used        uint64  `json:"used"`
	PercentUsed float64 `json:"percent_used"`
}

MemoryInfo contains memory information

type ResourceInfo

type ResourceInfo struct {
	CPUPercent    float64 `json:"cpu_percent"`
	MemoryUsage   uint64  `json:"memory_usage"`
	MemoryLimit   uint64  `json:"memory_limit"`
	MemoryPercent float64 `json:"memory_percent"`
	NetworkRx     uint64  `json:"network_rx_bytes"`
	NetworkTx     uint64  `json:"network_tx_bytes"`
}

ResourceInfo contains resource usage information

type ServiceDebugInfo

type ServiceDebugInfo struct {
	Name          string            `json:"name"`
	ContainerID   string            `json:"container_id"`
	Image         string            `json:"image"`
	Status        string            `json:"status"`
	State         string            `json:"state"`
	Health        string            `json:"health"`
	CreatedAt     time.Time         `json:"created_at"`
	StartedAt     time.Time         `json:"started_at"`
	RestartCount  int               `json:"restart_count"`
	Ports         map[string]string `json:"ports"`
	Environment   []string          `json:"environment"`
	Mounts        []string          `json:"mounts"`
	Networks      []string          `json:"networks"`
	ResourceUsage ResourceInfo      `json:"resource_usage"`
	LastLogs      []string          `json:"last_logs"`
}

ServiceDebugInfo contains debug info for a service

type SystemInfo

type SystemInfo struct {
	OS          string            `json:"os"`
	Arch        string            `json:"arch"`
	CPUs        int               `json:"cpus"`
	GoVersion   string            `json:"go_version"`
	Memory      MemoryInfo        `json:"memory"`
	Disk        DiskInfo          `json:"disk"`
	Environment map[string]string `json:"environment"`
}

SystemInfo contains system information

Jump to

Keyboard shortcuts

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