go-loggregator: code.cloudfoundry.org/go-loggregator/pulseemitter Index | Files

package pulseemitter

import "code.cloudfoundry.org/go-loggregator/pulseemitter"

Index

Package Files

counter_metric.go gauge_metric.go pulse_emitter.go

type CounterMetric Uses

type CounterMetric interface {
    // Increment increases the counter's delta by the given value
    Increment(c uint64)

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

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

func NewCounterMetric Uses

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

NewCounterMetric returns a new counterMetric that can be incremented and emitted via a LogClient.

type GaugeMetric Uses

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

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

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

func NewGaugeMetric Uses

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

NewGaugeMetric returns a new gaugeMetric that has a value that can be set and emitted via a LogClient.

type LogClient Uses

type LogClient 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 Uses

type MetricOption func(map[string]string)

MetricOption defines a function type that can be used to configure tags for many types of metrics.

func WithTags Uses

func WithTags(tags map[string]string) MetricOption

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

func WithVersion Uses

func WithVersion(major, minor uint) MetricOption

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

type PulseEmitter Uses

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

PulseEmitter will emit metrics on a given interval.

func New Uses

func New(c LogClient, opts ...PulseEmitterOption) *PulseEmitter

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

func (*PulseEmitter) NewCounterMetric Uses

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 Uses

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 Uses

type PulseEmitterOption func(*PulseEmitter)

PulseEmitterOption is a function type that is used to configure optional settings for a PulseEmitter.

func WithPulseInterval Uses

func WithPulseInterval(d time.Duration) PulseEmitterOption

WithPulseInterval is a PulseEmitterOption for setting the pulsing interval.

func WithSourceID Uses

func WithSourceID(id string) PulseEmitterOption

WithSourceID is a PulseEmitterOption for setting the source ID that will be set on all outgoing metrics.

Package pulseemitter imports 7 packages (graph) and is imported by 13 packages. Updated 2019-01-22. Refresh now. Tools for package owners.