Documentation ¶
Overview ¶
Package gomon adds functionality to aggregate and batch groups of metrics for delivery to AWS Cloudwatch.
Index ¶
- Constants
- Variables
- func AddDimension(name, value string)
- func DeltaSinceLastCall(getter func() float64) (generator func() float64)
- func MbFreeAtMount(mountpoint string) int
- func MemoryFree() float64
- func Register(name string, interval time.Duration, unit string, floatEmitter func() float64)
- func RegisterDelta(name string, interval time.Duration, unit string, floatEmitter func() float64)
- func RegisterDeltaInt(name string, interval time.Duration, unit string, intEmitter func() int)
- func RegisterInt(name string, interval time.Duration, unit string, intEmitter func() int)
- func RootPartitionFree() float64
- func Start()
- type Aggregator
Constants ¶
const ShouldTransmitZero = true
If this is false, periods in which a given metric is always zero will not result in an API transmission. This will save money and bandwidth, but any alarms that depend on a quiescent system (such as a a scale-down event when a metric is low) might not fire, since the alarm will go into INSUFFICENT_DATA without any metrics.
Variables ¶
var Dimensions = []cloudwatch.Dimension{}
A set of AWS Dimensions that are added to all sent metrics.
var Namespace string
A common prefix for the metrics gathered by this app.
var Region = aws.USEast
The Cloudwatch region to use.
Functions ¶
func AddDimension ¶
func AddDimension(name, value string)
AddDimension adds a dimension to all delivered metrics. A good thing to use would be something like StackName or InstanceId.
func DeltaSinceLastCall ¶
DeltaSinceLastCall transforms a function returning a metric count into a function that returns the difference since the last time that function was called.
func MbFreeAtMount ¶
MbFreeAtMount parses `df -m` for the given mount and returns the MB free in that directory.
func MemoryFree ¶
func MemoryFree() float64
MemoryFree returns the number of MB reported as 'available' by the unix `free` command.
func RegisterDelta ¶
RegisterDelta wraps an emitter with DeltaSinceLastCall to turn it into a rate measurement instead of a point in time metric.
func RegisterDeltaInt ¶
RegisterDeltaInt is RegisterDelta for ints.
func RegisterInt ¶
RegisterInt is a convenience function that wraps int emitters with a float cast.
func RootPartitionFree ¶
func RootPartitionFree() float64
RootPartitionFree returns the space in MB available on '/'.
Types ¶
type Aggregator ¶
type Aggregator struct {
// contains filtered or unexported fields
}
An Aggregator takes a fast stream of data points and batches them into a slower stream of statistical descriptions of those points.
func (*Aggregator) StartLoop ¶
func (m *Aggregator) StartLoop()
StartLoop begins listening on the fast channel until one minute's worth of data is available, then sends the stats for that duration on the batch channel and repeats. If all metrics for the duration are zero, optionally discard the values.
func (*Aggregator) String ¶
func (a *Aggregator) String() string