Documentation ¶
Overview ¶
Package librato is a pure go client for publishing metrics to Librato.
The package publishes metrics asynchronously, at a regular interval. If the package is unable to log metrics (network issues, service outage, or the app being overloaded), it will drop metrics instead of degrading the application's performance. The package allows some control over this behavior by allowing the developer the option of configuring the queue size. Once this queue size is exceeded, messages will be dropped until the publisher catches up.
The package also provides an Aggregator struct which can be used to aggregate the gauge measurements on the client. For applications that need to log a substantial number of metrics, this will be preferable to publishing the individual metrics.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aggregate ¶
type Aggregate struct { // Each metric has a name that is unique to its class of metrics e.g. a gauge name must be unique among gauges. The name // identifies a metric in subsequent API calls to store/query individual measurements and can be up to 255 characters in // length. Valid characters for metric names are A-Za-z0-9.:-_. The metric namespace is case insensitive. Name string `json:"name"` // Source is an optional property that can be used to subdivide a common gauge/counter among multiple members of a population. // For example the number of requests/second serviced by an application could be broken up among a group of server instances in // a scale-out tier by setting the hostname as the value of source. Source string `json:"source,omitempty"` // The epoch time at which an individual measurement occurred with a maximum resolution of seconds. MeasureTime int64 `json:"measure_time,omitempty"` // contains filtered or unexported fields }
Aggregate provides a means for aggregating metrics on the client side, and pushing the the calculated value to librato.
func (*Aggregate) Add ¶
Add a new value to the aggregate The method returns itself to allow chaining
func (Aggregate) SumSquares ¶
SumSquares is used to determine the standard deviation for the published measurements.
type Gauge ¶
type Gauge struct { // Each metric has a name that is unique to its class of metrics e.g. a gauge name must be unique among gauges. The name // identifies a metric in subsequent API calls to store/query individual measurements and can be up to 255 characters in // length. Valid characters for metric names are A-Za-z0-9.:-_. The metric namespace is case insensitive. Name string `json:"name"` // The numeric value of an individual measurement. Multiple formats are supported (e.g. integer, floating point, etc) but the value must be numeric. Value interface{} `json:"value"` // Source is an optional property that can be used to subdivide a common gauge/counter among multiple members of a population. // For example the number of requests/second serviced by an application could be broken up among a group of server instances in // a scale-out tier by setting the hostname as the value of source. Source string `json:"source,omitempty"` // The epoch time at which an individual measurement occurred with a maximum resolution of seconds. MeasureTime int64 `json:"measure_time,omitempty"` // The following fields are used to publish aggregations // They are public to allow serialization, but should not be used directly. Count int `json:"count,omitempty"` Sum interface{} `json:"sum,omitempty"` Min interface{} `json:"min,omitempty"` Max interface{} `json:"max,omitempty"` SumSquares interface{} `json:"sum_squares,omitempty"` }
type Librato ¶
type Librato struct {
// contains filtered or unexported fields
}
func New ¶
New creates a new librato client. The client will harvest metrics and publish them every second. You can specify the QueueSize to control how many metrics the client will batch. If you exceed the queue size, the measures will be silently dropped.
func (*Librato) AddCounter ¶
Adds a Counter measurement to librato. If the queue is full, the measure will be dropped, but an error will be published to the error channel if it was configured.