Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
// Close closes the connection and cleans up.
Close() error
// Increments a statsd count type.
// stat is a string name for the metric.
// value is the integer value
// rate is the sample rate (0.0 to 1.0)
Inc(stat interface{}, value int64, rate float32) error
// Decrements a statsd count type.
// stat is a string name for the metric.
// value is the integer value.
// rate is the sample rate (0.0 to 1.0).
Dec(stat interface{}, value int64, rate float32) error
// Submits/Updates a statsd gauge type.
// stat is a string name for the metric.
// value is the integer value.
// rate is the sample rate (0.0 to 1.0).
Gauge(stat interface{}, value int64, rate float32) error
// Submits a delta to a statsd gauge.
// stat is the string name for the metric.
// value is the (positive or negative) change.
// rate is the sample rate (0.0 to 1.0).
GaugeDelta(stat interface{}, value int64, rate float32) error
// Submits a statsd timing type.
// stat is a string name for the metric.
// value is the integer value.
// rate is the sample rate (0.0 to 1.0).
Timing(stat interface{}, delta int64, rate float32) error
// Emit duration in milliseconds
TimingMs(stat interface{}, tm time.Duration, rate float32) error
// Submits a stats set type, where value is the unique string
// rate is the sample rate (0.0 to 1.0).
UniqueString(stat interface{}, value string, rate float32) error
// Submits a stats set type
// rate is the sample rate (0.0 to 1.0).
UniqueInt64(stat interface{}, value int64, rate float32) error
// Reports runtime metrics
ReportRuntimeMetrics(prefix string, rate float32) error
// Sets/Updates the statsd client prefix
SetPrefix(prefix string)
Metric(p ...string) Metric
}
type Metric ¶
type Metric interface {
// Metric is a composer that creates a new metric by cloning the current metric and adding
// values to it, is useful for cases with multiple submetric of the same metric
// m := s.Metric("base")
// m.Metric("roundtrip")
// m.Metric("bytes")
Metric(p ...string) Metric
String() string
}
Metric is an interface that represents system metric, provides platform-specific escaping and is faster than using fmt.Sprintf() as it usually uses bytes.Buffer
type Options ¶
type Options struct {
// UseBuffering turns on buffering of metrics what reduces amount of UDP packets
UseBuffering bool
// FlushBytes will trigger the packet send whenever accumulated buffer size will reach this value, default is 1440
FlushBytes int
// FlushPeriod will trigger periodic flushes in case of inactivity to avoid metric loss
FlushPeriod time.Duration
}
StatsdOptions allows tuning client for efficiency
Click to show internal directories.
Click to hide internal directories.