2019-07-12 00:28:38 +02:00
|
|
|
package metric
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2019-11-01 20:40:29 +02:00
|
|
|
"go.opentelemetry.io/otel/api/core"
|
2019-07-12 00:28:38 +02:00
|
|
|
)
|
|
|
|
|
2019-10-31 08:35:02 +02:00
|
|
|
type NoopProvider struct{}
|
2019-10-30 21:59:34 +02:00
|
|
|
type NoopMeter struct{}
|
2019-10-09 00:45:49 +02:00
|
|
|
type noopHandle struct{}
|
|
|
|
type noopLabelSet struct{}
|
2019-10-23 08:29:24 +02:00
|
|
|
type noopInstrument struct{}
|
2019-07-12 00:28:38 +02:00
|
|
|
|
2019-10-31 08:35:02 +02:00
|
|
|
var _ Provider = NoopProvider{}
|
2019-10-30 21:59:34 +02:00
|
|
|
var _ Meter = NoopMeter{}
|
2019-10-29 22:27:22 +02:00
|
|
|
var _ InstrumentImpl = noopInstrument{}
|
|
|
|
var _ HandleImpl = noopHandle{}
|
2019-10-09 00:45:49 +02:00
|
|
|
var _ LabelSet = noopLabelSet{}
|
2019-07-12 00:28:38 +02:00
|
|
|
|
2019-10-31 08:35:02 +02:00
|
|
|
func (NoopProvider) GetMeter(name string) Meter {
|
|
|
|
return NoopMeter{}
|
|
|
|
}
|
|
|
|
|
2019-10-29 22:27:22 +02:00
|
|
|
func (noopHandle) RecordOne(context.Context, core.Number) {
|
2019-10-09 00:45:49 +02:00
|
|
|
}
|
|
|
|
|
2019-10-23 08:29:24 +02:00
|
|
|
func (noopHandle) Release() {
|
|
|
|
}
|
|
|
|
|
2019-10-29 22:27:22 +02:00
|
|
|
func (noopInstrument) AcquireHandle(LabelSet) HandleImpl {
|
2019-10-23 08:29:24 +02:00
|
|
|
return noopHandle{}
|
|
|
|
}
|
|
|
|
|
2019-10-29 22:27:22 +02:00
|
|
|
func (noopInstrument) RecordOne(context.Context, core.Number, LabelSet) {
|
2019-10-23 08:29:24 +02:00
|
|
|
}
|
|
|
|
|
2019-10-29 22:27:22 +02:00
|
|
|
func (noopInstrument) Meter() Meter {
|
2019-10-30 21:59:34 +02:00
|
|
|
return NoopMeter{}
|
2019-10-09 00:45:49 +02:00
|
|
|
}
|
|
|
|
|
2019-10-30 21:59:34 +02:00
|
|
|
func (NoopMeter) Labels(...core.KeyValue) LabelSet {
|
2019-10-09 00:45:49 +02:00
|
|
|
return noopLabelSet{}
|
|
|
|
}
|
2019-07-12 00:28:38 +02:00
|
|
|
|
2019-10-30 21:59:34 +02:00
|
|
|
func (NoopMeter) NewInt64Counter(name string, cos ...CounterOptionApplier) Int64Counter {
|
2019-10-23 08:29:24 +02:00
|
|
|
return WrapInt64CounterInstrument(noopInstrument{})
|
|
|
|
}
|
|
|
|
|
2019-10-30 21:59:34 +02:00
|
|
|
func (NoopMeter) NewFloat64Counter(name string, cos ...CounterOptionApplier) Float64Counter {
|
2019-10-23 08:29:24 +02:00
|
|
|
return WrapFloat64CounterInstrument(noopInstrument{})
|
|
|
|
}
|
|
|
|
|
2019-10-30 21:59:34 +02:00
|
|
|
func (NoopMeter) NewInt64Gauge(name string, gos ...GaugeOptionApplier) Int64Gauge {
|
2019-10-23 08:29:24 +02:00
|
|
|
return WrapInt64GaugeInstrument(noopInstrument{})
|
|
|
|
}
|
|
|
|
|
2019-10-30 21:59:34 +02:00
|
|
|
func (NoopMeter) NewFloat64Gauge(name string, gos ...GaugeOptionApplier) Float64Gauge {
|
2019-10-23 08:29:24 +02:00
|
|
|
return WrapFloat64GaugeInstrument(noopInstrument{})
|
|
|
|
}
|
|
|
|
|
2019-10-30 21:59:34 +02:00
|
|
|
func (NoopMeter) NewInt64Measure(name string, mos ...MeasureOptionApplier) Int64Measure {
|
2019-10-23 08:29:24 +02:00
|
|
|
return WrapInt64MeasureInstrument(noopInstrument{})
|
2019-10-09 00:45:49 +02:00
|
|
|
}
|
|
|
|
|
2019-10-30 21:59:34 +02:00
|
|
|
func (NoopMeter) NewFloat64Measure(name string, mos ...MeasureOptionApplier) Float64Measure {
|
2019-10-23 08:29:24 +02:00
|
|
|
return WrapFloat64MeasureInstrument(noopInstrument{})
|
2019-10-09 00:45:49 +02:00
|
|
|
}
|
|
|
|
|
2019-10-30 21:59:34 +02:00
|
|
|
func (NoopMeter) RecordBatch(context.Context, LabelSet, ...Measurement) {
|
2019-10-09 00:45:49 +02:00
|
|
|
}
|