Documentation ¶
Overview ¶
Package metrics provides a some helpers for sending metrics
Statsd ¶
Connect to a statsd endpoint using environment variables ¶
Environment Variables:
STATSD_HOST: The host of the statsd server STATSD_PORT: The port of the statsd server STATSD_NAMESPACE: The namespace to prefix to every metric name STATSD_TAGS: A comma separared list of tags to apply to every metric reported
Example:
STATSD_HOST: localhost STATSD_PORT: 8125 STATSD_NAMESPACE: app.live. STATSD_TAGS: env:live,version:1.0.2
Usage:
client, _ := GetStatsdFromEnv() client.Incr("metric", []string{"tag","tag2"}, 1)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetStatsd ¶
func GetStatsd(conf StatsdClientConf) (client *statsd.Client, err error)
GetStatsd returns a statsd client based on the supplied StatsdClientConf
func GetStatsdFromEnv ¶
GetStatsdFromEnv creates a statsd client based on the environment of the application
Uses the application environments:
STATSD_HOST: The host of the statsd server STATSD_PORT: The port of the statsd server STATSD_NAMESPACE: The namespace to prefix to every metric name STATSD_TAGS: A comma separared list of tags to apply to every metric reported
Returns a statsd.Client
Types ¶
type StatsdClientConf ¶
type StatsdClientConf struct {
// contains filtered or unexported fields
}
StatsdClientConf is a configuration struct to create a StatsD client
Click to show internal directories.
Click to hide internal directories.