Package metrics provides a simple API for sending value and counter metrics through the dropsonde system.
See the documentation for package dropsonde for configuration details.
Importing package dropsonde and initializing will initial this package. To send metrics use
metrics.SendValue(name, value, unit)
for sending known quantities, and
to increment a counter. (Note that the value of the counter is maintained by the receiver of the counter events, not the application that includes this package.)
- func AddToCounter(name string, delta uint64) error
- func BatchAddCounter(name string, delta uint64)
- func BatchIncrementCounter(name string)
- func Close()
- func IncrementCounter(name string) error
- func Initialize(ms metric_sender.MetricSender, mb MetricBatcher)
- func SendContainerMetric(applicationId string, instanceIndex int32, cpuPercentage float64, ...) error
- func SendValue(name string, value float64, unit string) error
- type MetricBatcher
This section is empty.
This section is empty.
func AddToCounter ¶
AddToCounter sends an event to increment the named counter by the specified (positive) delta. Maintaining the value of the counter is the responsibility of the receiver, as with IncrementCounter.
func BatchAddCounter ¶
BatchAddCounter adds delta to a counter but, unlike AddCounter, does not emit a CounterEvent for each add; instead, the adds are batched and a single CounterEvent is sent after the timeout.
func BatchIncrementCounter ¶
func BatchIncrementCounter(name string)
BatchIncrementCounter increments a counter but, unlike IncrementCounter, does not emit a CounterEvent for each increment; instead, the increments are batched and a single CounterEvent is sent after the timeout.
func IncrementCounter ¶
IncrementCounter sends an event to increment the named counter by one. Maintaining the value of the counter is the responsibility of the receiver of the event, not the process that includes this package.
func Initialize ¶
Initialize prepares the metrics package for use with the automatic Emitter.
func SendContainerMetric ¶
SendContainerMetric sends a metric that records resource usage of an app in a container. The container is identified by the applicationId and the instanceIndex. The resource metrics are CPU percentage, memory and disk usage in bytes. Returns an error if one occurs when sending the metric.