Documentation
¶
Overview ¶
Metricd is a system used to collect app-level metrics. The package includes a daemon, an accompanying client, which provide a mechanism for collection of the metrics. The aggregation and storage logic is encapsulated in a set of metricd plugins, found in the `plugins` package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
// Terminates the connection to metricd. The client is unusable after
// this call.
Close() error
// Reports a "gauge" metric. The timeseries will keep the provided value
// until the next call with the same name and the set of labels provides
// a new one.
Report(name string, labels LabelSet, value interface{}) error
// The provided value is going to be added to the current integral
// of all values reported for this timeseries. The result is
// aggregated into a float variable with the same name and a "_sum"
// suffix. Negative values and zeroes are allowed.
ReportSum(name string, labels LabelSet, value interface{}) error
// The reported values are recorded in a histogram over a set period.
ReportHistogram(name string, labels LabelSet, value interface{}) error
// Reports a value every interval. Calls valueGetter to fetch the latest
// value.
ReportPeriodic(name string, interval time.Duration, labels LabelSet,
valueGetter func() interface{}) (PeriodicReporter, error)
// Returns a timer instance, which can be used for reporting time
// length metrics.
Timer(name string, labels LabelSet) Timer
}
Client provides a mechanism to submit metrics to metricd. A metric is identified by a name and by a set of labels (string pairs), which are used as dimensions to aggregate across. Values can be ints, floats, doubles, or strings. Close has to be called every time the Client is about to be discarded.
func NewClient ¶
NewClient makes a real client that sends metrics to the specified metricd instance if a valid url is provided. If the addr == nil, this returns a client that does nothing and just drops values on the floor.
func NewClientWithAddrGetter ¶
NewClientWithAddrGetter returns a real client that calls addrGetter function to determine the URL address to connect (and reconnect) to.
func NopClientOnError ¶
type LabelSet ¶
type LabelSet map[string]interface{}
LabelSet represents a set of metric labels. Currently the supported value types are:
string - the label value will be indexed in the metric database Unindexed - the label value will not be indexed
type PeriodicReporter ¶
type PeriodicReporter interface {
// Permanently stops the periodic reporter
Stop()
}
type Timer ¶
type Timer interface {
// Starts a timer. Subsequent calls without calling `End()` or `Pause()`
// in between are ignored. If the timer was `Paused()` before, the time
// accumulation resumes from the point of that call.
Start() Timer
// Pauses the timer. Does nothing, unless the previous call was `Start()`.
// Otherwises temporarily pauses the time accumulation, until `Start()` is
// called again.
Pause()
// Stops the timer and submits to metricd the time difference between
// the current moment and the moment `Start()` was called for the first time.
// If `Start()` wasn't called after the previous `End()`, the invocation
// is ignored.
End() error
// Adds the label in incoming map to the LabelSet.
AddLabels(LabelSet)
}
Describes a timer metric, which allows measurement between two time points.
Directories
¶
| Path | Synopsis |
|---|---|
|
Metricd is a server, that receives application level metrics and routes those to the appropriate plugins for further processing.
|
Metricd is a server, that receives application level metrics and routes those to the appropriate plugins for further processing. |
|
Package pb is a generated protocol buffer package.
|
Package pb is a generated protocol buffer package. |
|
The plugins package contains metricd plugins.
|
The plugins package contains metricd plugins. |
|
influxdb
The influxdb metricd plugin.
|
The influxdb metricd plugin. |