Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Noop = &Client{}
Noop is a StatsD client that discards all metrics. NewClient("", ...) returns this exact pointer so callers can use `client == metrics.Noop`.
Functions ¶
func EmitGoRuntimeGauges ¶
func EmitGoRuntimeGauges(emit MemStatsGaugeEmitter, m *runtime.MemStats, numGoroutine int)
EmitGoRuntimeGauges emits gh_ost.go_runtime.* gauges (namespace is applied by the client). m and numGoroutine are typically from runtime.ReadMemStats and runtime.NumGoroutine.
func StartGoRuntimeReporter ¶
StartGoRuntimeReporter periodically samples runtime memory and goroutines and emits gauges until ctx is cancelled. It is a no-op when interval <= 0, client is nil, or StatsD is disabled (noop client).
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps a StatsD client with namespace and global tags (from --statsd-tags).
func NewClient ¶
NewClient connects to addr for StatsD. If addr is empty, returns Noop and nil error. namespace is typically "gh_ost." (metrics are named namespace + short name, e.g. gh_ost.startup). tags are global tags applied to every metric (repeatable --statsd-tags).
type MemStatsGaugeEmitter ¶
MemStatsGaugeEmitter is implemented by *Client; used for tests without UDP.