go-metrics-graphite – github.com/cyberdelia/go-metrics-graphite Index | Examples | Files

package graphite

import "github.com/cyberdelia/go-metrics-graphite"

Index

Examples

Functions

func Graphite

func Graphite(r metrics.Registry, d time.Duration, prefix string, addr *net.TCPAddr)

Graphite is a blocking exporter function which reports metrics in r to a graphite server located at addr, flushing them every d duration and prepending metric names with prefix.

Example

Code:

{
	addr, _ := net.ResolveTCPAddr("net", ":2003")
	go Graphite(metrics.DefaultRegistry, 1*time.Second, "some.prefix", addr)
}

func Once

func Once(c Config) error

Once performs a single submission to Graphite, returning a non-nil error on failed connections. This can be used in a loop similar to GraphiteWithConfig for custom error handling.

func WithConfig

func WithConfig(c Config)

WithConfig is a blocking exporter function just like Graphite, but it takes a GraphiteConfig instead.

Example

Code:

{
	addr, _ := net.ResolveTCPAddr("net", ":2003")
	go WithConfig(Config{
		Addr:          addr,
		Registry:      metrics.DefaultRegistry,
		FlushInterval: 1 * time.Second,
		DurationUnit:  time.Millisecond,
		Percentiles:   []float64{0.5, 0.75, 0.99, 0.999},
	})
}

Types

type Config

type Config struct {
	Addr          *net.TCPAddr     // Network address to connect to
	Registry      metrics.Registry // Registry to be exported
	FlushInterval time.Duration    // Flush interval
	DurationUnit  time.Duration    // Time conversion unit for durations
	Prefix        string           // Prefix to be prepended to metric names
	Percentiles   []float64        // Percentiles to export from timers and histograms
}

Config provides a container with configuration parameters for the Graphite exporter

Source Files

graphite.go

Version
v0.0.0-20161219230853-39f87cc3b432 (latest)
Published
Dec 19, 2016
Platform
windows/amd64
Imports
8 packages
Last checked
now

Tools for package owners.