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-12-28 02:30:19 +02:00
|
|
|
type noopBoundInstrument struct{}
|
2019-10-09 00:45:49 +02:00
|
|
|
type noopLabelSet struct{}
|
2019-10-23 08:29:24 +02:00
|
|
|
type noopInstrument struct{}
|
2020-03-05 22:15:30 +02:00
|
|
|
type noopInt64Observer struct{}
|
|
|
|
type noopFloat64Observer 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{}
|
2019-12-28 02:30:19 +02:00
|
|
|
var _ BoundInstrumentImpl = noopBoundInstrument{}
|
2019-10-09 00:45:49 +02:00
|
|
|
var _ LabelSet = noopLabelSet{}
|
2020-03-05 22:15:30 +02:00
|
|
|
var _ Int64Observer = noopInt64Observer{}
|
|
|
|
var _ Float64Observer = noopFloat64Observer{}
|
2019-07-12 00:28:38 +02:00
|
|
|
|
2019-11-26 19:54:05 +02:00
|
|
|
func (NoopProvider) Meter(name string) Meter {
|
2019-10-31 08:35:02 +02:00
|
|
|
return NoopMeter{}
|
|
|
|
}
|
|
|
|
|
2019-12-28 02:30:19 +02:00
|
|
|
func (noopBoundInstrument) RecordOne(context.Context, core.Number) {
|
2019-10-09 00:45:49 +02:00
|
|
|
}
|
|
|
|
|
2019-12-28 02:30:19 +02:00
|
|
|
func (noopBoundInstrument) Unbind() {
|
2019-10-23 08:29:24 +02:00
|
|
|
}
|
|
|
|
|
2019-12-28 02:30:19 +02:00
|
|
|
func (noopInstrument) Bind(LabelSet) BoundInstrumentImpl {
|
|
|
|
return noopBoundInstrument{}
|
2019-10-23 08:29:24 +02:00
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2020-03-05 22:15:30 +02:00
|
|
|
func (noopInt64Observer) Unregister() {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (noopFloat64Observer) Unregister() {
|
|
|
|
}
|
|
|
|
|
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) 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
|
|
|
}
|
2020-03-05 22:15:30 +02:00
|
|
|
|
|
|
|
func (NoopMeter) RegisterInt64Observer(name string, callback Int64ObserverCallback, oos ...ObserverOptionApplier) Int64Observer {
|
|
|
|
return noopInt64Observer{}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (NoopMeter) RegisterFloat64Observer(name string, callback Float64ObserverCallback, oos ...ObserverOptionApplier) Float64Observer {
|
|
|
|
return noopFloat64Observer{}
|
|
|
|
}
|