sdkapi

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncBatchRunner added in v0.25.0

type AsyncBatchRunner interface {
	// Run accepts a function for capturing observations of
	// multiple instruments.
	Run(ctx context.Context, capture func([]attribute.KeyValue, ...Observation))

	AsyncRunner
}

AsyncBatchRunner is an interface implemented by batch-observer callbacks.

type AsyncImpl added in v0.25.0

type AsyncImpl interface {
	InstrumentImpl
}

AsyncImpl is an implementation-level interface to an asynchronous instrument (e.g., Observer instruments).

func NewNoopAsyncInstrument added in v0.25.0

func NewNoopAsyncInstrument() AsyncImpl

NewNoopAsyncInstrument returns a No-op implementation of the asynchronous instrument interface.

type AsyncRunner added in v0.25.0

type AsyncRunner interface {
	// AnyRunner is a non-exported method with no functional use
	// other than to make this a non-empty interface.
	AnyRunner()
}

AsyncRunner is expected to convert into an AsyncSingleRunner or an AsyncBatchRunner. SDKs will encounter an error if the AsyncRunner does not satisfy one of these interfaces.

type AsyncSingleRunner added in v0.25.0

type AsyncSingleRunner interface {
	// Run accepts a single instrument and function for capturing
	// observations of that instrument.  Each call to the function
	// receives one captured observation.  (The function accepts
	// multiple observations so the same implementation can be
	// used for batch runners.)
	Run(ctx context.Context, single AsyncImpl, capture func([]attribute.KeyValue, ...Observation))

	AsyncRunner
}

AsyncSingleRunner is an interface implemented by single-observer callbacks.

type Descriptor added in v0.25.0

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

Descriptor contains all the settings that describe an instrument, including its name, metric kind, number kind, and the configurable options.

func NewDescriptor added in v0.25.0

func NewDescriptor(name string, ikind InstrumentKind, nkind number.Kind, description string, unit unit.Unit) Descriptor

NewDescriptor returns a Descriptor with the given contents.

func (Descriptor) Description added in v0.25.0

func (d Descriptor) Description() string

Description provides a human-readable description of the metric instrument.

func (Descriptor) InstrumentKind added in v0.25.0

func (d Descriptor) InstrumentKind() InstrumentKind

InstrumentKind returns the specific kind of instrument.

func (Descriptor) Name added in v0.25.0

func (d Descriptor) Name() string

Name returns the metric instrument's name.

func (Descriptor) NumberKind added in v0.25.0

func (d Descriptor) NumberKind() number.Kind

NumberKind returns whether this instrument is declared over int64, float64, or uint64 values.

func (Descriptor) Unit added in v0.25.0

func (d Descriptor) Unit() unit.Unit

Unit describes the units of the metric instrument. Unitless metrics return the empty string.

type InstrumentImpl added in v0.25.0

type InstrumentImpl interface {
	// Implementation returns the underlying implementation of the
	// instrument, which allows the implementation to gain access
	// to its own representation especially from a `Measurement`.
	Implementation() interface{}

	// Descriptor returns a copy of the instrument's Descriptor.
	Descriptor() Descriptor
}

InstrumentImpl is a common interface for synchronous and asynchronous instruments.

type InstrumentKind

type InstrumentKind int8

InstrumentKind describes the kind of instrument.

const (
	// HistogramInstrumentKind indicates a Histogram instrument.
	HistogramInstrumentKind InstrumentKind = iota
	// GaugeObserverInstrumentKind indicates an GaugeObserver instrument.
	GaugeObserverInstrumentKind

	// CounterInstrumentKind indicates a Counter instrument.
	CounterInstrumentKind
	// UpDownCounterInstrumentKind indicates a UpDownCounter instrument.
	UpDownCounterInstrumentKind

	// CounterObserverInstrumentKind indicates a CounterObserver instrument.
	CounterObserverInstrumentKind
	// UpDownCounterObserverInstrumentKind indicates a UpDownCounterObserver
	// instrument.
	UpDownCounterObserverInstrumentKind
)

func (InstrumentKind) Adding

func (k InstrumentKind) Adding() bool

Adding returns whether this kind of instrument adds its inputs (as opposed to Grouping).

func (InstrumentKind) Asynchronous

func (k InstrumentKind) Asynchronous() bool

Asynchronous returns whether this is an asynchronous kind of instrument.

func (InstrumentKind) Grouping

func (k InstrumentKind) Grouping() bool

Grouping returns whether this kind of instrument groups its inputs (as opposed to Adding).

func (InstrumentKind) Monotonic

func (k InstrumentKind) Monotonic() bool

Monotonic returns whether this kind of instrument exposes a non-decreasing sum.

func (InstrumentKind) PrecomputedSum

func (k InstrumentKind) PrecomputedSum() bool

PrecomputedSum returns whether this kind of instrument receives precomputed sums.

func (InstrumentKind) String

func (i InstrumentKind) String() string

func (InstrumentKind) Synchronous

func (k InstrumentKind) Synchronous() bool

Synchronous returns whether this is a synchronous kind of instrument.

type Measurement added in v0.25.0

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

Measurement is a low-level type used with synchronous instruments as a direct interface to the SDK via `RecordBatch`.

func NewMeasurement added in v0.25.0

func NewMeasurement(instrument SyncImpl, number number.Number) Measurement

NewMeasurement constructs a single observation, a binding between an asynchronous instrument and a number.

func (Measurement) Number added in v0.25.0

func (m Measurement) Number() number.Number

Number returns a number recorded in this measurement.

func (Measurement) SyncImpl added in v0.25.0

func (m Measurement) SyncImpl() SyncImpl

SyncImpl returns the instrument that created this measurement. This returns an implementation-level object for use by the SDK, users should not refer to this.

type MeterImpl added in v0.25.0

type MeterImpl interface {
	// RecordBatch atomically records a batch of measurements.
	RecordBatch(ctx context.Context, labels []attribute.KeyValue, measurement ...Measurement)

	// NewSyncInstrument returns a newly constructed
	// synchronous instrument implementation or an error, should
	// one occur.
	NewSyncInstrument(descriptor Descriptor) (SyncImpl, error)

	// NewAsyncInstrument returns a newly constructed
	// asynchronous instrument implementation or an error, should
	// one occur.
	NewAsyncInstrument(
		descriptor Descriptor,
		runner AsyncRunner,
	) (AsyncImpl, error)
}

MeterImpl is the interface an SDK must implement to supply a Meter implementation.

type Observation added in v0.25.0

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

Observation is a low-level type used with asynchronous instruments as a direct interface to the SDK via `BatchObserver`.

func NewObservation added in v0.25.0

func NewObservation(instrument AsyncImpl, number number.Number) Observation

NewObservation constructs a single observation, a binding between an asynchronous instrument and a number.

func (Observation) AsyncImpl added in v0.25.0

func (m Observation) AsyncImpl() AsyncImpl

AsyncImpl returns the instrument that created this observation. This returns an implementation-level object for use by the SDK, users should not refer to this.

func (Observation) Number added in v0.25.0

func (m Observation) Number() number.Number

Number returns a number recorded in this observation.

type SyncImpl added in v0.25.0

type SyncImpl interface {
	InstrumentImpl

	// RecordOne captures a single synchronous metric event.
	RecordOne(ctx context.Context, number number.Number, labels []attribute.KeyValue)
}

SyncImpl is the implementation-level interface to a generic synchronous instrument (e.g., Histogram and Counter instruments).

func NewNoopSyncInstrument added in v0.25.0

func NewNoopSyncInstrument() SyncImpl

NewNoopSyncInstrument returns a No-op implementation of the synchronous instrument interface.

Jump to

Keyboard shortcuts

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