reporting

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package reporting provides functionality for reporting metrics to Wavefront.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeKey

func DecodeKey(key string) (string, map[string]string)

DecodeKey decodes a metric key into a metric name and tag string

func DeltaCounterName

func DeltaCounterName(name string) string

DeltaCounterName return a delta counter name prefixed with ∆. Can be used as an input for RegisterMetric() or GetOrRegisterMetric() functions

func EncodeKey

func EncodeKey(key string, tags map[string]string) string

EncodeKey encodes the metric name and tags into a unique key.

func GetMetric deprecated

func GetMetric(name string, tags map[string]string) interface{}

GetMetric tag support for metrics.Get()

Deprecated: Use WavefrontMetricsReporter.GetMetric instead.

func GetOrRegisterMetric deprecated

func GetOrRegisterMetric(name string, i interface{}, tags map[string]string) interface{}

GetOrRegisterMetric tag support for metrics.GetOrRegister()

Deprecated: Use WavefrontMetricsReporter.GetOrRegisterMetric instead.

func NewHistogram

func NewHistogram(options ...histogram.Option) metrics.Histogram

NewHistogram create a new Wavefront Histogram and the wrapper

func RegisterMetric deprecated

func RegisterMetric(name string, metric interface{}, tags map[string]string) error

RegisterMetric tag support for metrics.Register() return RegistryError if the metric is not registered

Deprecated: Use WavefrontMetricsReporter.RegisterMetric instead.

func UnregisterMetric deprecated

func UnregisterMetric(name string, tags map[string]string)

UnregisterMetric tag support for metrics.UnregisterMetric()

Deprecated: Use WavefrontMetricsReporter.UnregisterMetric instead.

Types

type Histogram

type Histogram struct {
	// contains filtered or unexported fields
}

Histogram wrapper of Wavefront Histogram so it can be used with metrics.Registry

func (Histogram) Clear

func (h Histogram) Clear()

Clear will panic

func (Histogram) Count

func (h Histogram) Count() int64

Count returns the total number of samples on this histogram.

func (Histogram) Distributions

func (h Histogram) Distributions() []histogram.Distribution

Distributions returns all samples on completed time slices, and clear the histogram

func (Histogram) Granularity

func (h Histogram) Granularity() histogram.Granularity

Granularity value

func (Histogram) Max

func (h Histogram) Max() int64

Max returns the maximum Value of samples on this histogram.

func (Histogram) Mean

func (h Histogram) Mean() float64

Mean returns the mean values of samples on this histogram.

func (Histogram) Min

func (h Histogram) Min() int64

Min returns the minimum Value of samples on this histogram.

func (Histogram) Percentile

func (h Histogram) Percentile(p float64) float64

Percentile returns the desired percentile estimation.

func (Histogram) Percentiles

func (h Histogram) Percentiles(ps []float64) []float64

Percentiles returns a slice of arbitrary percentiles of values in the sample

func (Histogram) Sample

func (h Histogram) Sample() metrics.Sample

Sample will panic

func (Histogram) Snapshot

func (h Histogram) Snapshot() metrics.Histogram

Snapshot create a metrics.Histogram

func (Histogram) StdDev

func (h Histogram) StdDev() float64

StdDev returns the standard deviation.

func (Histogram) Sum

func (h Histogram) Sum() int64

Sum returns the sum of all values on this histogram.

func (Histogram) Update

func (h Histogram) Update(v int64)

Update registers a new sample in the histogram.

func (Histogram) Variance

func (h Histogram) Variance() float64

Variance returns the variance of inputs.

type Option

type Option func(*reporter)

Option allows WavefrontReporter customization

func AddSuffix

func AddSuffix(addSuffix bool) Option

AddSuffix adds a metric suffix based on the metric type ('.count', '.value')

func CustomRegistry

func CustomRegistry(registry metrics.Registry) Option

CustomRegistry allows overriding the registry used by the reporter.

func DisableAutoStart

func DisableAutoStart() Option

DisableAutoStart prevents the Reporter from automatically reporting when created.

func Interval

func Interval(interval time.Duration) Option

Interval change the default 1 minute reporting interval.

func LogErrors

func LogErrors(debug bool) Option

LogErrors tag for metrics

func Prefix

func Prefix(prefix string) Option

Prefix for the metrics name

func Source

func Source(source string) Option

Source tag for metrics

type RegistryError

type RegistryError string

RegistryError returned if there is any error on RegisterMetric

func (RegistryError) Error

func (err RegistryError) Error() string

type WavefrontMetricsReporter

type WavefrontMetricsReporter interface {
	// Starts reporting metrics to Wavefront at a given interval.
	Start()

	// Stops reporting metrics and closes the reporter.
	Close()

	// Reports the metrics to Wavefront just once. Can be used to manually report metrics to Wavefront outside of Start.
	Report()

	// Gets the count of errors in reporting metrics to Wavefront.
	ErrorsCount() int64

	// RegisterMetric register the given metric under the given name and tags
	// return RegistryError if the metric is not registered
	RegisterMetric(name string, metric interface{}, tags map[string]string) error

	// GetMetric get the metric by the given name and tags or nil if none is registered.
	GetMetric(name string, tags map[string]string) interface{}

	// GetOrRegisterMetric gets an existing metric or registers the given one.
	// The interface can be the metric to register if not found in registry,
	// or a function returning the metric for lazy instantiation.
	GetOrRegisterMetric(name string, i interface{}, tags map[string]string) interface{}

	// UnregisterMetric Unregister the metric with the given name.
	UnregisterMetric(name string, tags map[string]string)
}

WavefrontMetricsReporter report go-metrics to wavefront

func NewReporter

func NewReporter(sender wf.Sender, application application.Tags, setters ...Option) WavefrontMetricsReporter

NewReporter create a WavefrontMetricsReporter

Jump to

Keyboard shortcuts

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