Documentation
¶
Index ¶
Constants ¶
View Source
const ( // SmallestAccpetableInterval is the smallest interval at which a // periodic stat can be generated SmallestAccpetableInterval time.Duration = 400 * time.Millisecond )
Variables ¶
This section is empty.
Functions ¶
func SubscribeToEvents ¶
func SubscribeToEvents() (ret events.EventSubscription, err error)
Types ¶
type DiskConfig ¶
type DiskConfig struct {
// IgnorePartitions - any named partition in this list will be ignored.
// Example would be: "/tmpfs"
IgnorePartitions []string `yaml:"ignore_partitions"`
// IgnorePartitionsRegex - any partition name matching this regex will be ignored
// Example would be: "\/snap\/.*" would ignore all /snap related paths
IgnorePartitionsRegex []string `yaml:"ignore_partitions_regex"`
// WhiteListPartitions while not empty will be the only partitions
// the disk stat will gather statistics on.
WhiteListPartitions []string `yaml:"white_list_partitions"`
// IgnoreMountpoints - any named partition in this list will be ignored.
// Example would be: "/var/lib/docker/aufs"
IgnoreMountpoints []string `yaml:"ignore_mountpoints"`
// IgnoreMountpointsRegex - any mountpoint name matching this regex will be ignored
// Example would be: "/var/lib/docker\/.*" would ignore /var/lib/docker/aufs
IgnoreMountpointsRegex []string `yaml:"ignore_mountpoints_regex"`
// WhiteListPartitions while not empty will be the only partitions
// the disk stat will gather statistics on.
// Example "/"
WhiteListMountpoints []string `yaml:"white_list_mountpoints"`
// contains filtered or unexported fields
}
func (*DiskConfig) GetPace ¶
func (stat *DiskConfig) GetPace() int64
func (*DiskConfig) RunStat ¶
func (stat *DiskConfig) RunStat(ctx context.Context, configChanged bool) (ret *StatPayload, err error)
type RunnableStat ¶
type RunnableStat interface {
// RunStat get the latest stat for this stat. The returned interface{}
// should be a json encodable
RunStat(ctx context.Context, configChanged bool) (*StatPayload, error)
GetPace() int64
}
RunnableStat is a way for us to generically run the stats
type StatPayload ¶
type StatPayload struct {
Name string
StatData interface{}
}
StatPayload carries the stat along with a 'name'
func (*StatPayload) MarshalJSON ¶
func (pl *StatPayload) MarshalJSON() (ret []byte, err error)
MarshalJSON for StatPayload Proper format is: "{<Name>": { <JSON STAT DATA> }}
type StatsConfig ¶
type StatsConfig struct {
// loopInterval int64 `yaml:"loop_interval" json:"loop_interval"`
VMStats *VMConfig `yaml:"vm_stats" json:"vm_stats"`
DiskStats *DiskConfig `yaml:"disk_stats" json:"disk_stats"`
}
StatsConfig is used to configure the sysstats (system stats) subsystem
type SysStats ¶
type SysStats struct {
// contains filtered or unexported fields
}
func GetManager ¶
func GetManager() *SysStats
GetManager returns the singleton manager for Sysstats subsystem
func (*SysStats) OneTimeRun ¶
func (mgr *SysStats) OneTimeRun(name string) (stat *StatPayload, err error)
tell manager to get a single stat by name, one time. This will block until the stat is returned. No event will be generated
func (*SysStats) ReadConfig ¶
func (mgr *SysStats) ReadConfig(config *StatsConfig) (ok bool, err error)
Click to show internal directories.
Click to hide internal directories.