Package list golang-github-go-kit-kit / debian/0.6.0-2_bpo9+1 metrics / provider / graphite.go

Tree @debian/0.6.0-2_bpo9+1 (Download .tar.gz)

graphite.go @debian/0.6.0-2_bpo9+1raw · history · blame

package provider

import (

type graphiteProvider struct {
	g    *graphite.Graphite
	stop func()

// NewGraphiteProvider wraps the given Graphite object and stop func and returns
// a Provider that produces Graphite metrics. A typical stop function would be
// ticker.Stop from the ticker passed to the SendLoop helper method.
func NewGraphiteProvider(g *graphite.Graphite, stop func()) Provider {
	return &graphiteProvider{
		g:    g,
		stop: stop,

// NewCounter implements Provider.
func (p *graphiteProvider) NewCounter(name string) metrics.Counter {
	return p.g.NewCounter(name)

// NewGauge implements Provider.
func (p *graphiteProvider) NewGauge(name string) metrics.Gauge {
	return p.g.NewGauge(name)

// NewHistogram implements Provider.
func (p *graphiteProvider) NewHistogram(name string, buckets int) metrics.Histogram {
	return p.g.NewHistogram(name, buckets)

// Stop implements Provider, invoking the stop function passed at construction.
func (p *graphiteProvider) Stop() {