metrics

package
v0.0.0-...-09de6dd Latest Latest
Warning

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

Go to latest
Published: May 26, 2016 License: MPL-2.0 Imports: 8 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

type Statter

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

Statter implements the statsd.Statter interface but appends the name of the host the process is running on and its PID to the end of every stat name

func NewStatter

func NewStatter(addr, prefix string) (Statter, error)

NewStatter returns a new statsd.Client wrapper

func (Statter) Close

func (s Statter) Close() error

Close wraps statsd.Client.Close

func (Statter) Dec

func (s Statter) Dec(n string, v int64, r float32) error

Dec wraps statsd.Client.Dec

func (Statter) Gauge

func (s Statter) Gauge(n string, v int64, r float32) error

Gauge wraps statsd.Client.Gauge

func (Statter) GaugeDelta

func (s Statter) GaugeDelta(n string, v int64, r float32) error

GaugeDelta wraps statsd.Client.GaugeDelta

func (Statter) Inc

func (s Statter) Inc(n string, v int64, r float32) error

Inc wraps statsd.Client.Inc

func (Statter) Raw

func (s Statter) Raw(n string, v string, r float32) error

Raw wraps statsd.Client.Raw

func (Statter) Set

func (s Statter) Set(n string, v string, r float32) error

Set wraps statsd.Client.Set

func (Statter) SetInt

func (s Statter) SetInt(n string, v int64, r float32) error

SetInt wraps statsd.Client.SetInt

func (Statter) SetPrefix

func (s Statter) SetPrefix(p string)

SetPrefix wraps statsd.Client.SetPrefix

func (Statter) Timing

func (s Statter) Timing(n string, v int64, r float32) error

Timing wraps statsd.Client.Timing

func (Statter) TimingDuration

func (s Statter) TimingDuration(n string, v time.Duration, r float32) error

TimingDuration wraps statsd.Client.TimingDuration

Jump to

Keyboard shortcuts

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