stat

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2022 License: MIT Imports: 8 Imported by: 2

README

stat

Statistics on system and process cpu and memory information, alarm notification support.


Example of use

	l, _ := zap.NewDevelopment()
    stat.Init(
        WithLog(l),
        WithPrintInterval(time.Minute),
        WithEnableAlarm(WithCPUThreshold(0.9), WithMemoryThreshold(0.85)), // invalid if it is windows
    )

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(opts ...Option)

Init initialize statistical information

Types

type AlarmOption

type AlarmOption func(*alarmOptions)

AlarmOption set the alarm options field.

func WithCPUThreshold

func WithCPUThreshold(threshold float64) AlarmOption

WithCPUThreshold set cpu threshold, range 0 to 1

func WithMemoryThreshold

func WithMemoryThreshold(threshold float64) AlarmOption

WithMemoryThreshold set memory threshold, range 0 to 1

type Option

type Option func(*options)

Option set the stat options field.

func WithAlarm

func WithAlarm(opts ...AlarmOption) Option

WithAlarm enable alarm and notify, except windows

func WithLog

func WithLog(l *zap.Logger) Option

WithLog set zapLog

func WithPrintInterval

func WithPrintInterval(d time.Duration) Option

WithPrintInterval set print interval

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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