Documentation ¶
Index ¶
- Variables
- func Close(ctx context.Context) error
- func Dec(ctx context.Context, name string, value int64, rate float32, ...) error
- func Gauge(ctx context.Context, name string, value float64, rate float32, ...) error
- func Inc(ctx context.Context, name string, value int64, rate float32, ...) error
- func Runtime(stats Stats)
- func RuntimeEvery(stats Stats, t time.Duration)
- func RuntimeFromContext(ctx context.Context, t time.Duration)
- func Timing(ctx context.Context, name string, value time.Duration, rate float32, ...) error
- func WithStats(ctx context.Context, stats Stats) context.Context
- type BufferedStatsd
- func (s *BufferedStatsd) Close() error
- func (s *BufferedStatsd) Dec(name string, value int64, rate float32, tags ...interface{}) error
- func (s *BufferedStatsd) Gauge(name string, value float64, rate float32, tags ...interface{}) error
- func (s *BufferedStatsd) Inc(name string, value int64, rate float32, tags ...interface{}) error
- func (s *BufferedStatsd) Timing(name string, value time.Duration, rate float32, tags ...interface{}) error
- type BufferedStatsdFunc
- type L2met
- func (s *L2met) Close() error
- func (s *L2met) Dec(name string, value int64, rate float32, tags ...interface{}) error
- func (s *L2met) Gauge(name string, value float64, rate float32, tags ...interface{}) error
- func (s *L2met) Inc(name string, value int64, rate float32, tags ...interface{}) error
- func (s *L2met) Timing(name string, value time.Duration, rate float32, tags ...interface{}) error
- type Prometheus
- func (s *Prometheus) Close() error
- func (s *Prometheus) Dec(name string, value int64, rate float32, tags ...interface{}) error
- func (s *Prometheus) Gauge(name string, value float64, rate float32, tags ...interface{}) error
- func (s *Prometheus) Handler() http.Handler
- func (s *Prometheus) Inc(name string, value int64, rate float32, tags ...interface{}) error
- func (s *Prometheus) Timing(name string, value time.Duration, rate float32, tags ...interface{}) error
- type Stats
- type Statsd
- func (s *Statsd) Close() error
- func (s *Statsd) Dec(name string, value int64, rate float32, tags ...interface{}) error
- func (s *Statsd) Gauge(name string, value float64, rate float32, tags ...interface{}) error
- func (s *Statsd) Inc(name string, value int64, rate float32, tags ...interface{}) error
- func (s *Statsd) Timing(name string, value time.Duration, rate float32, tags ...interface{}) error
- type TaggedStats
- func (s TaggedStats) Close() error
- func (s TaggedStats) Dec(name string, value int64, rate float32, tags ...interface{}) error
- func (s TaggedStats) Gauge(name string, value float64, rate float32, tags ...interface{}) error
- func (s TaggedStats) Inc(name string, value int64, rate float32, tags ...interface{}) error
- func (s TaggedStats) Timing(name string, value time.Duration, rate float32, tags ...interface{}) error
- type Tags
- type Timer
Constants ¶
This section is empty.
Variables ¶
var DefaultRuntimeInterval = 30 * time.Second
DefaultRuntimeInterval is the default runtime ticker interval.
var (
// Null is the null Stats instance.
Null = &nullStats{}
)
Functions ¶
func Gauge ¶
func Gauge(ctx context.Context, name string, value float64, rate float32, tags ...interface{}) error
Gauge measures the value of a metric.
func Runtime ¶
func Runtime(stats Stats)
Runtime enters a loop, reporting runtime stats periodically.
func RuntimeEvery ¶
RuntimeEvery enters a loop, reporting runtime stats at the specified interval.
func RuntimeFromContext ¶
RuntimeFromContext is the same as RuntimeEvery but from context.
Types ¶
type BufferedStatsd ¶
type BufferedStatsd struct {
// contains filtered or unexported fields
}
BufferedStatsd represents a buffered statsd client.
func NewBufferedStatsd ¶
func NewBufferedStatsd(addr, prefix string, opts ...BufferedStatsdFunc) (*BufferedStatsd, error)
NewBufferedStatsd create a buffered Statsd instance.
func (*BufferedStatsd) Close ¶
func (s *BufferedStatsd) Close() error
Close closes the client and flushes buffered stats, if applicable
func (*BufferedStatsd) Dec ¶
func (s *BufferedStatsd) Dec(name string, value int64, rate float32, tags ...interface{}) error
Dec decrements a count by the value.
func (*BufferedStatsd) Gauge ¶
func (s *BufferedStatsd) Gauge(name string, value float64, rate float32, tags ...interface{}) error
Gauge measures the value of a metric.
type BufferedStatsdFunc ¶
type BufferedStatsdFunc func(*BufferedStatsd)
BufferedStatsdFunc represents an configuration function for BufferedStatsd.
func WithFlushBytes ¶
func WithFlushBytes(bytes int) BufferedStatsdFunc
WithFlushBytes sets the maximum udp packet size that will be sent. Defaults to 1432 flushBytes.
func WithFlushInterval ¶
func WithFlushInterval(interval time.Duration) BufferedStatsdFunc
WithFlushInterval sets the maximum flushInterval for packet sending. Defaults to 300ms.
type L2met ¶
type L2met struct {
// contains filtered or unexported fields
}
L2met represents a l2met client.
type Prometheus ¶
type Prometheus struct {
// contains filtered or unexported fields
}
Prometheus represents a promethus stats collector.
func NewPrometheus ¶
func NewPrometheus(prefix string) *Prometheus
NewPrometheus creates a new Prometheus stats instance.
func (*Prometheus) Close ¶
func (s *Prometheus) Close() error
Close closes the client and flushes buffered stats, if applicable
func (*Prometheus) Dec ¶
func (s *Prometheus) Dec(name string, value int64, rate float32, tags ...interface{}) error
Dec decrements a count by the value.
func (*Prometheus) Gauge ¶
func (s *Prometheus) Gauge(name string, value float64, rate float32, tags ...interface{}) error
Gauge measures the value of a metric.
func (*Prometheus) Handler ¶
func (s *Prometheus) Handler() http.Handler
Handler gets the prometheus HTTP handler.
type Stats ¶
type Stats interface { io.Closer // Inc increments a count by the value. Inc(name string, value int64, rate float32, tags ...interface{}) error // Dec decrements a count by the value. Dec(name string, value int64, rate float32, tags ...interface{}) error // Gauge measures the value of a metric. Gauge(name string, value float64, rate float32, tags ...interface{}) error // Timing sends the value of a Duration. Timing(name string, value time.Duration, rate float32, tags ...interface{}) error }
Stats represents a stats instance.
func FromContext ¶
FromContext returns the instance of Stats in the context.
type Statsd ¶
type Statsd struct {
// contains filtered or unexported fields
}
Statsd represents a statsd client.
type TaggedStats ¶
type TaggedStats struct {
// contains filtered or unexported fields
}
TaggedStats wraps a Stats instance applying tags to all metrics.
func NewTaggedStats ¶
func NewTaggedStats(stats Stats, tags ...interface{}) *TaggedStats
NewTaggedStats creates a new TaggedStats instance.
func (TaggedStats) Close ¶
func (s TaggedStats) Close() error
Close closes the client and flushes buffered stats, if applicable
func (TaggedStats) Dec ¶
func (s TaggedStats) Dec(name string, value int64, rate float32, tags ...interface{}) error
Dec decrements a count by the value.
func (TaggedStats) Gauge ¶
func (s TaggedStats) Gauge(name string, value float64, rate float32, tags ...interface{}) error
Gauge measures the value of a metric.