Documentation
¶
Overview ¶
Package statsd provides a StatsD client implementation that is safe for concurrent use by multiple goroutines and for efficiency can be created and reused.
Example usage:
// first create a client client, err := statsd.New("127.0.0.1:8125", "test-client") // handle any errors if err != nil { log.Fatal(err) } // make sure to clean up defer client.Close() // Send a stat err = client.Inc("stat1", 42, 1.0) // handle any errors if err != nil { log.Printf("Error sending metric: %+v", err) }
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Dial = New
Compat
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 string, 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 string, 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 string, 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 string, 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 string, delta int64, 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 string, value string, rate float32) error // Submits a stats set type // rate is the sample rate (0.0 to 1.0). UniqueInt64(stat string, value int64, rate float32) error // Sets/Updates the statsd client prefix SetPrefix(prefix string) }
Example ¶
// first create a client client, err := Dial("127.0.0.1:8125", "test-client") // handle any errors if err != nil { log.Fatal(err) } // make sure to clean up defer client.Close() // Send a stat err = client.Inc("stat1", 42, 1.0) // handle any errors if err != nil { log.Printf("Error sending metric: %+v", err) }
Output:
Click to show internal directories.
Click to hide internal directories.