otel: go.opentelemetry.io/otel/sdk/metric/controller/pull Index | Files

package pull

import "go.opentelemetry.io/otel/sdk/metric/controller/pull"

Index

Package Files

config.go pull.go

Constants

const DefaultCachePeriod time.Duration = 10 * time.Second

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

type Config Uses

type Config struct {

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

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

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

Controller manages access to a *sdk.Accumulator and *basic.Processor. Use MeterProvider() for obtaining Meters. Use Foreach() for accessing current records.

func New Uses

func New(checkpointer export.Checkpointer, options ...Option) *Controller

New returns a *Controller configured with an export.Checkpointer.

Pull controllers are typically used in an environment where there are multiple readers. It is common, therefore, when configuring a basic Processor for use with this controller, to use a CumulativeExport strategy and the basic.WithMemory(true) option, which ensures that every CheckpointSet includes full state.

func (*Controller) Collect Uses

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

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

func (*Controller) ForEach Uses

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

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

func (*Controller) MeterProvider Uses

func (c *Controller) MeterProvider() otel.MeterProvider

MeterProvider returns a MeterProvider for the implementation managed by this controller.

func (*Controller) SetClock Uses

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

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

type Option Uses

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 Uses

func WithCachePeriod(cachePeriod time.Duration) Option

WithCachePeriod sets the CachePeriod configuration option of a Config.

func WithResource Uses

func WithResource(r *resource.Resource) Option

WithResource sets the Resource configuration option of a Config.

Package pull imports 8 packages (graph) and is imported by 3 packages. Updated 2020-10-20. Refresh now. Tools for package owners.