Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Monitor ¶
type Monitor struct {
Holder *StatsHolder
// contains filtered or unexported fields
}
Monitor tracks and renders the server's process and operating system statistics.
Look its `Stats` and `View` methods. Initialize with the `New` package-level function.
func New ¶
New returns a new Monitor. Metrics stored through expvar standard package: - pid_cpu - pid_ram - pid_conns - os_cpu - os_ram - os_total_ram - os_load_avg - os_conns
Check https://github.com/iris-contrib/middleware/tree/master/expmetric which can be integrated with datadog or other platforms.
type Options ¶
type Options struct {
// Optional process id, defaults to the current one.
PID int32 `json:"pid" yaml:"PID"`
RefreshInterval time.Duration `json:"refresh_interval" yaml:"RefreshInterval"`
ViewRefreshInterval time.Duration `json:"view_refresh_interval" yaml:"ViewRefreshInterval"`
// If more than zero enables line animation. Defaults to zero.
ViewAnimationInterval time.Duration `json:"view_animation_interval" yaml:"ViewAnimationInterval"`
// The title of the monitor HTML document.
ViewTitle string `json:"view_title" yaml:"ViewTitle"`
}
Options holds the optional fields for the Monitor structure.
type Stats ¶
type Stats struct {
PIDCPU float64 `json:"pid_cpu" yaml:"PIDCPU"`
PIDRAM uint64 `json:"pid_ram" yaml:"PIDRAM"`
PIDConns int64 `json:"pid_conns" yaml:"PIDConns"`
OSCPU float64 `json:"os_cpu" yaml:"OSCPU"`
OSRAM uint64 `json:"os_ram" yaml:"OSRAM"`
OSTotalRAM uint64 `json:"os_total_ram" yaml:"OSTotalRAM"`
OSLoadAvg float64 `json:"os_load_avg" yaml:"OSLoadAvg"`
OSConns int64 `json:"os_conns" yaml:"OSConns"`
}
Stats holds the process and operating system statistics values.
Note that each statistic has its own expvar metric that you can use to render e.g. through statsd. Available values: * pid_cpu * pid_ram * pid_conns * os_cpu * os_ram * os_total_ram * os_load_avg * os_conns
type StatsHolder ¶
type StatsHolder struct {
// contains filtered or unexported fields
}
StatsHolder holds and refreshes the statistics.
func (*StatsHolder) Err ¶
func (sh *StatsHolder) Err() <-chan error
Err returns a read-only channel which may be filled with errors came from the refresh stats operation.
func (*StatsHolder) GetStats ¶
func (sh *StatsHolder) GetStats() Stats
GetStats returns a copy of the latest stats available.
func (*StatsHolder) Stop ¶
func (sh *StatsHolder) Stop()
Stop terminates the routine retrieves the stats. Note that no other monitor can be initialized after Stop.