metrics

package
v0.0.0-...-f2a95d0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 8, 2015 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package metrics provides an extensible framework to instrument your application. All metrics are safe for concurrent use. Considerable design influence has been taken from https://github.com/codahale/metrics and https://prometheus.io.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Counter

type Counter interface {
	With(Field) Counter
	Add(delta uint64)
}

Counter is a monotonically-increasing, unsigned, 64-bit integer used to capture the number of times an event has occurred. By tracking the deltas between measurements of a counter over intervals of time, an aggregation layer can derive rates, acceleration, etc.

func NewMultiCounter

func NewMultiCounter(counters ...Counter) Counter

NewMultiCounter returns a wrapper around multiple Counters.

type Field

type Field struct {
	Key   string
	Value string
}

Field is a key/value pair associated with an observation for a specific metric. Fields may be ignored by implementations.

type Gauge

type Gauge interface {
	With(Field) Gauge
	Set(value int64)
	Add(delta int64)
}

Gauge captures instantaneous measurements of something using signed, 64-bit integers. The value does not need to be monotonic.

func NewMultiGauge

func NewMultiGauge(gauges ...Gauge) Gauge

NewMultiGauge returns a wrapper around multiple Gauges.

type Histogram

type Histogram interface {
	With(Field) Histogram
	Observe(value int64)
}

Histogram tracks the distribution of a stream of values (e.g. the number of milliseconds it takes to handle requests). Implementations may choose to add gauges for values at meaningful quantiles.

func NewMultiHistogram

func NewMultiHistogram(histograms ...Histogram) Histogram

NewMultiHistogram returns a wrapper around multiple Histograms.

func NewScaledHistogram

func NewScaledHistogram(h Histogram, scale int64) Histogram

NewScaledHistogram returns a Histogram whose observed values are downscaled (divided) by scale.

type TimeHistogram

type TimeHistogram interface {
	With(Field) TimeHistogram
	Observe(time.Duration)
}

TimeHistogram is a convenience wrapper for a Histogram of time.Durations.

func NewTimeHistogram

func NewTimeHistogram(h Histogram, unit time.Duration) TimeHistogram

NewTimeHistogram returns a TimeHistogram wrapper around the passed Histogram, in units of unit.

Directories

Path Synopsis
Package expvar implements an expvar backend for package metrics.
Package expvar implements an expvar backend for package metrics.
Package prometheus implements a Prometheus backend for package metrics.
Package prometheus implements a Prometheus backend for package metrics.
Package statsd implements a statsd backend for package metrics.
Package statsd implements a statsd backend for package metrics.
Package teststat contains helper functions for statistical testing of metrics implementations.
Package teststat contains helper functions for statistical testing of metrics implementations.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL