push

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPushPeriod = 10 * time.Second

DefaultPushPeriod is the default time interval between pushes.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v0.3.0

type Config struct {
	// ErrorHandler is the function called when the Controller encounters an error.
	//
	// This option can be overridden after instantiation of the Controller
	// with the `SetErrorHandler` method.
	ErrorHandler sdk.ErrorHandler

	// Resource is the OpenTelemetry resource associated with all Meters
	// created by the Controller.
	Resource *resource.Resource

	// Stateful causes the controller to maintain state across
	// collection events, so that records in the exported
	// checkpoint set are cumulative.
	Stateful bool

	// Period is the interval between calls to Collect a checkpoint.
	Period time.Duration

	// Timeout is the duration a collection (i.e. collect, accumulate,
	// integrate, and export) can last before it is canceled. Defaults to
	// the controller push period.
	Timeout time.Duration
}

Config contains configuration for a push Controller.

type Controller

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

Controller organizes a periodic push of metric data.

func New

func New(selector export.AggregationSelector, exporter export.Exporter, opts ...Option) *Controller

New constructs a Controller, an implementation of metric.Provider, using the provided exporter and options to configure an SDK with periodic collection.

func (*Controller) Provider added in v0.6.0

func (c *Controller) Provider() metric.Provider

Provider returns a metric.Provider instance for this controller.

func (*Controller) SetClock

func (c *Controller) SetClock(clock controllerTime.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)

SetErrorHandler sets the handler for errors. If none has been set, the SDK default error handler is used.

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 Option added in v0.3.0

type Option interface {
	// Apply sets the Option value of a Config.
	Apply(*Config)
}

Option is the interface that applies the value to a configuration option.

func WithErrorHandler added in v0.3.0

func WithErrorHandler(fn sdk.ErrorHandler) Option

WithErrorHandler sets the ErrorHandler configuration option of a Config.

func WithPeriod added in v0.6.0

func WithPeriod(period time.Duration) Option

WithPeriod sets the Period configuration option of a Config.

func WithResource added in v0.3.0

func WithResource(r *resource.Resource) Option

WithResource sets the Resource configuration option of a Config.

func WithStateful added in v0.6.0

func WithStateful(stateful bool) Option

WithStateful sets the Stateful configuration option of a Config.

func WithTimeout added in v0.6.0

func WithTimeout(timeout time.Duration) Option

WithTimeout sets the Timeout configuration option of a Config.

Jump to

Keyboard shortcuts

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