Documentation ¶
Overview ¶
Package chpipeline manages collecting data for cloudhealth and other systems
Index ¶
- type AgedSnapshot
- type AgedSnapshotChannel
- type AgedSnapshotList
- type AgedSnapshotListChannel
- type CloudHealthInstanceCall
- type FsSnapshot
- type FsStats
- type InstanceStats
- type MaybeFloat64
- type MaybeUint64
- type RollUpStats
- func (r *RollUpStats) AccountNumber() string
- func (r *RollUpStats) Add(s *InstanceStats)
- func (r *RollUpStats) Clear()
- func (r *RollUpStats) InstanceId() string
- func (r *RollUpStats) Region() string
- func (r *RollUpStats) RoundDuration() time.Duration
- func (r *RollUpStats) TakeSnapshot() *Snapshot
- func (r *RollUpStats) TimeOk(t time.Time) bool
- type Snapshot
- type SnapshotStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgedSnapshot ¶
AgedSnapshot is a Snapshot that knows its age. When creating, set Ts to time.Now()
func (AgedSnapshot) Age ¶
func (a AgedSnapshot) Age() time.Duration
Age returns the age of the snapshot.
type AgedSnapshotChannel ¶
type AgedSnapshotChannel struct { Channel chan AgedSnapshot // contains filtered or unexported fields }
AgedSnapshotChannel is a channel of AgedSnapshot that keeps track of how many times the channel overflows.
func NewAgedSnapshotChannel ¶
func NewAgedSnapshotChannel(length int) *AgedSnapshotChannel
NewAgedSnapshotChannel creates an AgedSnapshotChannel with specified length.
func (*AgedSnapshotChannel) Overflows ¶
func (a *AgedSnapshotChannel) Overflows() uint64
Overflows returns the overflow count.
func (*AgedSnapshotChannel) Send ¶
func (a *AgedSnapshotChannel) Send(s AgedSnapshot)
Send sends the specified AgedSnapshot on the channel. If sending on the channel would block, Send returns immediately incrementing the overflow count.
type AgedSnapshotList ¶
AgeSnapshotList is a slice of snapshots with an age. When creating, set Ts to time.Now()
func (AgedSnapshotList) Age ¶
func (a AgedSnapshotList) Age() time.Duration
Age returns the age of this slice of snapshots.
type AgedSnapshotListChannel ¶
type AgedSnapshotListChannel struct { Channel chan AgedSnapshotList // contains filtered or unexported fields }
AgedSnapshotListChannel is a channel of AgedSnapshotList that keeps track of how many times the channel overflows.
func NewAgedSnapshotListChannel ¶
func NewAgedSnapshotListChannel(length int) *AgedSnapshotListChannel
NewAgedSnapshotListChannel creates an AgedSnapshotListChannel with specified length.
func (*AgedSnapshotListChannel) Overflows ¶
func (a *AgedSnapshotListChannel) Overflows() uint64
Overflows returns the overflow count.
func (*AgedSnapshotListChannel) Send ¶
func (a *AgedSnapshotListChannel) Send(s AgedSnapshotList)
Send sends the specified AgedSnapshotList on the channel. If sending on the channel would block, Send returns immediately incrementing the overflow count.
type CloudHealthInstanceCall ¶
type CloudHealthInstanceCall struct { Instance cloudhealth.InstanceData // The instance data to write Fss []cloudhealth.FsData // Data for each file system in instance }
CloudHealthInstanceCall represents a call to write cloudhealth data for one instance.
func NewCloudHealthInstanceCall ¶
func NewCloudHealthInstanceCall(s *Snapshot) CloudHealthInstanceCall
NewCloudHealthInstanceCall creates a new CloudHealthInstanceCall from a Snapshot.
func (CloudHealthInstanceCall) Split ¶
func (c CloudHealthInstanceCall) Split() ( CloudHealthInstanceCall, [][]cloudhealth.FsData)
Split splits this call into smaller calls that are below the maximum size for writing to cloudhealth. If c is small enough, then split returns c, nil. If c is too big, Split returns a version of c that is small enough plus additional groups of file system data. In this case, caller must write each additional group of file system data separately.
type FsSnapshot ¶
type FsSnapshot struct { MountPoint string Size cloudhealth.IVariable Used cloudhealth.IVariable UsedPercent cloudhealth.FVariable }
FsSnaapshot depicts a snapshot of a file system
type FsStats ¶
type FsStats struct { MountPoint string Size MaybeUint64 Free MaybeUint64 }
FsStats contains stats for a particular file system for some point in time
func CombineFsStats ¶
CombineFsStats returns a collection of FsStats as a single FsStats with mount point of '/'. The returned instance contains the combined size and free space of all file systems. When combining, CombineFsStats ignores any FsStats instance with missing data.
func (*FsStats) UsedPercent ¶
UsedPercent returns the percentage of the file system that is used. UsedPercent returns false if the size of the file system is zero or if needed information is missing.
type InstanceStats ¶
type InstanceStats struct { Ts time.Time // Timestamp of statistics. UserTimeFraction MaybeFloat64 MemoryFree MaybeUint64 MemoryTotal MaybeUint64 Fss []FsStats }
InstanceStats contains cloudhealth statistics for an aws instance at some point in time
func GetStats ¶
func GetStats(list metrics.List) InstanceStats
GetStats reads cloudhealth statistics from a group of collected metrics for some instance.
func (*InstanceStats) CPUUsedPercent ¶
func (s *InstanceStats) CPUUsedPercent() (float64, bool)
CPUUsedPercent returns CPU usage between 0.0 and 100.0. Returns false if needed information is missing.
func (*InstanceStats) ClearNonMemory ¶
func (s *InstanceStats) ClearNonMemory()
ClearNonMemory clears the non memory related stats in place.
func (*InstanceStats) CombineFsStats ¶
func (s *InstanceStats) CombineFsStats()
CombineFsStats combines the file system stats of this instance in place using the CombineFsStats() function.
func (*InstanceStats) MemoryUsedPercent ¶
func (s *InstanceStats) MemoryUsedPercent() (float64, bool)
MemoryUsedPercent returns the percentage of memory used. MemoryUsedPercent returns false if total memory is 0 or if needed information is missing.
func (InstanceStats) WithCombinedFsStats ¶
func (s InstanceStats) WithCombinedFsStats() InstanceStats
WithCombinedFsStats returns an instance like this one but with the file system stats combined using the CombineFsStats() function.
type MaybeFloat64 ¶
MaybeFloat64 values are either nothing or a float64.
type MaybeUint64 ¶
MaybeUint64 values are either nothing or a uint64.
type RollUpStats ¶
type RollUpStats struct {
// contains filtered or unexported fields
}
RollUpStats represents rolled up statistics for a machine by some time period.
func NewRollUpStats ¶
func NewRollUpStats( accountNumber string, instanceId string, region string, roundDuration time.Duration) *RollUpStats
NewRollUpStats creates a new RollUpStats for given accountNumber and instanceId that rolls up data every roundDuration. Hint: to do hourly rollups, pass time.Hour for roundDuration.
func (*RollUpStats) AccountNumber ¶
func (r *RollUpStats) AccountNumber() string
func (*RollUpStats) Add ¶
func (r *RollUpStats) Add(s *InstanceStats)
Add adds s to this instance. Add panics if the timestamp for s is not for the same time period as times already in this instance.
func (*RollUpStats) Clear ¶
func (r *RollUpStats) Clear()
Clear clears this instance After clear is called, Add will accept data with any timestamp.
func (*RollUpStats) InstanceId ¶
func (r *RollUpStats) InstanceId() string
func (*RollUpStats) Region ¶
func (r *RollUpStats) Region() string
func (*RollUpStats) RoundDuration ¶
func (r *RollUpStats) RoundDuration() time.Duration
func (*RollUpStats) TakeSnapshot ¶
func (r *RollUpStats) TakeSnapshot() *Snapshot
TakeSnapshot grabs a snapshot of this instance
type Snapshot ¶
type Snapshot struct { AccountNumber string InstanceId string Region string Ts time.Time CpuUsedPercent cloudhealth.FVariable MemoryFreeBytes cloudhealth.IVariable MemorySizeBytes cloudhealth.IVariable MemoryUsedPercent cloudhealth.FVariable Fss []FsSnapshot }
Snapshot represents a snapshot of a RollUpStats instance. Snapshot instances should be treated as immutable.
type SnapshotStore ¶
type SnapshotStore struct {
// contains filtered or unexported fields
}
SnapshotStore stores snapshots from least to most recent. SnapshotStore evicts snapshots with older timestamps automatically as new snapshots are added. SnapshotStore instances also know how to persist themselves to the local file system.
func NewSnapshotStore ¶
func NewSnapshotStore( dirPath string, hostName string, appName string, span time.Duration) *SnapshotStore
NewSnapshotStore creates a new SnapshotStore instance. dirPath is the full path of the directory where the new instance will store its data. Mutliple instances at once may store their data within the same directory. hostName and port are the hostname and port of the endpoint for which the new instance will store snapshots. span controls how long snapshots stay in newly created instance. The difference between the oldest and newest snapshot will never exceed span.
func (*SnapshotStore) Add ¶
func (s *SnapshotStore) Add(snapshot *Snapshot)
Add adds a new snapshot to this instance
func (*SnapshotStore) AppName ¶
func (s *SnapshotStore) AppName() string
func (*SnapshotStore) GetAll ¶
func (s *SnapshotStore) GetAll() []*Snapshot
GetAll retrieves all the snapshots in this instance from oldest to newest.
func (*SnapshotStore) HostName ¶
func (s *SnapshotStore) HostName() string
func (*SnapshotStore) Load ¶
func (s *SnapshotStore) Load() error
Load loads this instance's data from the file system into this instance.
func (*SnapshotStore) Save ¶
func (s *SnapshotStore) Save() error
Save saves this instance's data to the file system