host

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetMaxPeriod added in v1.0.22

func SetMaxPeriod(d time.Duration)

func TimeRange added in v1.0.22

func TimeRange(ctx *gin.Context)

func Usage added in v1.0.22

func Usage(ctx *gin.Context)

Types

type ResType added in v1.0.22

type ResType string
const (
	ResTypeCPU       ResType = "cpu"       // CPU usage
	ResTypeAppCPU    ResType = "appCpu"    // Application CPU usage
	ResTypeMemory    ResType = "mem"       // Memory usage
	ResTypeAppMem    ResType = "appMem"    // Application Memory usage
	ResTypeTotalMem  ResType = "totalMem"  // Total Memory usage
	ResTypeDisk      ResType = "disk"      // Disk usage
	ResTypeAppDisk   ResType = "appDisk"   // Application Disk usage
	ResTypeTotalDisk ResType = "totalDisk" // Total Disk usage
)

func (ResType) String added in v1.0.22

func (r ResType) String() string

type ResUsage added in v1.0.22

type ResUsage struct {
	CpuNum    int    `json:"cpuNum"`    // Number of CPU cores
	AppCpu    string `json:"appCpu"`    // Application CPU usage in percentage
	AppMem    string `json:"appMem"`    // Application Memory usage in percentage
	AppDisk   string `json:"appDisk"`   // Application Disk usage in percentage
	CPU       string `json:"cpu"`       // CPU usage in percentage
	Mem       string `json:"mem"`       // Memory usage in percentage
	TotalMem  string `json:"totalMem"`  // Total Memory in MB
	Disk      string `json:"disk"`      // Disk usage in percentage
	TotalDisk string `json:"totalDisk"` // Total Disk in MB
	At        int64  `json:"at"`        // Timestamp of the usage data
}

type Serv added in v1.0.22

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

func Host added in v1.0.22

func Host() *Serv

func (*Serv) ClearHostResourceUsage added in v1.0.22

func (s *Serv) ClearHostResourceUsage(ctx context.Context) error

ClearHostResourceUsage clears the host resource usage data older than MaxPeriod.

func (*Serv) Collect added in v1.0.22

func (s *Serv) Collect(ctx context.Context)

func (*Serv) GetHostResourceUsage added in v1.0.22

func (s *Serv) GetHostResourceUsage(ctx context.Context, page, size int64) (*cache.PageCache[ResUsage], error)

func (*Serv) Page added in v1.0.22

func (s *Serv) Page(ctx context.Context, page, size int64) (*cache.PageCache[ResUsage], *errors.Error)

func (*Serv) TimeRange added in v1.0.22

func (s *Serv) TimeRange(ctx context.Context, start, end int64, granularity cache.Granularity, field ...ResType) ([]*cache.PageTimeItem, *errors.Error)

Jump to

Keyboard shortcuts

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