Documentation
¶
Index ¶
- type CPUInfo
- type Collector
- func (c *Collector) Latest() *Snapshot
- func (c *Collector) LatestJSON() []byte
- func (c *Collector) LatestJSONWithProcesses(ctx context.Context) []byte
- func (c *Collector) LatestWithProcesses(ctx context.Context) *Snapshot
- func (c *Collector) ReleaseProcesses()
- func (c *Collector) RequestProcesses()
- func (c *Collector) Start(ctx context.Context)
- func (c *Collector) Stop()
- func (c *Collector) Subscribe(id string) <-chan *Snapshot
- func (c *Collector) Unsubscribe(id string)
- type DiskIO
- type DiskInfo
- type Filesystem
- type LoadInfo
- type MemoryInfo
- type NetInterface
- type NetworkInfo
- type ProcessEntry
- type ProcessInfo
- type Snapshot
- type SystemInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector periodically gathers system data and broadcasts snapshots.
func (*Collector) LatestJSON ¶ added in v0.1.2
LatestJSON returns the pre-serialized JSON of the latest snapshot.
func (*Collector) LatestJSONWithProcesses ¶ added in v0.1.2
LatestJSONWithProcesses returns the latest snapshot JSON, hydrating process details on demand when the cached snapshot only contains the total count.
func (*Collector) LatestWithProcesses ¶ added in v0.1.2
LatestWithProcesses returns the most recent snapshot, hydrating process details on demand when the cached snapshot only contains the total count.
func (*Collector) ReleaseProcesses ¶ added in v0.1.2
func (c *Collector) ReleaseProcesses()
ReleaseProcesses decrements the process consumer counter.
func (*Collector) RequestProcesses ¶ added in v0.1.2
func (c *Collector) RequestProcesses()
RequestProcesses increments the process consumer counter. When the counter is >0, collectOnce will gather process data.
func (*Collector) Unsubscribe ¶
Unsubscribe removes a subscriber.
type DiskInfo ¶
type DiskInfo struct {
Filesystems []Filesystem `json:"filesystems"`
IO []DiskIO `json:"io"`
}
type Filesystem ¶
type MemoryInfo ¶
type NetInterface ¶
type NetInterface struct {
Name string `json:"name"`
DownloadSec uint64 `json:"download_sec"`
UploadSec uint64 `json:"upload_sec"`
IPv4 string `json:"ipv4,omitempty"`
RxBytes uint64 `json:"rx_bytes,omitempty"`
TxBytes uint64 `json:"tx_bytes,omitempty"`
RxErrors uint64 `json:"rx_errors,omitempty"`
TxErrors uint64 `json:"tx_errors,omitempty"`
RxDrops uint64 `json:"rx_drops,omitempty"`
TxDrops uint64 `json:"tx_drops,omitempty"`
}
type NetworkInfo ¶
type NetworkInfo struct {
TotalDownloadSec uint64 `json:"total_download_sec"`
TotalUploadSec uint64 `json:"total_upload_sec"`
TCPConns uint32 `json:"tcp_connections"`
UDPConns uint32 `json:"udp_connections"`
Interfaces []NetInterface `json:"interfaces"`
}
type ProcessEntry ¶
type ProcessInfo ¶
type ProcessInfo struct {
Total int `json:"total"`
List []ProcessEntry `json:"list"`
}
type Snapshot ¶
type Snapshot struct {
Timestamp time.Time `json:"timestamp"`
System SystemInfo `json:"system"`
CPU CPUInfo `json:"cpu"`
Memory MemoryInfo `json:"memory"`
Disk DiskInfo `json:"disk"`
Network NetworkInfo `json:"network"`
Load LoadInfo `json:"load"`
Processes ProcessInfo `json:"processes"`
}
Snapshot represents a complete system state at a point in time.
func BuildSnapshot ¶
func BuildSnapshot( static vminfo.StaticInfo, stats vminfo.RuntimeStats, procs []vminfo.ProcessInfo, cpuHistory []float64, ) Snapshot
BuildSnapshot creates a Snapshot from existing vminfo package data.