metrics

package
v0.0.0-...-8237a13 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2016 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FBAdapter

type FBAdapter struct {
	// contains filtered or unexported fields
}

FBAdapter provides a facebookgo/stats client interface that sends metrics via a StatsD client

func NewFBAdapter

func NewFBAdapter(stats statsd.Statter, prefix string, clock clock.Clock) FBAdapter

NewFBAdapter returns a new adapter

func (FBAdapter) BumpAvg

func (fba FBAdapter) BumpAvg(key string, val float64)

BumpAvg is essentially statsd.Statter.Gauge

func (FBAdapter) BumpHistogram

func (fba FBAdapter) BumpHistogram(_ string, _ float64)

BumpHistogram isn't used by facebookgo/httpdown

func (FBAdapter) BumpSum

func (fba FBAdapter) BumpSum(key string, val float64)

BumpSum is essentially statsd.Statter.Inc (httpdown only ever uses positive deltas)

func (FBAdapter) BumpTime

func (fba FBAdapter) BumpTime(key string) interface {
	End()
}

BumpTime is essentially a (much better) statsd.Statter.TimingDuration

type HTTPMonitor

type HTTPMonitor struct {
	// contains filtered or unexported fields
}

HTTPMonitor stores some server state

func NewHTTPMonitor

func NewHTTPMonitor(stats statsd.Statter, handler http.Handler, prefix string) *HTTPMonitor

NewHTTPMonitor returns a new initialized HTTPMonitor

func (*HTTPMonitor) ServeHTTP

func (h *HTTPMonitor) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Scope

type Scope interface {
	NewScope(scopes ...string) Scope
	Scope() string

	Inc(stat string, value int64) error
	Dec(stat string, value int64) error
	Gauge(stat string, value int64) error
	GaugeDelta(stat string, value int64) error
	Timing(stat string, delta int64) error
	TimingDuration(stat string, delta time.Duration) error
	Set(stat string, value string) error
	SetInt(stat string, value int64) error
	Raw(stat string, value string) error
}

Scope is a stats collector that will prefix the name the stats it collects.

func NewNoopScope

func NewNoopScope() Scope

NewNoopScope returns a Scope that won't collect anything

type StatsdScope

type StatsdScope struct {
	// contains filtered or unexported fields
}

StatsdScope is a Scope that sends data to statsd with a prefix added to the stat names.

func NewStatsdScope

func NewStatsdScope(statter statsd.Statter, scopes ...string) *StatsdScope

NewStatsdScope returns a StatsdScope that prefixes stats it collections with the scopes given joined together by periods

func (*StatsdScope) Dec

func (s *StatsdScope) Dec(stat string, value int64) error

Dec decrements the given stat and adds the Scope's prefix to the name

func (*StatsdScope) Gauge

func (s *StatsdScope) Gauge(stat string, value int64) error

Gauge sends a gauge stat and adds the Scope's prefix to the name

func (*StatsdScope) GaugeDelta

func (s *StatsdScope) GaugeDelta(stat string, value int64) error

GaugeDelta sends the change in a gauge stat and adds the Scope's prefix to the name

func (*StatsdScope) Inc

func (s *StatsdScope) Inc(stat string, value int64) error

Inc increments the given stat and adds the Scope's prefix to the name

func (*StatsdScope) NewScope

func (s *StatsdScope) NewScope(scopes ...string) Scope

NewScope generates a new Scope prefixed by this Scope's prefix plus the prefixes given joined by periods

func (*StatsdScope) Raw

func (s *StatsdScope) Raw(stat string, value string) error

Raw sends a stat value without interpretation and adds the Scope's prefix to the name

func (*StatsdScope) Scope

func (s *StatsdScope) Scope() string

Scope returns the current string prefix (except for the final period) that stats will receive

func (*StatsdScope) Set

func (s *StatsdScope) Set(stat string, value string) error

Set sets a stat's new value and adds the Scope's prefix to the name

func (*StatsdScope) SetInt

func (s *StatsdScope) SetInt(stat string, value int64) error

SetInt sets a stat's integer value and adds the Scope's prefix to the name

func (*StatsdScope) Timing

func (s *StatsdScope) Timing(stat string, delta int64) error

Timing sends a latency stat and adds the Scope's prefix to the name

func (*StatsdScope) TimingDuration

func (s *StatsdScope) TimingDuration(stat string, delta time.Duration) error

TimingDuration sends a latency stat as a time.Duration and adds the Scope's prefix to the name

Jump to

Keyboard shortcuts

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