Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WrapMeterImpl ¶
WrapMeterImpl wraps impl to be a full implementation of a Meter.
Types ¶
type AsyncBatchRunner ¶
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 ¶
type AsyncImpl interface { InstrumentImpl instrument.Asynchronous // ObserveOne captures a single synchronous metric event. ObserveOne(ctx context.Context, n number.Number, attrs []attribute.KeyValue) }
AsyncImpl is an implementation-level interface to an asynchronous instrument (e.g., Observer instruments).
func NewNoopAsyncInstrument ¶
func NewNoopAsyncInstrument() AsyncImpl
NewNoopAsyncInstrument returns a No-op implementation of the asynchronous instrument interface.
type AsyncRunner ¶
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 ¶
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 ¶
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 ¶
func NewDescriptor(name string, ikind InstrumentKind, nkind number.Kind, description string, u unit.Unit) Descriptor
NewDescriptor returns a Descriptor with the given contents.
func (Descriptor) Description ¶
func (d Descriptor) Description() string
Description provides a human-readable description of the metric instrument.
func (Descriptor) InstrumentKind ¶
func (d Descriptor) InstrumentKind() InstrumentKind
InstrumentKind returns the specific kind of instrument.
func (Descriptor) Name ¶
func (d Descriptor) Name() string
Name returns the metric instrument's name.
func (Descriptor) NumberKind ¶
func (d Descriptor) NumberKind() number.Kind
NumberKind returns whether this instrument is declared over int64, float64, or uint64 values.
func (Descriptor) Unit ¶
func (d Descriptor) Unit() unit.Unit
Unit describes the units of the metric instrument. Unitless metrics return the empty string.
type InstrumentImpl ¶
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 ¶
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 ¶
func NewMeasurement(inst SyncImpl, n number.Number) Measurement
NewMeasurement constructs a single observation, a binding between an asynchronous instrument and a number.
func (Measurement) Number ¶
func (m Measurement) Number() number.Number
Number returns a number recorded in this measurement.
func (Measurement) SyncImpl ¶
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 ¶
type MeterImpl interface { // 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) (AsyncImpl, error) // Etc. RegisterCallback(insts []instrument.Asynchronous, callback func(context.Context)) error }
MeterImpl is the interface an SDK must implement to supply a Meter implementation.
func UnwrapMeterImpl ¶
UnwrapMeterImpl unwraps the Meter to its bare MeterImpl.
type Observation ¶
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 ¶
func NewObservation(inst AsyncImpl, n number.Number) Observation
NewObservation constructs a single observation, a binding between an asynchronous instrument and a number.
func (Observation) AsyncImpl ¶
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 ¶
func (m Observation) Number() number.Number
Number returns a number recorded in this observation.
type SyncImpl ¶
type SyncImpl interface { InstrumentImpl instrument.Synchronous // RecordOne captures a single synchronous metric event. RecordOne(ctx context.Context, n number.Number, attrs []attribute.KeyValue) }
SyncImpl is the implementation-level interface to a generic synchronous instrument (e.g., Histogram and Counter instruments).
func NewNoopSyncInstrument ¶
func NewNoopSyncInstrument() SyncImpl
NewNoopSyncInstrument returns a No-op implementation of the synchronous instrument interface.