Documentation ¶
Index ¶
- func LabelsToMap(kvs ...attribute.KeyValue) map[attribute.Key]attribute.Value
- func NewDescriptor(name string, ikind sdkapi.InstrumentKind, nkind number.Kind, ...) metric.Descriptor
- func ResolveNumberByKind(t *testing.T, kind number.Kind, value float64) number.Number
- type Async
- type Batch
- type Handle
- type Instrument
- type Library
- type Measured
- type Measurement
- type MeterImpl
- func (m *MeterImpl) CollectAsync(labels []attribute.KeyValue, obs ...metric.Observation)
- func (m *MeterImpl) NewAsyncInstrument(descriptor metric.Descriptor, runner metric.AsyncRunner) (metric.AsyncImpl, error)
- func (m *MeterImpl) NewSyncInstrument(descriptor metric.Descriptor) (metric.SyncImpl, error)
- func (m *MeterImpl) RecordBatch(ctx context.Context, labels []attribute.KeyValue, ...)
- type MeterProvider
- type Sync
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LabelsToMap ¶
LabelsToMap converts label set to keyValue map, to be easily used in tests
func NewDescriptor ¶ added in v0.24.0
func NewDescriptor(name string, ikind sdkapi.InstrumentKind, nkind number.Kind, opts ...metric.InstrumentOption) metric.Descriptor
NewDescriptor is a test helper for constructing test metric descriptors using standard options.
Types ¶
type Async ¶
type Async struct { Instrument // contains filtered or unexported fields }
func (*Async) Implementation ¶
func (a *Async) Implementation() interface{}
type Instrument ¶
type Instrument struct {
// contains filtered or unexported fields
}
func (Instrument) Descriptor ¶
func (i Instrument) Descriptor() metric.Descriptor
type Library ¶ added in v0.24.0
Library is the same as "sdk/instrumentation".Library but there is a package cycle to use it.
type Measured ¶
type Measured struct { Name string Labels map[attribute.Key]attribute.Value Number number.Number Library Library }
Measured is the helper struct which provides flat representation of recorded measurements to simplify testing
type Measurement ¶
type Measurement struct { // Number needs to be aligned for 64-bit atomic operations. Number number.Number Instrument metric.InstrumentImpl }
type MeterImpl ¶
type MeterImpl struct {
// contains filtered or unexported fields
}
MeterImpl is an OpenTelemetry Meter implementation used for testing.
func (*MeterImpl) CollectAsync ¶
func (m *MeterImpl) CollectAsync(labels []attribute.KeyValue, obs ...metric.Observation)
CollectAsync is called from asyncInstruments.Run() with the lock held.
func (*MeterImpl) NewAsyncInstrument ¶
func (m *MeterImpl) NewAsyncInstrument(descriptor metric.Descriptor, runner metric.AsyncRunner) (metric.AsyncImpl, error)
NewAsyncInstrument implements metric.MeterImpl.
func (*MeterImpl) NewSyncInstrument ¶
NewSyncInstrument implements metric.MeterImpl.
func (*MeterImpl) RecordBatch ¶
func (m *MeterImpl) RecordBatch(ctx context.Context, labels []attribute.KeyValue, measurements ...metric.Measurement)
RecordBatch implements metric.MeterImpl.
type MeterProvider ¶ added in v0.24.0
type MeterProvider struct { MeasurementBatches []Batch // contains filtered or unexported fields }
MeterProvider is a collection of named MeterImpls used for testing.
func NewMeterProvider ¶
func NewMeterProvider() *MeterProvider
NewMeterProvider returns a MeterProvider suitable for testing. When the test is complete, consult MeterProvider.MeasurementBatches.
func (*MeterProvider) Meter ¶ added in v0.24.0
func (p *MeterProvider) Meter(name string, opts ...metric.MeterOption) metric.Meter
Meter implements metric.MeterProvider.
func (*MeterProvider) RunAsyncInstruments ¶ added in v0.24.0
func (p *MeterProvider) RunAsyncInstruments()
RunAsyncInstruments is used in tests to trigger collection from asynchronous instruments.
type Sync ¶
type Sync struct {
Instrument
}
func (*Sync) Implementation ¶
func (s *Sync) Implementation() interface{}