pull

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultCachePeriod time.Duration = 10 * time.Second

DefaultCachePeriod determines how long a recently-computed result will be returned without gathering metric data again.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {

	// 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

	// CachePeriod is the period which a recently-computed result
	// will be returned without gathering metric data again.
	//
	// If the period is zero, caching of the result is disabled.
	// The default value is 10 seconds.
	CachePeriod time.Duration
}

Config contains configuration for a pull Controller.

type Controller

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

Controller manages access to a *sdk.Accumulator and *simple.Integrator. Use Provider() for obtaining Meters. Use Foreach() for accessing current records.

func New

func New(selector export.AggregationSelector, options ...Option) *Controller

New returns a *Controller configured with an aggregation selector and options.

func (*Controller) Collect

func (c *Controller) Collect(ctx context.Context)

Collect requests a collection. The collection will be skipped if the last collection is aged less than the CachePeriod.

func (*Controller) ForEach

func (c *Controller) ForEach(f func(export.Record) error) error

Foreach gives the caller read-locked access to the current export.CheckpointSet.

func (*Controller) Provider

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

Provider returns a metric.Provider for the implementation managed by this controller.

func (*Controller) SetClock

func (c *Controller) SetClock(clock controllerTime.Clock)

SetClock sets the clock used for caching. For testing purposes.

type Option

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 WithCachePeriod

func WithCachePeriod(cachePeriod time.Duration) Option

WithCachePeriod sets the CachePeriod configuration option of a Config.

func WithResource

func WithResource(r *resource.Resource) Option

WithResource sets the Resource configuration option of a Config.

func WithStateful

func WithStateful(stateful bool) Option

WithStateful sets the Stateful configuration option of a Config.

Jump to

Keyboard shortcuts

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