Documentation ¶
Index ¶
- func CollectProcessMetrics()
- func CollectProcessStats(stats *ProcessStats) error
- func NewMAMeter() metrics.Meter
- func NewRegisteredMAMeter(name string, r metrics.Registry) metrics.Meter
- type MAMeterSnapshot
- func (m *MAMeterSnapshot) Count() int64
- func (*MAMeterSnapshot) Mark(n int64)
- func (m *MAMeterSnapshot) Rate1() float64
- func (m *MAMeterSnapshot) Rate15() float64
- func (m *MAMeterSnapshot) Rate5() float64
- func (m *MAMeterSnapshot) RateMean() float64
- func (m *MAMeterSnapshot) Snapshot() metrics.Meter
- func (m *MAMeterSnapshot) Stop()
- type ProcessStats
- type StandardMA
- type StandardMAMeter
- func (m *StandardMAMeter) Count() int64
- func (m *StandardMAMeter) Mark(n int64)
- func (m *StandardMAMeter) Rate1() float64
- func (m *StandardMAMeter) Rate15() float64
- func (m *StandardMAMeter) Rate5() float64
- func (m *StandardMAMeter) RateMean() float64
- func (m *StandardMAMeter) Snapshot() metrics.Meter
- func (m *StandardMAMeter) Stop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectProcessMetrics ¶
func CollectProcessMetrics()
func CollectProcessStats ¶
func CollectProcessStats(stats *ProcessStats) error
func NewMAMeter ¶
func NewMAMeter() metrics.Meter
NewMAMeter constructs a new StandardMAMeter and launches a goroutine. Be sure to call Stop() once the meter is of no use to allow for garbage collection.
func NewRegisteredMAMeter ¶
func NewRegisteredMAMeter(name string, r metrics.Registry) metrics.Meter
NewMeter constructs and registers a new StandardMeter and launches a goroutine. Be sure to unregister the meter from the registry once it is of no use to allow for garbage collection.
Types ¶
type MAMeterSnapshot ¶
type MAMeterSnapshot struct {
// contains filtered or unexported fields
}
MAMeterSnapshot is a read-only copy of another Meter.
func (*MAMeterSnapshot) Count ¶
func (m *MAMeterSnapshot) Count() int64
Count returns the count of events at the time the snapshot was taken.
func (*MAMeterSnapshot) Rate1 ¶
func (m *MAMeterSnapshot) Rate1() float64
Rate1 returns the one-minute moving average rate of events per second at the time the snapshot was taken.
func (*MAMeterSnapshot) Rate15 ¶
func (m *MAMeterSnapshot) Rate15() float64
Rate15 returns the fifteen-minute moving average rate of events per second at the time the snapshot was taken.
func (*MAMeterSnapshot) Rate5 ¶
func (m *MAMeterSnapshot) Rate5() float64
Rate5 returns the five-minute moving average rate of events per second at the time the snapshot was taken.
func (*MAMeterSnapshot) RateMean ¶
func (m *MAMeterSnapshot) RateMean() float64
RateMean returns the meter's mean rate of events per second at the time the snapshot was taken.
func (*MAMeterSnapshot) Snapshot ¶
func (m *MAMeterSnapshot) Snapshot() metrics.Meter
Snapshot returns the snapshot.
type ProcessStats ¶
type ProcessStats struct { CpuUserTime int64 // Cpu use time(/proc/[pid]/stat utime) CpuSystemTime int64 // Cpu use time(/proc/[pid]/stat stime) CurrentTime int64 // Current time VirtualMem int64 // Virtual memory size RssMem int64 // Resident memory size DiskReadCount int64 // Number of read operations executed DiskReadBytes int64 // Total number of bytes read DiskWriteCount int64 // Number of write operations executed DiskWriteBytes int64 // Total number of byte written }
type StandardMA ¶
type StandardMA struct {
// contains filtered or unexported fields
}
StandardMA is the standard implementation of an MA and tracks the number of uncounted events and processes them on each tick. It uses the sync/atomic package to manage uncounted events.
func NewMA1 ¶
func NewMA1() *StandardMA
func NewMA15 ¶
func NewMA15() *StandardMA
func NewMA5 ¶
func NewMA5() *StandardMA
func (*StandardMA) Rate ¶
func (a *StandardMA) Rate() float64
Rate returns the moving average rate of events per second.
func (*StandardMA) Tick ¶
func (a *StandardMA) Tick()
Tick ticks the clock to update the moving average. It assumes it is called every five seconds.
type StandardMAMeter ¶
type StandardMAMeter struct {
// contains filtered or unexported fields
}
StandardMaMeter is the standard ma implementation of a Meter.
func (*StandardMAMeter) Count ¶
func (m *StandardMAMeter) Count() int64
Count returns the number of events recorded.
func (*StandardMAMeter) Mark ¶
func (m *StandardMAMeter) Mark(n int64)
Mark records the occurance of n events.
func (*StandardMAMeter) Rate1 ¶
func (m *StandardMAMeter) Rate1() float64
Rate1 returns the one-minute moving average rate of events per second.
func (*StandardMAMeter) Rate15 ¶
func (m *StandardMAMeter) Rate15() float64
Rate15 returns the fifteen-minute moving average rate of events per second.
func (*StandardMAMeter) Rate5 ¶
func (m *StandardMAMeter) Rate5() float64
Rate5 returns the five-minute moving average rate of events per second.
func (*StandardMAMeter) RateMean ¶
func (m *StandardMAMeter) RateMean() float64
RateMean returns the meter's mean rate of events per second.
func (*StandardMAMeter) Snapshot ¶
func (m *StandardMAMeter) Snapshot() metrics.Meter
Snapshot returns a read-only copy of the meter.
func (*StandardMAMeter) Stop ¶
func (m *StandardMAMeter) Stop()
Stop stops the meter, Mark() will be a no-op if you use it after being stopped.