metric

package
v0.5.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

This section is empty.

Types

type Async added in v0.3.0

type Async struct {
	Instrument
	// contains filtered or unexported fields
}

func (*Async) Implementation added in v0.3.0

func (a *Async) Implementation() interface{}

type AsyncCollector added in v0.5.0

type AsyncCollector interface {
	// CollectAsync passes a batch of observations to the MeterImpl.
	CollectAsync([]kv.KeyValue, ...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 added in v0.5.0

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

func NewAsyncInstrumentState(errorHandler func(error)) *AsyncInstrumentState

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

errorHandler is used to print an error condition. If errorHandler nil, the default error handler will be used that prints to os.Stderr. Only the first error is passed to the handler, after which errors are skipped.

func (*AsyncInstrumentState) Instruments added in v0.5.0

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

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

func (a *AsyncInstrumentState) Run(collector AsyncCollector)

Run executes the complete set of observer callbacks.

type Batch

type Batch struct {
	// Measurement needs to be aligned for 64-bit atomic operations.
	Measurements []Measurement
	Ctx          context.Context
	Labels       []kv.KeyValue
	LibraryName  string
}

type Handle

type Handle struct {
	Instrument *Sync
	Labels     []kv.KeyValue
}

func (*Handle) RecordOne

func (h *Handle) RecordOne(ctx context.Context, number apimetric.Number)

func (*Handle) Unbind added in v0.2.1

func (h *Handle) Unbind()

type Instrument

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

func (Instrument) Descriptor added in v0.3.0

func (i Instrument) Descriptor() apimetric.Descriptor

type Measurement

type Measurement struct {
	// Number needs to be aligned for 64-bit atomic operations.
	Number     apimetric.Number
	Instrument apimetric.InstrumentImpl
}

type MeterImpl added in v0.4.0

type MeterImpl struct {
	MeasurementBatches []Batch
	// contains filtered or unexported fields
}

func NewMeter

func NewMeter() (*MeterImpl, apimetric.Meter)

func NewProvider added in v0.2.1

func NewProvider() (*MeterImpl, apimetric.Provider)

func (*MeterImpl) CollectAsync added in v0.5.0

func (m *MeterImpl) CollectAsync(labels []kv.KeyValue, obs ...metric.Observation)

func (*MeterImpl) NewAsyncInstrument added in v0.4.0

func (m *MeterImpl) NewAsyncInstrument(descriptor metric.Descriptor, runner metric.AsyncRunner) (apimetric.AsyncImpl, error)

func (*MeterImpl) NewSyncInstrument added in v0.4.0

func (m *MeterImpl) NewSyncInstrument(descriptor metric.Descriptor) (apimetric.SyncImpl, error)

func (*MeterImpl) RecordBatch added in v0.4.0

func (m *MeterImpl) RecordBatch(ctx context.Context, labels []kv.KeyValue, measurements ...apimetric.Measurement)

func (*MeterImpl) RunAsyncInstruments added in v0.4.0

func (m *MeterImpl) RunAsyncInstruments()

type MeterProvider added in v0.2.1

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

func (*MeterProvider) Meter added in v0.2.1

func (p *MeterProvider) Meter(name string) apimetric.Meter

type Sync added in v0.3.0

type Sync struct {
	Instrument
}

func (*Sync) Bind added in v0.3.0

func (s *Sync) Bind(labels []kv.KeyValue) apimetric.BoundSyncImpl

func (*Sync) Implementation added in v0.3.0

func (s *Sync) Implementation() interface{}

func (*Sync) RecordOne added in v0.3.0

func (s *Sync) RecordOne(ctx context.Context, number apimetric.Number, labels []kv.KeyValue)

Jump to

Keyboard shortcuts

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