Documentation
¶
Overview ¶
Package metrics provides a unified interface for different metrics backends (prometheus etc.).
Index ¶
- Variables
- func Active() bool
- func CtxGetScope(ctx context.Context) string
- func CtxScope(ctx context.Context, scope string) context.Context
- func CtxSubScope(ctx context.Context, subscope string) context.Context
- func InjectImpl(newimpl InternalNew) error
- type Counter
- type CounterVec
- type Creator
- type Gauge
- type Histogram
- type InternalNew
- type Summary
- type SummaryOpts
Constants ¶
This section is empty.
Variables ¶
View Source
var CtxScopeKey = ctxScopeKey{}
View Source
var ErrImplemented = errors.New("there is implemenation already injected")
Functions ¶
func CtxGetScope ¶
func InjectImpl ¶
func InjectImpl(newimpl InternalNew) error
Types ¶
type Counter ¶
type Counter interface {
Inc()
Add(float64) // Only positive
}
Counter is a metric that can only be incremented.
type CounterVec ¶ added in v0.1.0
CounterVec is a counter with tags.
type Creator ¶
type Creator interface {
Counter() Counter
CounterVec(labelNames []string) CounterVec
Gauge() Gauge
Histogram(buckets []float64) Histogram
// opts cannot be nil, use empty summary instance
Summary(opts SummaryOpts) Summary
}
Creator can be used to create different types of metrics.
type Gauge ¶
type Gauge interface {
Set(float64) // Introduced discontinuity
Inc()
Dec()
Add(float64)
Sub(float64)
}
Gauge is a metric that can be increased and decreased.
type Histogram ¶
type Histogram interface {
Observe(float64) // Adds observation to Histogram
}
Histogram metric.
type InternalNew ¶
type SummaryOpts ¶
type SummaryOpts struct {
Objectives map[float64]float64
MaxAge time.Duration
AgeBuckets uint32
BufCap uint32
}
SummaryOpts allow specifying options for Summary. See: http://godoc.org/github.com/prometheus/client_golang/prometheus#SummaryOpts .
Click to show internal directories.
Click to hide internal directories.