package metric

import "go.opentelemetry.io/otel/internal/metric"

Index

Variables

var ErrInvalidAsyncRunner = errors.New("unknown async runner type")

Types

type AsyncCollector

type AsyncCollector interface {
	// CollectAsync passes a batch of observations to the MeterImpl.
	CollectAsync(labels []attribute.KeyValue, observation ...metric.Observation)
}

AsyncCollector is an interface used between the MeterImpl and the AsyncInstrumentState helper below. This interface is implemented by the SDK to provide support for running observer callbacks.

type AsyncInstrumentState

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

AsyncInstrumentState manages an ordered set of asynchronous instruments and the distinct runners, taking into account batch observer callbacks.

func NewAsyncInstrumentState

func NewAsyncInstrumentState() *AsyncInstrumentState

NewAsyncInstrumentState returns a new *AsyncInstrumentState, for use by MeterImpl to manage running the set of observer callbacks in the correct order.

func (*AsyncInstrumentState) Instruments

func (a *AsyncInstrumentState) Instruments() []metric.AsyncImpl

Instruments returns the asynchronous instruments managed by this object, the set that should be checkpointed after observers are run.

func (*AsyncInstrumentState) Register

func (a *AsyncInstrumentState) Register(inst metric.AsyncImpl, runner metric.AsyncRunner)

Register adds a new asynchronous instrument to by managed by this object. This should be called during NewAsyncInstrument() and assumes that errors (e.g., duplicate registration) have already been checked.

func (*AsyncInstrumentState) Run

func (a *AsyncInstrumentState) Run(ctx context.Context, collector AsyncCollector)

Run executes the complete set of observer callbacks.

Source Files

async.go

Version
v0.20.0
Published
Apr 23, 2021
Platform
js/wasm
Imports
7 packages
Last checked
8 minutes ago

Tools for package owners.