push

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

type Clock interface {
	Now() time.Time
	Ticker(time.Duration) Ticker
}

type Controller

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

Controller organizes a periodic push of metric data.

func New

func New(batcher export.Batcher, exporter export.Exporter, period time.Duration) *Controller

New constructs a Controller, an implementation of metric.Provider, using the provided batcher, exporter, and collection period to configure an SDK with periodic collection. The batcher itself is configured with the aggregation selector policy.

If the Exporter implements the export.LabelEncoder interface, the exporter will be used as the label encoder for the SDK itself, otherwise the SDK will be configured with the default label encoder.

func (*Controller) GetMeter

func (c *Controller) GetMeter(name string) metric.Meter

GetMeter returns a named Meter, satisifying the metric.Provider interface.

func (*Controller) SetClock

func (c *Controller) SetClock(clock Clock)

SetClock supports setting a mock clock for testing. This must be called before Start().

func (*Controller) SetErrorHandler

func (c *Controller) SetErrorHandler(errorHandler sdk.ErrorHandler)

func (*Controller) Start

func (c *Controller) Start()

Start begins a ticker that periodically collects and exports metrics with the configured interval.

func (*Controller) Stop

func (c *Controller) Stop()

Stop waits for the background goroutine to return and then collects and exports metrics one last time before returning.

type Ticker

type Ticker interface {
	Stop()
	C() <-chan time.Time
}

Jump to

Keyboard shortcuts

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