package metrictest
import "go.opentelemetry.io/otel/metric/metrictest"
Index ¶
- func LabelsToMap(kvs ...attribute.KeyValue) map[attribute.Key]attribute.Value
- func ResolveNumberByKind(t *testing.T, kind number.Kind, value float64) number.Number
- type Async
- type Batch
- type Handle
- type Instrument
- type Measured
- type Measurement
- type MeterImpl
- func NewMeter() (*MeterImpl, metric.Meter)
- func NewMeterProvider() (*MeterImpl, metric.MeterProvider)
- 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, measurements ...metric.Measurement)
- func (m *MeterImpl) RunAsyncInstruments()
- type Sync
Functions ¶
func LabelsToMap ¶
LabelsToMap converts label set to keyValue map, to be easily used in tests
func ResolveNumberByKind ¶
ResolveNumberByKind takes defined metric descriptor creates a concrete typed metric number
Types ¶
type Async ¶
type Async struct { Instrument // contains filtered or unexported fields }
func (*Async) Implementation ¶
func (a *Async) Implementation() interface{}
type Batch ¶
type Batch struct { // Measurement needs to be aligned for 64-bit atomic operations. Measurements []Measurement Ctx context.Context Labels []attribute.KeyValue LibraryName string }
type Handle ¶
func (*Handle) RecordOne ¶
func (*Handle) Unbind ¶
func (h *Handle) Unbind()
type Instrument ¶
type Instrument struct {
// contains filtered or unexported fields
}
func (Instrument) Descriptor ¶
func (i Instrument) Descriptor() metric.Descriptor
type Measured ¶
type Measured struct { Name string InstrumentationName string InstrumentationVersion string Labels map[attribute.Key]attribute.Value Number number.Number }
Measured is the helper struct which provides flat representation of recorded measurements to simplify testing
func AsStructs ¶
AsStructs converts recorded batches to array of flat, readable Measured helper structures
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 { MeasurementBatches []Batch // contains filtered or unexported fields }
MeterImpl is an OpenTelemetry Meter implementation used for testing.
func NewMeter ¶
func NewMeterProvider ¶
func NewMeterProvider() (*MeterImpl, metric.MeterProvider)
func (*MeterImpl) CollectAsync ¶
func (m *MeterImpl) CollectAsync(labels []attribute.KeyValue, obs ...metric.Observation)
func (*MeterImpl) NewAsyncInstrument ¶
func (m *MeterImpl) NewAsyncInstrument(descriptor metric.Descriptor, runner metric.AsyncRunner) (metric.AsyncImpl, error)
func (*MeterImpl) NewSyncInstrument ¶
func (*MeterImpl) RecordBatch ¶
func (m *MeterImpl) RecordBatch(ctx context.Context, labels []attribute.KeyValue, measurements ...metric.Measurement)
func (*MeterImpl) RunAsyncInstruments ¶
func (m *MeterImpl) RunAsyncInstruments()
type Sync ¶
type Sync struct { Instrument }
func (*Sync) Bind ¶
func (s *Sync) Bind(labels []attribute.KeyValue) metric.BoundSyncImpl
func (*Sync) Implementation ¶
func (s *Sync) Implementation() interface{}
func (*Sync) RecordOne ¶
Source Files ¶
meter.go
- Version
- v0.22.0
- Published
- Jul 19, 2021
- Platform
- darwin/amd64
- Imports
- 8 packages
- Last checked
- 14 minutes ago –
Tools for package owners.