pulseemitter

package
v2.3.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CounterMetric

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

CounterMetric is used by the pulse emitter to emit counter metrics to the LoggClient.

func NewCounterMetric

func NewCounterMetric(name string, opts ...MetricOption) *CounterMetric

NewCounterMetric returns a new CounterMetric that can be incremented and emitted via a LoggClient.

func (*CounterMetric) Emit

func (m *CounterMetric) Emit(c LoggClient)

Emit will send the current delta and tagging options to the LoggClient to be emitted. The delta on the CounterMetric will be reset to 0.

func (*CounterMetric) GetDelta

func (m *CounterMetric) GetDelta() uint64

GetDelta will return the current value of the delta.

func (*CounterMetric) Increment

func (m *CounterMetric) Increment(c uint64)

Increment will add the given uint64 to the current delta.

type GaugeMetric

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

GaugeMetric is used by the pulse emitter to emit gauge metrics to the LoggClient.

func NewGaugeMetric

func NewGaugeMetric(name, unit string, opts ...MetricOption) *GaugeMetric

NewGaugeMetric returns a new GaugeMetric that has a value that can be set and emitted via a LoggClient.

func (*GaugeMetric) Emit

func (g *GaugeMetric) Emit(c LoggClient)

Emit will send the current value and tagging options to the LoggClient to be emitted.

func (*GaugeMetric) Set

func (g *GaugeMetric) Set(n int64)

Set will set the current value of the gauge metric to the given number.

type LoggClient

type LoggClient interface {
	EmitCounter(name string, opts ...loggregator.EmitCounterOption)
	EmitGauge(opts ...loggregator.EmitGaugeOption)
}

LogClient is the client used by PulseEmitter to emit metrics. This would usually be the go-loggregator v2 client.

type MetricOption

type MetricOption func(map[string]string)

func WithTags

func WithTags(tags map[string]string) MetricOption

WithTags will set the tags to apply to every envelopes sent about the metric..

func WithVersion

func WithVersion(major, minor uint) MetricOption

WithVersion will apply a `metric_version` tag to all envelopes sent about the metric.

type PulseEmitter

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

PulseEmitter will emit metrics on a given interval.

func New

New returns a PulseEmitter configured with the given LoggClient and PulseEmitterOptions. The default pulse interval is 60 seconds.

func (*PulseEmitter) NewCounterMetric

func (c *PulseEmitter) NewCounterMetric(name string, opts ...MetricOption) *CounterMetric

NewCounterMetric returns a CounterMetric that can be incremented. After calling NewCounterMetric the counter metric will begin to be emitted on the interval configured on the PulseEmitter. If the counter metrics value has not changed since last emitted a 0 value will be emitted. Every time the counter metric is emitted, its delta is reset to 0.

func (*PulseEmitter) NewGaugeMetric

func (c *PulseEmitter) NewGaugeMetric(name, unit string, opts ...MetricOption) *GaugeMetric

NewGaugeMetric returns a GaugeMetric that has a value that can be set. After calling NewGaugeMetric the gauge metric will begin to be emitted on the interval configured on the PulseEmitter. When emitting the gauge metric, it will use the last value given when calling set on the gauge metric.

type PulseEmitterOption

type PulseEmitterOption func(*PulseEmitter)

func WithPulseInterval

func WithPulseInterval(d time.Duration) PulseEmitterOption

WithPulseInterval is a PulseEmitterOption for setting the pulsing interval.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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