package metric

Import Path
	go.opentelemetry.io/otel/api/metric (on go.dev)

Dependency Relation
	imports 9 packages, and imported by 5 packages

Involved Source Files async.go config.go counter.go descriptor.go metric package provides an API for reporting diagnostic measurements using instruments categorized as follows: Synchronous instruments are called by the user with a Context. Asynchronous instruments are called by the SDK during collection. Additive instruments are semantically intended for capturing a sum. Non-additive instruments are intended for capturing a distribution. Additive instruments may be monotonic, in which case they are non-descreasing and naturally define a rate. The synchronous instrument names are: Counter: additive, monotonic UpDownCounter: additive ValueRecorder: non-additive and the asynchronous instruments are: SumObserver: additive, monotonic UpDownSumObserver: additive ValueObserver: non-additive All instruments are provided with support for either float64 or int64 input values. The Meter interface supports allocating new instruments as well as interfaces for recording batches of synchronous measurements or asynchronous observations. To obtain a Meter, use a Provider. The Provider interface supports obtaining a named Meter interface. To obtain a Provider implementation, initialize and configure any compatible SDK. kind.go kind_string.go meter.go must.go noop.go number.go numberkind_string.go observer.go sdkapi.go sync.go updowncounter.go valuerecorder.go
Package-Level Type Names (total 60, in which 51 are exported)
/* sort exporteds by: | */
AsyncBatchRunner is an interface implemented by batch-observer callbacks. AnyRunner() is a non-exported method with no functional use other than to make this a non-empty interface. Run accepts a function for capturing observations of multiple instruments. *BatchObserverFunc T : AsyncRunner
AsyncImpl is an implementation-level interface to an asynchronous instrument (e.g., Observer instruments). Descriptor returns a copy of the instrument's Descriptor. Implementation returns the underlying implementation of the instrument, which allows the implementation to gain access to its own representation especially from a `Measurement`. InstrumentImpl (interface) NoopAsync NoopSync SyncImpl (interface) T : InstrumentImpl func MeterImpl.NewAsyncInstrument(descriptor Descriptor, runner AsyncRunner) (AsyncImpl, error) func Observation.AsyncImpl() AsyncImpl func go.opentelemetry.io/otel/api/global/internal.AsyncImpler.AsyncImpl() AsyncImpl func AsyncSingleRunner.Run(ctx context.Context, single AsyncImpl, capture func([]label.KeyValue, ...Observation)) func (*Float64ObserverFunc).Run(ctx context.Context, impl AsyncImpl, function func([]label.KeyValue, ...Observation)) func (*Int64ObserverFunc).Run(ctx context.Context, impl AsyncImpl, function func([]label.KeyValue, ...Observation))
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. AnyRunner() is a non-exported method with no functional use other than to make this a non-empty interface. AsyncBatchRunner (interface) AsyncSingleRunner (interface) *BatchObserverFunc *Float64ObserverFunc *Int64ObserverFunc func MeterImpl.NewAsyncInstrument(descriptor Descriptor, runner AsyncRunner) (AsyncImpl, error)
AsyncSingleRunner is an interface implemented by single-observer callbacks. AnyRunner() is a non-exported method with no functional use other than to make this a non-empty 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.) *Float64ObserverFunc *Int64ObserverFunc T : AsyncRunner
BatchObserver represents an Observer callback that can report observations for multiple instruments. NewFloat64SumObserver creates a new floating point SumObserver with the given name, running in a batch callback, and customized with options. May return an error if the name is invalid (e.g., empty) or improperly registered (e.g., duplicate registration). NewFloat64UpDownSumObserver creates a new floating point UpDownSumObserver with the given name, running in a batch callback, and customized with options. May return an error if the name is invalid (e.g., empty) or improperly registered (e.g., duplicate registration). NewFloat64ValueObserver creates a new floating point ValueObserver with the given name, running in a batch callback, and customized with options. May return an error if the name is invalid (e.g., empty) or improperly registered (e.g., duplicate registration). NewInt64SumObserver creates a new integer SumObserver instrument with the given name, running in a batch callback, and customized with options. May return an error if the name is invalid (e.g., empty) or improperly registered (e.g., duplicate registration). NewInt64UpDownSumObserver creates a new integer UpDownSumObserver instrument with the given name, running in a batch callback, and customized with options. May return an error if the name is invalid (e.g., empty) or improperly registered (e.g., duplicate registration). NewInt64ValueObserver creates a new integer ValueObserver instrument with the given name, running in a batch callback, and customized with options. May return an error if the name is invalid (e.g., empty) or improperly registered (e.g., duplicate registration). func Meter.NewBatchObserver(callback BatchObserverFunc) BatchObserver
BatchObserverFunc is a callback argument for use with any Observer instrument that will be reported as a batch of observations. AnyRunner implements AsyncRunner. Run implements AsyncBatchRunner. *T : AsyncBatchRunner *T : AsyncRunner func Meter.NewBatchObserver(callback BatchObserverFunc) BatchObserver func MeterMust.NewBatchObserver(callback BatchObserverFunc) BatchObserverMust
BatchObserverMust is a wrapper for BatchObserver that panics when any instrument constructor encounters an error. NewFloat64SumObserver calls `BatchObserver.NewFloat64SumObserver` and returns the instrument, panicking if it encounters an error. NewFloat64UpDownSumObserver calls `BatchObserver.NewFloat64UpDownSumObserver` and returns the instrument, panicking if it encounters an error. NewFloat64ValueObserver calls `BatchObserver.NewFloat64ValueObserver` and returns the instrument, panicking if it encounters an error. NewInt64SumObserver calls `BatchObserver.NewInt64SumObserver` and returns the instrument, panicking if it encounters an error. NewInt64UpDownSumObserver calls `BatchObserver.NewInt64UpDownSumObserver` and returns the instrument, panicking if it encounters an error. NewInt64ValueObserver calls `BatchObserver.NewInt64ValueObserver` and returns the instrument, panicking if it encounters an error. func MeterMust.NewBatchObserver(callback BatchObserverFunc) BatchObserverMust
BatchObserverResult is passed to a batch observer callback to capture observations for multiple asynchronous instruments. Observe captures a multiple observations from the associated batch instrument callback, with the given labels.
BoundFloat64Counter is a bound instrument for Float64Counter. It inherits the Unbind function from syncBoundInstrument. Add adds the value to the counter's sum using the labels previously bound to this counter via Bind() Unbind calls SyncImpl.Unbind. func Float64Counter.Bind(labels ...label.KeyValue) (h BoundFloat64Counter)
BoundFloat64UpDownCounter is a bound instrument for Float64UpDownCounter. It inherits the Unbind function from syncBoundInstrument. Add adds the value to the counter's sum using the labels previously bound to this counter via Bind() Unbind calls SyncImpl.Unbind. func Float64UpDownCounter.Bind(labels ...label.KeyValue) (h BoundFloat64UpDownCounter)
BoundFloat64ValueRecorder is a bound instrument for Float64ValueRecorder. It inherits the Unbind function from syncBoundInstrument. Record adds a new value to the ValueRecorder's distribution using the labels previously bound to the ValueRecorder via Bind(). Unbind calls SyncImpl.Unbind. func Float64ValueRecorder.Bind(labels ...label.KeyValue) (h BoundFloat64ValueRecorder)
BoundInt64Counter is a boundInstrument for Int64Counter. It inherits the Unbind function from syncBoundInstrument. Add adds the value to the counter's sum using the labels previously bound to this counter via Bind() Unbind calls SyncImpl.Unbind. func Int64Counter.Bind(labels ...label.KeyValue) (h BoundInt64Counter)
BoundInt64UpDownCounter is a boundInstrument for Int64UpDownCounter. It inherits the Unbind function from syncBoundInstrument. Add adds the value to the counter's sum using the labels previously bound to this counter via Bind() Unbind calls SyncImpl.Unbind. func Int64UpDownCounter.Bind(labels ...label.KeyValue) (h BoundInt64UpDownCounter)
BoundInt64ValueRecorder is a bound instrument for Int64ValueRecorder. It inherits the Unbind function from syncBoundInstrument. Record adds a new value to the ValueRecorder's distribution using the labels previously bound to the ValueRecorder via Bind(). Unbind calls SyncImpl.Unbind. func Int64ValueRecorder.Bind(labels ...label.KeyValue) (h BoundInt64ValueRecorder)
BoundSyncImpl is the implementation-level interface to a generic bound synchronous instrument RecordOne captures a single synchronous metric event. Unbind frees the resources associated with this bound instrument. It does not affect the metric this bound instrument was created through. func NoopSync.Bind([]label.KeyValue) BoundSyncImpl func SyncImpl.Bind(labels []label.KeyValue) BoundSyncImpl
Descriptor contains all the settings that describe an instrument, including its name, metric kind, number kind, and the configurable options. Description provides a human-readable description of the metric instrument. InstrumentationName returns the name of the library that provided instrumentation for this instrument. InstrumentationVersion returns the version of the library that provided instrumentation for this instrument. MetricKind returns the specific kind of instrument. Name returns the metric instrument's name. NumberKind returns whether this instrument is declared over int64, float64, or uint64 values. Unit describes the units of the metric instrument. Unitless metrics return the empty string. func NewDescriptor(name string, mkind Kind, nkind NumberKind, opts ...InstrumentOption) Descriptor func AsyncImpl.Descriptor() Descriptor func InstrumentImpl.Descriptor() Descriptor func SyncImpl.Descriptor() Descriptor func MeterImpl.NewAsyncInstrument(descriptor Descriptor, runner AsyncRunner) (AsyncImpl, error) func MeterImpl.NewSyncInstrument(descriptor Descriptor) (SyncImpl, error) func go.opentelemetry.io/otel/api/metric/registry.Compatible(candidate, existing Descriptor) bool func go.opentelemetry.io/otel/api/metric/registry.NewMetricKindMismatchError(desc Descriptor) error
Float64Counter is a metric that accumulates float64 values. Add adds the value to the counter's sum. The labels should contain the keys and values to be associated with this value. Bind creates a bound instrument for this counter. The labels are associated with values recorded via subsequent calls to Record. Measurement creates a Measurement object to use with batch recording. SyncImpl returns the implementation object for synchronous instruments. T : go.opentelemetry.io/otel/api/global/internal.SyncImpler func Meter.NewFloat64Counter(name string, options ...InstrumentOption) (Float64Counter, error) func MeterMust.NewFloat64Counter(name string, cos ...InstrumentOption) Float64Counter
Float64ObserverFunc is a type of callback that floating point observers run. AnyRunner implements AsyncRunner. Run implements AsyncSingleRunner. *T : AsyncRunner *T : AsyncSingleRunner func Meter.NewFloat64SumObserver(name string, callback Float64ObserverFunc, opts ...InstrumentOption) (Float64SumObserver, error) func Meter.NewFloat64UpDownSumObserver(name string, callback Float64ObserverFunc, opts ...InstrumentOption) (Float64UpDownSumObserver, error) func Meter.NewFloat64ValueObserver(name string, callback Float64ObserverFunc, opts ...InstrumentOption) (Float64ValueObserver, error) func MeterMust.NewFloat64SumObserver(name string, callback Float64ObserverFunc, oos ...InstrumentOption) Float64SumObserver func MeterMust.NewFloat64UpDownSumObserver(name string, callback Float64ObserverFunc, oos ...InstrumentOption) Float64UpDownSumObserver func MeterMust.NewFloat64ValueObserver(name string, callback Float64ObserverFunc, oos ...InstrumentOption) Float64ValueObserver
Float64ObserverResult is passed to an observer callback to capture observations for one asynchronous floating point metric instrument. Observe captures a single floating point value from the associated instrument callback, with the given labels.
Float64SumObserver is a metric that captures a precomputed sum of float64 values at a point in time. AsyncImpl implements AsyncImpl. Observation returns an Observation, a BatchObserverFunc argument, for an asynchronous integer instrument. This returns an implementation-level object for use by the SDK, users should not refer to this. T : go.opentelemetry.io/otel/api/global/internal.AsyncImpler func BatchObserver.NewFloat64SumObserver(name string, opts ...InstrumentOption) (Float64SumObserver, error) func BatchObserverMust.NewFloat64SumObserver(name string, oos ...InstrumentOption) Float64SumObserver func Meter.NewFloat64SumObserver(name string, callback Float64ObserverFunc, opts ...InstrumentOption) (Float64SumObserver, error) func MeterMust.NewFloat64SumObserver(name string, callback Float64ObserverFunc, oos ...InstrumentOption) Float64SumObserver
Float64UpDownCounter is a metric instrument that sums floating point values. Add adds the value to the counter's sum. The labels should contain the keys and values to be associated with this value. Bind creates a bound instrument for this counter. The labels are associated with values recorded via subsequent calls to Record. Measurement creates a Measurement object to use with batch recording. SyncImpl returns the implementation object for synchronous instruments. T : go.opentelemetry.io/otel/api/global/internal.SyncImpler func Meter.NewFloat64UpDownCounter(name string, options ...InstrumentOption) (Float64UpDownCounter, error) func MeterMust.NewFloat64UpDownCounter(name string, cos ...InstrumentOption) Float64UpDownCounter
Float64UpDownSumObserver is a metric that captures a precomputed sum of float64 values at a point in time. AsyncImpl implements AsyncImpl. Observation returns an Observation, a BatchObserverFunc argument, for an asynchronous integer instrument. This returns an implementation-level object for use by the SDK, users should not refer to this. T : go.opentelemetry.io/otel/api/global/internal.AsyncImpler func BatchObserver.NewFloat64UpDownSumObserver(name string, opts ...InstrumentOption) (Float64UpDownSumObserver, error) func BatchObserverMust.NewFloat64UpDownSumObserver(name string, oos ...InstrumentOption) Float64UpDownSumObserver func Meter.NewFloat64UpDownSumObserver(name string, callback Float64ObserverFunc, opts ...InstrumentOption) (Float64UpDownSumObserver, error) func MeterMust.NewFloat64UpDownSumObserver(name string, callback Float64ObserverFunc, oos ...InstrumentOption) Float64UpDownSumObserver
Float64ValueObserver is a metric that captures a set of float64 values at a point in time. AsyncImpl implements AsyncImpl. Observation returns an Observation, a BatchObserverFunc argument, for an asynchronous integer instrument. This returns an implementation-level object for use by the SDK, users should not refer to this. T : go.opentelemetry.io/otel/api/global/internal.AsyncImpler func BatchObserver.NewFloat64ValueObserver(name string, opts ...InstrumentOption) (Float64ValueObserver, error) func BatchObserverMust.NewFloat64ValueObserver(name string, oos ...InstrumentOption) Float64ValueObserver func Meter.NewFloat64ValueObserver(name string, callback Float64ObserverFunc, opts ...InstrumentOption) (Float64ValueObserver, error) func MeterMust.NewFloat64ValueObserver(name string, callback Float64ObserverFunc, oos ...InstrumentOption) Float64ValueObserver
Float64ValueRecorder is a metric that records float64 values. Bind creates a bound instrument for this ValueRecorder. The labels are associated with values recorded via subsequent calls to Record. Measurement creates a Measurement object to use with batch recording. Record adds a new value to the list of ValueRecorder's records. The labels should contain the keys and values to be associated with this value. SyncImpl returns the implementation object for synchronous instruments. T : go.opentelemetry.io/otel/api/global/internal.SyncImpler func Meter.NewFloat64ValueRecorder(name string, opts ...InstrumentOption) (Float64ValueRecorder, error) func MeterMust.NewFloat64ValueRecorder(name string, mos ...InstrumentOption) Float64ValueRecorder
InstrumentConfig contains options for instrument descriptors. Description describes the instrument in human-readable terms. InstrumentationName is the name of the library providing instrumentation. InstrumentationVersion is the version of the library providing instrumentation. Unit describes the measurement unit for a instrument. func ConfigureInstrument(opts []InstrumentOption) InstrumentConfig func InstrumentOption.ApplyInstrument(*InstrumentConfig) func Option.ApplyInstrument(*InstrumentConfig)
InstrumentImpl is a common interface for synchronous and asynchronous instruments. Descriptor returns a copy of the instrument's Descriptor. Implementation returns the underlying implementation of the instrument, which allows the implementation to gain access to its own representation especially from a `Measurement`. AsyncImpl (interface) NoopAsync NoopSync SyncImpl (interface) T : AsyncImpl
InstrumentOption is an interface for applying instrument options. ApplyMeter is used to set a InstrumentOption value of a InstrumentConfig. Option (interface) func WithDescription(desc string) InstrumentOption func WithInstrumentationName(name string) InstrumentOption func WithUnit(unit unit.Unit) InstrumentOption func ConfigureInstrument(opts []InstrumentOption) InstrumentConfig func NewDescriptor(name string, mkind Kind, nkind NumberKind, opts ...InstrumentOption) Descriptor func BatchObserver.NewFloat64SumObserver(name string, opts ...InstrumentOption) (Float64SumObserver, error) func BatchObserver.NewFloat64UpDownSumObserver(name string, opts ...InstrumentOption) (Float64UpDownSumObserver, error) func BatchObserver.NewFloat64ValueObserver(name string, opts ...InstrumentOption) (Float64ValueObserver, error) func BatchObserver.NewInt64SumObserver(name string, opts ...InstrumentOption) (Int64SumObserver, error) func BatchObserver.NewInt64UpDownSumObserver(name string, opts ...InstrumentOption) (Int64UpDownSumObserver, error) func BatchObserver.NewInt64ValueObserver(name string, opts ...InstrumentOption) (Int64ValueObserver, error) func BatchObserverMust.NewFloat64SumObserver(name string, oos ...InstrumentOption) Float64SumObserver func BatchObserverMust.NewFloat64UpDownSumObserver(name string, oos ...InstrumentOption) Float64UpDownSumObserver func BatchObserverMust.NewFloat64ValueObserver(name string, oos ...InstrumentOption) Float64ValueObserver func BatchObserverMust.NewInt64SumObserver(name string, oos ...InstrumentOption) Int64SumObserver func BatchObserverMust.NewInt64UpDownSumObserver(name string, oos ...InstrumentOption) Int64UpDownSumObserver func BatchObserverMust.NewInt64ValueObserver(name string, oos ...InstrumentOption) Int64ValueObserver func Meter.NewFloat64Counter(name string, options ...InstrumentOption) (Float64Counter, error) func Meter.NewFloat64SumObserver(name string, callback Float64ObserverFunc, opts ...InstrumentOption) (Float64SumObserver, error) func Meter.NewFloat64UpDownCounter(name string, options ...InstrumentOption) (Float64UpDownCounter, error) func Meter.NewFloat64UpDownSumObserver(name string, callback Float64ObserverFunc, opts ...InstrumentOption) (Float64UpDownSumObserver, error) func Meter.NewFloat64ValueObserver(name string, callback Float64ObserverFunc, opts ...InstrumentOption) (Float64ValueObserver, error) func Meter.NewFloat64ValueRecorder(name string, opts ...InstrumentOption) (Float64ValueRecorder, error) func Meter.NewInt64Counter(name string, options ...InstrumentOption) (Int64Counter, error) func Meter.NewInt64SumObserver(name string, callback Int64ObserverFunc, opts ...InstrumentOption) (Int64SumObserver, error) func Meter.NewInt64UpDownCounter(name string, options ...InstrumentOption) (Int64UpDownCounter, error) func Meter.NewInt64UpDownSumObserver(name string, callback Int64ObserverFunc, opts ...InstrumentOption) (Int64UpDownSumObserver, error) func Meter.NewInt64ValueObserver(name string, callback Int64ObserverFunc, opts ...InstrumentOption) (Int64ValueObserver, error) func Meter.NewInt64ValueRecorder(name string, opts ...InstrumentOption) (Int64ValueRecorder, error) func MeterMust.NewFloat64Counter(name string, cos ...InstrumentOption) Float64Counter func MeterMust.NewFloat64SumObserver(name string, callback Float64ObserverFunc, oos ...InstrumentOption) Float64SumObserver func MeterMust.NewFloat64UpDownCounter(name string, cos ...InstrumentOption) Float64UpDownCounter func MeterMust.NewFloat64UpDownSumObserver(name string, callback Float64ObserverFunc, oos ...InstrumentOption) Float64UpDownSumObserver func MeterMust.NewFloat64ValueObserver(name string, callback Float64ObserverFunc, oos ...InstrumentOption) Float64ValueObserver func MeterMust.NewFloat64ValueRecorder(name string, mos ...InstrumentOption) Float64ValueRecorder func MeterMust.NewInt64Counter(name string, cos ...InstrumentOption) Int64Counter func MeterMust.NewInt64SumObserver(name string, callback Int64ObserverFunc, oos ...InstrumentOption) Int64SumObserver func MeterMust.NewInt64UpDownCounter(name string, cos ...InstrumentOption) Int64UpDownCounter func MeterMust.NewInt64UpDownSumObserver(name string, callback Int64ObserverFunc, oos ...InstrumentOption) Int64UpDownSumObserver func MeterMust.NewInt64ValueObserver(name string, callback Int64ObserverFunc, oos ...InstrumentOption) Int64ValueObserver func MeterMust.NewInt64ValueRecorder(name string, mos ...InstrumentOption) Int64ValueRecorder
Int64Counter is a metric that accumulates int64 values. Add adds the value to the counter's sum. The labels should contain the keys and values to be associated with this value. Bind creates a bound instrument for this counter. The labels are associated with values recorded via subsequent calls to Record. Measurement creates a Measurement object to use with batch recording. SyncImpl returns the implementation object for synchronous instruments. T : go.opentelemetry.io/otel/api/global/internal.SyncImpler func Meter.NewInt64Counter(name string, options ...InstrumentOption) (Int64Counter, error) func MeterMust.NewInt64Counter(name string, cos ...InstrumentOption) Int64Counter var github.com/go-redis/redis/v8/internal.NewConnectionsCounter var github.com/go-redis/redis/v8/internal.WritesCounter
Int64ObserverFunc is a type of callback that integral observers run. AnyRunner implements AsyncRunner. Run implements AsyncSingleRunner. *T : AsyncRunner *T : AsyncSingleRunner func Meter.NewInt64SumObserver(name string, callback Int64ObserverFunc, opts ...InstrumentOption) (Int64SumObserver, error) func Meter.NewInt64UpDownSumObserver(name string, callback Int64ObserverFunc, opts ...InstrumentOption) (Int64UpDownSumObserver, error) func Meter.NewInt64ValueObserver(name string, callback Int64ObserverFunc, opts ...InstrumentOption) (Int64ValueObserver, error) func MeterMust.NewInt64SumObserver(name string, callback Int64ObserverFunc, oos ...InstrumentOption) Int64SumObserver func MeterMust.NewInt64UpDownSumObserver(name string, callback Int64ObserverFunc, oos ...InstrumentOption) Int64UpDownSumObserver func MeterMust.NewInt64ValueObserver(name string, callback Int64ObserverFunc, oos ...InstrumentOption) Int64ValueObserver
Int64ObserverResult is passed to an observer callback to capture observations for one asynchronous integer metric instrument. Observe captures a single integer value from the associated instrument callback, with the given labels.
Int64SumObserver is a metric that captures a precomputed sum of int64 values at a point in time. AsyncImpl implements AsyncImpl. Observation returns an Observation, a BatchObserverFunc argument, for an asynchronous integer instrument. This returns an implementation-level object for use by the SDK, users should not refer to this. T : go.opentelemetry.io/otel/api/global/internal.AsyncImpler func BatchObserver.NewInt64SumObserver(name string, opts ...InstrumentOption) (Int64SumObserver, error) func BatchObserverMust.NewInt64SumObserver(name string, oos ...InstrumentOption) Int64SumObserver func Meter.NewInt64SumObserver(name string, callback Int64ObserverFunc, opts ...InstrumentOption) (Int64SumObserver, error) func MeterMust.NewInt64SumObserver(name string, callback Int64ObserverFunc, oos ...InstrumentOption) Int64SumObserver
Int64UpDownCounter is a metric instrument that sums integer values. Add adds the value to the counter's sum. The labels should contain the keys and values to be associated with this value. Bind creates a bound instrument for this counter. The labels are associated with values recorded via subsequent calls to Record. Measurement creates a Measurement object to use with batch recording. SyncImpl returns the implementation object for synchronous instruments. T : go.opentelemetry.io/otel/api/global/internal.SyncImpler func Meter.NewInt64UpDownCounter(name string, options ...InstrumentOption) (Int64UpDownCounter, error) func MeterMust.NewInt64UpDownCounter(name string, cos ...InstrumentOption) Int64UpDownCounter
Int64UpDownSumObserver is a metric that captures a precomputed sum of int64 values at a point in time. AsyncImpl implements AsyncImpl. Observation returns an Observation, a BatchObserverFunc argument, for an asynchronous integer instrument. This returns an implementation-level object for use by the SDK, users should not refer to this. T : go.opentelemetry.io/otel/api/global/internal.AsyncImpler func BatchObserver.NewInt64UpDownSumObserver(name string, opts ...InstrumentOption) (Int64UpDownSumObserver, error) func BatchObserverMust.NewInt64UpDownSumObserver(name string, oos ...InstrumentOption) Int64UpDownSumObserver func Meter.NewInt64UpDownSumObserver(name string, callback Int64ObserverFunc, opts ...InstrumentOption) (Int64UpDownSumObserver, error) func MeterMust.NewInt64UpDownSumObserver(name string, callback Int64ObserverFunc, oos ...InstrumentOption) Int64UpDownSumObserver
Int64ValueObserver is a metric that captures a set of int64 values at a point in time. AsyncImpl implements AsyncImpl. Observation returns an Observation, a BatchObserverFunc argument, for an asynchronous integer instrument. This returns an implementation-level object for use by the SDK, users should not refer to this. T : go.opentelemetry.io/otel/api/global/internal.AsyncImpler func BatchObserver.NewInt64ValueObserver(name string, opts ...InstrumentOption) (Int64ValueObserver, error) func BatchObserverMust.NewInt64ValueObserver(name string, oos ...InstrumentOption) Int64ValueObserver func Meter.NewInt64ValueObserver(name string, callback Int64ObserverFunc, opts ...InstrumentOption) (Int64ValueObserver, error) func MeterMust.NewInt64ValueObserver(name string, callback Int64ObserverFunc, oos ...InstrumentOption) Int64ValueObserver
Int64ValueRecorder is a metric that records int64 values. Bind creates a bound instrument for this ValueRecorder. The labels are associated with values recorded via subsequent calls to Record. Measurement creates a Measurement object to use with batch recording. Record adds a new value to the ValueRecorder's distribution. The labels should contain the keys and values to be associated with this value. SyncImpl returns the implementation object for synchronous instruments. T : go.opentelemetry.io/otel/api/global/internal.SyncImpler func Meter.NewInt64ValueRecorder(name string, opts ...InstrumentOption) (Int64ValueRecorder, error) func MeterMust.NewInt64ValueRecorder(name string, mos ...InstrumentOption) Int64ValueRecorder
Kind describes the kind of instrument. Adding returns whether this kind of instrument adds its inputs (as opposed to Grouping). Asynchronous returns whether this is an asynchronous kind of instrument. Adding returns whether this kind of instrument groups its inputs (as opposed to Adding). Monotonic returns whether this kind of instrument exposes a non-decreasing sum. Cumulative returns whether this kind of instrument receives precomputed sums. ( T) String() string Synchronous returns whether this is a synchronous kind of instrument. T : expvar.Var T : fmt.Stringer func Descriptor.MetricKind() Kind func NewDescriptor(name string, mkind Kind, nkind NumberKind, opts ...InstrumentOption) Descriptor const CounterKind const SumObserverKind const UpDownCounterKind const UpDownSumObserverKind const ValueObserverKind const ValueRecorderKind
Measurement is used for reporting a synchronous batch of metric values. Instances of this type should be created by synchronous instruments (e.g., Int64Counter.Measurement()). Number returns a number recorded in this measurement. 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. T : go.opentelemetry.io/otel/api/global/internal.SyncImpler func Float64Counter.Measurement(value float64) Measurement func Float64UpDownCounter.Measurement(value float64) Measurement func Float64ValueRecorder.Measurement(value float64) Measurement func Int64Counter.Measurement(value int64) Measurement func Int64UpDownCounter.Measurement(value int64) Measurement func Int64ValueRecorder.Measurement(value int64) Measurement func Meter.RecordBatch(ctx context.Context, ls []label.KeyValue, ms ...Measurement) func MeterImpl.RecordBatch(context.Context, []label.KeyValue, ...Measurement)
Meter is the OpenTelemetry metric API, based on a `MeterImpl` implementation and the `Meter` library name. An uninitialized Meter is a no-op implementation. MeterImpl returns the underlying MeterImpl of this Meter. NewBatchObserver creates a new BatchObserver that supports making batches of observations for multiple instruments. NewFloat64Counter creates a new floating point Counter with the given name, customized with options. May return an error if the name is invalid (e.g., empty) or improperly registered (e.g., duplicate registration). NewFloat64SumObserver creates a new floating point SumObserver with the given name, running a given callback, and customized with options. May return an error if the name is invalid (e.g., empty) or improperly registered (e.g., duplicate registration). NewFloat64UpDownCounter creates a new floating point UpDownCounter with the given name, customized with options. May return an error if the name is invalid (e.g., empty) or improperly registered (e.g., duplicate registration). NewFloat64UpDownSumObserver creates a new floating point UpDownSumObserver with the given name, running a given callback, and customized with options. May return an error if the name is invalid (e.g., empty) or improperly registered (e.g., duplicate registration). NewFloat64ValueObserver creates a new floating point ValueObserver with the given name, running a given callback, and customized with options. May return an error if the name is invalid (e.g., empty) or improperly registered (e.g., duplicate registration). NewFloat64ValueRecorder creates a new floating point ValueRecorder with the given name, customized with options. May return an error if the name is invalid (e.g., empty) or improperly registered (e.g., duplicate registration). NewInt64Counter creates a new integer Counter instrument with the given name, customized with options. May return an error if the name is invalid (e.g., empty) or improperly registered (e.g., duplicate registration). NewInt64SumObserver creates a new integer SumObserver instrument with the given name, running a given callback, and customized with options. May return an error if the name is invalid (e.g., empty) or improperly registered (e.g., duplicate registration). NewInt64UpDownCounter creates a new integer UpDownCounter instrument with the given name, customized with options. May return an error if the name is invalid (e.g., empty) or improperly registered (e.g., duplicate registration). NewInt64UpDownSumObserver creates a new integer UpDownSumObserver instrument with the given name, running a given callback, and customized with options. May return an error if the name is invalid (e.g., empty) or improperly registered (e.g., duplicate registration). NewInt64ValueObserver creates a new integer ValueObserver instrument with the given name, running a given callback, and customized with options. May return an error if the name is invalid (e.g., empty) or improperly registered (e.g., duplicate registration). NewInt64ValueRecorder creates a new integer ValueRecorder instrument with the given name, customized with options. May return an error if the name is invalid (e.g., empty) or improperly registered (e.g., duplicate registration). RecordBatch atomically records a batch of measurements. func WrapMeterImpl(impl MeterImpl, instrumentatioName string, opts ...MeterOption) Meter func NoopProvider.Meter(_ string, _ ...MeterOption) Meter func Provider.Meter(instrumentationName string, opts ...MeterOption) Meter func go.opentelemetry.io/otel/api/metric/registry.(*Provider).Meter(instrumentationName string, opts ...MeterOption) Meter func go.opentelemetry.io/otel/api/global.Meter(instrumentationName string, opts ...MeterOption) Meter func Must(meter Meter) MeterMust
MeterConfig contains options for Meters. InstrumentationVersion is the version of the library providing instrumentation. func ConfigureMeter(opts []MeterOption) MeterConfig func MeterOption.ApplyMeter(*MeterConfig) func Option.ApplyMeter(*MeterConfig)
MeterImpl is the interface an SDK must implement to supply a Meter implementation. NewAsyncInstrument returns a newly constructed asynchronous instrument implementation or an error, should one occur. NewSyncInstrument returns a newly constructed synchronous instrument implementation or an error, should one occur. RecordBatch atomically records a batch of measurements. func Meter.MeterImpl() MeterImpl func go.opentelemetry.io/otel/api/metric/registry.NewUniqueInstrumentMeterImpl(impl MeterImpl) MeterImpl func WrapMeterImpl(impl MeterImpl, instrumentatioName string, opts ...MeterOption) Meter func go.opentelemetry.io/otel/api/metric/registry.NewProvider(impl MeterImpl) *registry.Provider func go.opentelemetry.io/otel/api/metric/registry.NewUniqueInstrumentMeterImpl(impl MeterImpl) MeterImpl
MeterMust is a wrapper for Meter interfaces that panics when any instrument constructor encounters an error. NewBatchObserver returns a wrapper around BatchObserver that panics when any instrument constructor returns an error. NewFloat64Counter calls `Meter.NewFloat64Counter` and returns the instrument, panicking if it encounters an error. NewFloat64SumObserver calls `Meter.NewFloat64SumObserver` and returns the instrument, panicking if it encounters an error. NewFloat64UpDownCounter calls `Meter.NewFloat64UpDownCounter` and returns the instrument, panicking if it encounters an error. NewFloat64UpDownSumObserver calls `Meter.NewFloat64UpDownSumObserver` and returns the instrument, panicking if it encounters an error. NewFloat64ValueObserver calls `Meter.NewFloat64ValueObserver` and returns the instrument, panicking if it encounters an error. NewFloat64ValueRecorder calls `Meter.NewFloat64ValueRecorder` and returns the instrument, panicking if it encounters an error. NewInt64Counter calls `Meter.NewInt64Counter` and returns the instrument, panicking if it encounters an error. NewInt64SumObserver calls `Meter.NewInt64SumObserver` and returns the instrument, panicking if it encounters an error. NewInt64UpDownCounter calls `Meter.NewInt64UpDownCounter` and returns the instrument, panicking if it encounters an error. NewInt64UpDownSumObserver calls `Meter.NewInt64UpDownSumObserver` and returns the instrument, panicking if it encounters an error. NewInt64ValueObserver calls `Meter.NewInt64ValueObserver` and returns the instrument, panicking if it encounters an error. NewInt64ValueRecorder calls `Meter.NewInt64ValueRecorder` and returns the instrument, panicking if it encounters an error. func Must(meter Meter) MeterMust
MeterOption is an interface for applying Meter options. ApplyMeter is used to set a MeterOption value of a MeterConfig. Option (interface) func ConfigureMeter(opts []MeterOption) MeterConfig func WrapMeterImpl(impl MeterImpl, instrumentatioName string, opts ...MeterOption) Meter func NoopProvider.Meter(_ string, _ ...MeterOption) Meter func Provider.Meter(instrumentationName string, opts ...MeterOption) Meter func go.opentelemetry.io/otel/api/metric/registry.(*Provider).Meter(instrumentationName string, opts ...MeterOption) Meter func go.opentelemetry.io/otel/api/global.Meter(instrumentationName string, opts ...MeterOption) Meter
( T) Descriptor() Descriptor ( T) Implementation() interface{} T : AsyncImpl T : InstrumentImpl
( T) Meter(_ string, _ ...MeterOption) Meter T : Provider
( T) Bind([]label.KeyValue) BoundSyncImpl ( T) Descriptor() Descriptor ( T) Implementation() interface{} ( T) RecordOne(context.Context, Number, []label.KeyValue) T : AsyncImpl T : InstrumentImpl T : SyncImpl
Number represents either an integral or a floating point value. It needs to be accompanied with a source of NumberKind that describes the actual type of the value stored within Number. AddFloat64 assumes that the number contains a float64 and adds the passed float64 to it. AddFloat64Atomic assumes that the number contains a float64 and adds the passed float64 to it atomically. AddInt64 assumes that the number contains an int64 and adds the passed int64 to it. AddInt64Atomic assumes that the number contains an int64 and adds the passed int64 to it atomically. AddNumber assumes that this and the passed number are of the passed kind and adds the passed number to this number. AddNumberAtomic assumes that this and the passed number are of the passed kind and adds the passed number to this number atomically. AddRaw assumes that this number and the passed raw value are of the passed kind and adds the passed raw value to this number. AddRawAtomic assumes that this number and the passed raw value are of the passed kind and adds the passed raw value to this number atomically. AsFloat64 assumes that the measurement value contains a float64 and returns it as such. AsFloat64Atomic assumes that the measurement value contains a float64 and returns it as such atomically. AsFloat64Ptr assumes that the number contains a float64 and returns a pointer to it. AsInt64 assumes that the value contains an int64 and returns it as such. AsInt64Atomic assumes that the number contains an int64 and returns it as such atomically. AsInt64Ptr assumes that the number contains an int64 and returns a pointer to it. AsInterface returns the number as an interface{}, typically used for NumberKind-correct JSON conversion. AsNumber gets the Number. AsNumberAtomic gets the Number atomically. AsRaw gets the uninterpreted raw value. Might be useful for some atomic operations. AsRawAtomic gets the uninterpreted raw value atomically. Might be useful for some atomic operations. AsRawPtr gets the pointer to the raw, uninterpreted raw value. Might be useful for some atomic operations. CoerceToFloat64 casts the number to float64. May result in data/precision loss. CoerceToInt64 casts the number to int64. May result in data/precision loss. CompareAndSwapFloat64 assumes that this number contains a float64 and does the atomic CAS operation on it. CompareAndSwapInt64 assumes that this number contains an int64 and does the atomic CAS operation on it. CompareAndSwapNumber does the atomic CAS operation on this number. This number and passed old and new numbers should be of the same kind. CompareAndSwapRaw does the atomic CAS operation on this number. This number and passed old and new raw values should be of the same kind. CompareFloat64 assumes that the Number contains a float64 and performs a comparison between the value and the other value. It returns the typical result of the compare function: -1 if the value is less than the other, 0 if both are equal, 1 if the value is greater than the other. Do not compare NaN values. CompareInt64 assumes that the Number contains an int64 and performs a comparison between the value and the other value. It returns the typical result of the compare function: -1 if the value is less than the other, 0 if both are equal, 1 if the value is greater than the other. CompareNumber compares two Numbers given their kind. Both numbers should have the same kind. This returns: 0 if the numbers are equal -1 if the subject `n` is less than the argument `nn` +1 if the subject `n` is greater than the argument `nn` CompareRaw compares two numbers, where one is input as a raw uint64, interpreting both values as a `kind` of number. Emit returns a string representation of the raw value of the Number. A %d is used for integral values, %f for floating point values. IsNegative returns true if the actual value is less than zero. IsPositive returns true if the actual value is greater than zero. IsZero returns true if the actual value is equal to zero. SetFloat64 assumes that the number contains a float64 and sets it to the passed value. SetFloat64Atomic assumes that the number contains a float64 and sets it to the passed value atomically. SetInt64 assumes that the number contains an int64 and sets it to the passed value. SetInt64Atomic assumes that the number contains an int64 and sets it to the passed value atomically. SetNumber sets the number to the passed number. Both should be of the same kind. SetNumberAtomic sets the number to the passed number atomically. Both should be of the same kind. SetRaw sets the number to the passed raw value. Both number and the raw number should represent the same kind. SetRawAtomic sets the number to the passed raw value atomically. Both number and the raw number should represent the same kind. SwapFloat64 assumes that the number contains an float64, sets it to the passed value and returns the old float64 value. SwapFloat64Atomic assumes that the number contains an float64, sets it to the passed value and returns the old float64 value atomically. SwapInt64 assumes that the number contains an int64, sets it to the passed value and returns the old int64 value. SwapInt64Atomic assumes that the number contains an int64, sets it to the passed value and returns the old int64 value atomically. SwapNumber sets the number to the passed number and returns the old number. Both this number and the passed number should be of the same kind. SwapNumberAtomic sets the number to the passed number and returns the old number atomically. Both this number and the passed number should be of the same kind. SwapRaw sets the number to the passed raw value and returns the old raw value. Both number and the raw number should represent the same kind. SwapRawAtomic sets the number to the passed raw value and returns the old raw value atomically. Both number and the raw number should represent the same kind. func NewFloat64Number(f float64) Number func NewInt64Number(i int64) Number func NewNumberFromRaw(r uint64) Number func NewNumberSignChange(kind NumberKind, nn Number) Number func Measurement.Number() Number func (*Number).AsNumber() Number func (*Number).AsNumberAtomic() Number func (*Number).SwapNumber(nn Number) Number func (*Number).SwapNumberAtomic(nn Number) Number func NumberKind.Maximum() Number func NumberKind.Minimum() Number func NumberKind.Zero() Number func Observation.Number() Number func NewNumberSignChange(kind NumberKind, nn Number) Number func BoundSyncImpl.RecordOne(ctx context.Context, number Number) func NoopSync.RecordOne(context.Context, Number, []label.KeyValue) func (*Number).AddNumber(kind NumberKind, nn Number) func (*Number).AddNumberAtomic(kind NumberKind, nn Number) func (*Number).CompareAndSwapNumber(on, nn Number) bool func (*Number).CompareNumber(kind NumberKind, nn Number) int func (*Number).SetNumber(nn Number) func (*Number).SetNumberAtomic(nn Number) func (*Number).SwapNumber(nn Number) Number func (*Number).SwapNumberAtomic(nn Number) Number func SyncImpl.RecordOne(ctx context.Context, number Number, labels []label.KeyValue)
NumberKind describes the data type of the Number. Maximum returns the maximum representable value for a given NumberKind Minimum returns the minimum representable value for a given NumberKind ( T) String() string Zero returns a zero value for a given NumberKind T : expvar.Var T : fmt.Stringer func Descriptor.NumberKind() NumberKind func NewDescriptor(name string, mkind Kind, nkind NumberKind, opts ...InstrumentOption) Descriptor func NewNumberSignChange(kind NumberKind, nn Number) Number func (*Number).AddNumber(kind NumberKind, nn Number) func (*Number).AddNumberAtomic(kind NumberKind, nn Number) func (*Number).AddRaw(kind NumberKind, r uint64) func (*Number).AddRawAtomic(kind NumberKind, r uint64) func (*Number).AsInterface(kind NumberKind) interface{} func (*Number).CoerceToFloat64(kind NumberKind) float64 func (*Number).CoerceToInt64(kind NumberKind) int64 func (*Number).CompareNumber(kind NumberKind, nn Number) int func (*Number).CompareRaw(kind NumberKind, r uint64) int func (*Number).Emit(kind NumberKind) string func (*Number).IsNegative(kind NumberKind) bool func (*Number).IsPositive(kind NumberKind) bool func (*Number).IsZero(kind NumberKind) bool const Float64NumberKind const Int64NumberKind
Observation is used for reporting an asynchronous batch of metric values. Instances of this type should be created by asynchronous instruments (e.g., Int64ValueObserver.Observation()). 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. Number returns a number recorded in this observation. T : go.opentelemetry.io/otel/api/global/internal.AsyncImpler func Float64SumObserver.Observation(v float64) Observation func Float64UpDownSumObserver.Observation(v float64) Observation func Float64ValueObserver.Observation(v float64) Observation func Int64SumObserver.Observation(v int64) Observation func Int64UpDownSumObserver.Observation(v int64) Observation func Int64ValueObserver.Observation(v int64) Observation func BatchObserverResult.Observe(labels []label.KeyValue, obs ...Observation)
Option is an interface for applying Instrument or Meter options. ApplyMeter is used to set a InstrumentOption value of a InstrumentConfig. ApplyMeter is used to set a MeterOption value of a MeterConfig. T : InstrumentOption T : MeterOption func WithInstrumentationVersion(version string) Option
Provider supports named Meter instances. Meter creates an implementation of the Meter interface. The instrumentationName must be the name of the library providing instrumentation. This name may be the same as the instrumented code only if that code provides built-in instrumentation. If the instrumentationName is empty, then a implementation defined default name will be used instead. NoopProvider *go.opentelemetry.io/otel/api/metric/registry.Provider func go.opentelemetry.io/otel/api/global.MeterProvider() Provider func go.opentelemetry.io/otel/api/global/internal.MeterProvider() Provider func go.opentelemetry.io/otel/api/global.SetMeterProvider(mp Provider) func go.opentelemetry.io/otel/api/global/internal.SetMeterProvider(mp Provider)
SyncImpl is the implementation-level interface to a generic synchronous instrument (e.g., ValueRecorder and Counter instruments). Bind creates an implementation-level bound instrument, binding a label set with this instrument implementation. Descriptor returns a copy of the instrument's Descriptor. Implementation returns the underlying implementation of the instrument, which allows the implementation to gain access to its own representation especially from a `Measurement`. RecordOne captures a single synchronous metric event. NoopSync T : AsyncImpl T : InstrumentImpl func Measurement.SyncImpl() SyncImpl func MeterImpl.NewSyncInstrument(descriptor Descriptor) (SyncImpl, error) func go.opentelemetry.io/otel/api/global/internal.SyncImpler.SyncImpl() SyncImpl
Package-Level Functions (total 32, in which 13 are exported)
ConfigureInstrument is a helper that applies all the InstrumentOptions to an InstrumentConfig.
ConfigureMeter is a helper that applies all the MeterOptions to a MeterConfig.
Must constructs a MeterMust implementation from a Meter, allowing the application to panic when any instrument constructor yields an error.
NewDescriptor returns a Descriptor with the given contents.
NewFloat64Number creates a floating point Number.
NewInt64Number creates an integral Number.
NewNumberFromRaw creates a new Number from a raw value.
NewNumberSignChange returns a number with the same magnitude and the opposite sign. `kind` must describe the kind of number in `nn`. Does not change Uint64NumberKind values.
WithDescription applies provided description.
WithInstrumentationName sets the instrumentation name.
WithInstrumentationVersion sets the instrumentation version.
WithUnit applies provided unit.
WrapMeterImpl constructs a `Meter` implementation from a `MeterImpl` implementation.
Package-Level Variables (total 3, in which 1 are exported)
ErrSDKReturnedNilImpl is returned when a new `MeterImpl` returns nil.
Package-Level Constants (total 10, in which 8 are exported)
CounterKind indicates a Counter instrument.
Float64NumberKind means that the Number stores float64.
Int64NumberKind means that the Number stores int64.
SumObserverKind indicates a SumObserver instrument.
UpDownCounterKind indicates a UpDownCounter instrument.
UpDownSumObserverKind indicates a UpDownSumObserver instrument.
ValueObserverKind indicates an ValueObserver instrument.
ValueRecorderKind indicates a ValueRecorder instrument.