Documentation

Overview

Package metrics provides both a means of generating metrics and the ability to send metric data to a graphite endpoint. The usage of this package without providing a graphite_addr when calling NewBucket results in NOP metric objects. No data will be collected.

Index

Constants

const (
	// RuntimeMemStatsSampleInterval is the interval in seconds at which the
	// Go runtime's memory statistics will be gathered.
	RuntimeMemStatsSampleInterval = time.Duration(2) * time.Second

	// GraphitePublishInterval is the interval in seconds at which all
	// gathered statistics will be published to a Graphite endpoint.
	GraphitePublishInterval = time.Duration(2) * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

type Bucket interface {
	// If a timer exists in this Bucket, return it. Otherwise, create
	// a new timer with the given name and store it in this Bucket.
	// The returned object will fulfull the Timer interface.
	Timer(name string) Timer

	// This acts similarly to Timer, but with objects that fufill the
	// Gauge interface.
	Gauge(name string) Gauge

	// Write the current state of all Metrics in a human-readable format
	// to the provide io.Writer.
	Dump(io.Writer)

	// Instruct the Bucket to periodically push all metric data to the
	// provided graphite endpoint.
	Publish(string) error
}

func NewBucket

func NewBucket(name string) Bucket

Create a new Bucket object that periodically

type Gauge

type Gauge gometrics.Gauge

type Timer

type Timer gometrics.Timer