pulseemitter

package
v6.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 15, 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 interface {
	// Increment increases the counter's delta by the given value
	Increment(c uint64)

	// Emit sends the counter values to the LoggClient.
	Emit(c LoggClient)
}

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.

type GaugeMetric

type GaugeMetric interface {
	// Set sets the current value of the gauge metric.
	Set(n int64)

	// Emit sends the counter values to the LoggClient.
	Emit(c LoggClient)
}

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.

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.

Jump to

Keyboard shortcuts

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