metrics

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2016 License: MIT Imports: 4 Imported by: 4

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

func GetStatsdFromEnv() (client *statsd.Client, err error)

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL