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

package push

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


Package Files

config.go push.go


const DefaultPushPeriod = 10 * time.Second

DefaultPushPeriod is the default time interval between pushes.

type Config Uses

type Config struct {
    // Resource is the OpenTelemetry resource associated with all Meters
    // created by the Controller.
    Resource *resource.Resource

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

type Controller struct {
    // contains filtered or unexported fields

Controller organizes a periodic push of metric data.

func New Uses

func New(checkpointer export.Checkpointer, exporter export.Exporter, opts ...Option) *Controller

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

func (*Controller) MeterProvider Uses

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

MeterProvider returns a MeterProvider instance for this controller.

func (*Controller) SetClock Uses

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

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

func (*Controller) Start Uses

func (c *Controller) Start()

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

func (*Controller) Stop Uses

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 Uses

type Option interface {
    // Apply sets the Option value of a Config.

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

func WithPeriod Uses

func WithPeriod(period time.Duration) Option

WithPeriod sets the Period configuration option of a Config.

func WithResource Uses

func WithResource(r *resource.Resource) Option

WithResource sets the Resource configuration option of a Config.

func WithTimeout Uses

func WithTimeout(timeout time.Duration) Option

WithTimeout sets the Timeout configuration option of a Config.

Package push imports 10 packages (graph) and is imported by 14 packages. Updated 2020-09-26. Refresh now. Tools for package owners.