memory

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package memory tracks the memory usage of the host.

Index

Constants

View Source
const (
	StateKeyVirtualMemory = "virtual_memory"

	StateKeyTotalBytes         = "total_bytes"
	StateKeyTotalHumanized     = "total_humanized"
	StateKeyAvailableBytes     = "available_bytes"
	StateKeyAvailableHumanized = "available_humanized"
	StateKeyUsedBytes          = "used_bytes"
	StateKeyUsedHumanized      = "used_humanized"
	StateKeyUsedPercent        = "used_percent"
	StateKeyFreeBytes          = "free_bytes"
	StateKeyFreeHumanized      = "free_humanized"
)
View Source
const Name = "memory"

Variables

This section is empty.

Functions

func Get

func Get(ctx context.Context) (_ any, e error)

func New

Types

type Config

type Config struct {
	Query query_config.Config `json:"query"`
}

func ParseConfig

func ParseConfig(b any, db *sql.DB) (*Config, error)

func (Config) Validate

func (cfg Config) Validate() error

type Output

type Output struct {
	TotalBytes     uint64 `json:"total_bytes"`
	TotalHumanized string `json:"total_humanized"`

	AvailableBytes     uint64 `json:"available_bytes"`
	AvailableHumanized string `json:"available_humanized"`

	UsedBytes     uint64 `json:"used_bytes"`
	UsedHumanized string `json:"used_humanized"`

	UsedPercent string `json:"used_percent"`

	FreeBytes     uint64 `json:"free_bytes"`
	FreeHumanized string `json:"free_humanized"`
}

func ParseOutputJSON

func ParseOutputJSON(data []byte) (*Output, error)

func ParseStateKeyVirtualMemory

func ParseStateKeyVirtualMemory(m map[string]string) (*Output, error)

func ParseStatesToOutput

func ParseStatesToOutput(states ...components.State) (*Output, error)

func (Output) GetUsedPercent

func (o Output) GetUsedPercent() (float64, error)

func (*Output) JSON

func (o *Output) JSON() ([]byte, error)

func (*Output) States

func (o *Output) States() ([]components.State, error)

Directories

Path Synopsis
Package metrics implements the memory metrics collection and reporting.
Package metrics implements the memory metrics collection and reporting.

Jump to

Keyboard shortcuts

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