ganglia

package
v0.0.0-...-d95a457 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2018 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package ganglia has convenience functions for using ganglia.

This package uses the vlog utility package for logging various messages if the vlog.Verbose boolean is set to true.

Index

Constants

Variables

View Source
var (
	GmondConfig string
	Interval    time.Duration
)

Functions

func AddGmetrics

func AddGmetrics(callback ReporterCallback)

Convenience wrapper for Gmetric().AddCallback():

  AddGmetrics(func(gmetric MetricSender) {
	   gmetric("profit", "1000000.00", GmetricFloat, "dollars", true)
  })

func CommonGmetrics

func CommonGmetrics(gmetric MetricSender)

func NewGmetric

func NewGmetric() (*gmetric.Gmetric, error)

Types

type MetricSender

type MetricSender func(name string, value string, metricType uint32, units string, rate bool)

MetricSender takes the following parameters:

name: an arbitrary metric name
value: the metric's current value
metricType: one of GmetricString, GmetricUshort, GmetricShort, GmetricUint, GmetricInt, GmetricFloat, or GmetricDouble
units: a label to include on the metric's Y axis
rate: if true, send the rate relative to the last sample instead of an absolute value

type Reporter

type Reporter struct {
	*stopper.ChanStopper
	// contains filtered or unexported fields
}

func Gmetric

func Gmetric() *Reporter

Gmetric returns a global Reporter that clients may hook into by calling AddCallback.

func NewGangliaReporter

func NewGangliaReporter(interval time.Duration) *Reporter

NewGangliaReporter returns a Reporter object which calls callback every interval with the given group name. callback is passed a Gmetric whose servers are initialized from the hosts gmond.conf. Calling Stop on the Reporter will cease its operation.

func NewGangliaReporterWithOptions

func NewGangliaReporterWithOptions(interval time.Duration, groupName string) *Reporter

NewGangliaReporterWithOptions is NewGangliaReporter with the groupName.

func (*Reporter) AddCallback

func (gr *Reporter) AddCallback(callback ReporterCallback)

func (*Reporter) Configure

func (gr *Reporter) Configure(groupName, prefix string) *Reporter

Configure sets group name and prefix of a reporter and returns the reporter.

func (*Reporter) SetDmax

func (gr *Reporter) SetDmax(dmax time.Duration) *Reporter

SetDmax configures the amount of time that metrics are valid for in the tsdb. The default of 0 means forever. Time resolution is only respected to the second.

func (*Reporter) Stop

func (g *Reporter) Stop()

type ReporterCallback

type ReporterCallback func(MetricSender)

Jump to

Keyboard shortcuts

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