Skip to content

Latest commit

 

History

History
38 lines (30 loc) · 1.1 KB

README.md

File metadata and controls

38 lines (30 loc) · 1.1 KB

Graphite

Graphite is the Graphite driver for go-metrics-plus. It collects metrics from a registry and periodically posts them to a Graphite instance. The driver has been ported to go-metrics-plus (along with several bug fixes and optimizations) from cyberdelia's go-metrics-graphite project.

Usage

import "github.com/zeim839/go-metrics-plus/graphite"

// Sinks metrics every 1 second.
go graphite.Graphite(metrics.DefaultRegistry, 1*time.Second, "some.prefix", addr)

Example

import (
	"github.com/zeim839/go-metrics-plus"
	"github.com/zeim839/go-metrics-plus/graphite"
	"net"
	"time"
)

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

func ExampleWithConfig() {
	addr, _ := net.ResolveTCPAddr("net", ":2003")
	go graphite.WithConfig(Config{
		Addr:          addr,
		Registry:      metrics.DefaultRegistry,
		FlushInterval: 1 * time.Second,
		DurationUnit:  time.Millisecond,
	})
}