metrics

package
v0.0.0-...-ce94876 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2019 License: MIT, MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const CtxScopeKey = "ipfs.metrics.scope"

Variables

View Source
var ErrImplemented = errors.New("there is implemenation already injected")

Functions

func Active

func Active() bool

func CtxGetScope

func CtxGetScope(ctx context.Context) string

func CtxScope

func CtxScope(ctx context.Context, scope string) context.Context

func CtxSubScope

func CtxSubScope(ctx context.Context, subscope string) context.Context

func InjectImpl

func InjectImpl(newimpl InternalNew) error

Types

type Counter

type Counter interface {
	Inc()
	Add(float64) // Only positive
}

Increment only metric

type Creator

type Creator interface {
	Counter() Counter
	Gauge() Gauge
	Histogram(buckets []float64) Histogram

	// opts cannot be nil, use empty summary instance
	Summary(opts SummaryOpts) Summary
}

func New

func New(name, helptext string) Creator

name is dot spearated path must be uniqe, use system naming, and unit postfix, examples:

ipfs.blockstore.bloomcache.bloom.miss.total
ipfs.routing.dht.notresuingstream.total

both arguemnts are obligatory

func NewCtx

func NewCtx(ctx context.Context, name, helptext string) Creator

type Gauge

type Gauge interface {
	Set(float64) // Introduced discontinuity
	Inc()
	Dec()
	Add(float64)
	Sub(float64)
}

Increse and decrese metric

type Histogram

type Histogram interface {
	Observe(float64) // Adds observation to Histogram
}

type InternalNew

type InternalNew func(string, string) Creator

type Summary

type Summary interface {
	Observe(float64) // Adds observation to Summary
}

type SummaryOpts

type SummaryOpts struct {
	Objectives map[float64]float64
	MaxAge     time.Duration
	AgeBuckets uint32
	BufCap     uint32
}

Consult http://godoc.org/github.com/prometheus/client_golang/prometheus#SummaryOpts

Jump to

Keyboard shortcuts

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