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{}
|
2020-03-19 21:02:46 +02:00
|
|
|
type NoopMeter struct{}
|
2020-03-11 20:57:57 +02:00
|
|
|
|
2019-10-09 00:45:49 +02:00
|
|
|
type noopLabelSet struct{}
|
2019-10-23 08:29:24 +02:00
|
|
|
type noopInstrument struct{}
|
2020-03-19 21:02:46 +02:00
|
|
|
type noopBoundInstrument struct{}
|
|
|
|
type NoopSync struct{ noopInstrument }
|
|
|
|
type NoopAsync struct{ noopInstrument }
|
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{}
|
2020-03-19 21:02:46 +02:00
|
|
|
var _ SyncImpl = NoopSync{}
|
|
|
|
var _ BoundSyncImpl = noopBoundInstrument{}
|
2019-10-09 00:45:49 +02:00
|
|
|
var _ LabelSet = noopLabelSet{}
|
2020-03-19 21:02:46 +02:00
|
|
|
var _ AsyncImpl = NoopAsync{}
|
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{}
|
|
|
|
}
|
|
|
|
|
2020-03-19 21:02:46 +02:00
|
|
|
func (noopInstrument) Implementation() interface{} {
|
|
|
|
return nil
|
2019-10-09 00:45:49 +02:00
|
|
|
}
|
|
|
|
|
2020-03-19 21:02:46 +02:00
|
|
|
func (noopInstrument) Descriptor() Descriptor {
|
|
|
|
return Descriptor{}
|
2019-10-23 08:29:24 +02:00
|
|
|
}
|
|
|
|
|
2020-03-19 21:02:46 +02:00
|
|
|
func (noopBoundInstrument) RecordOne(context.Context, core.Number) {
|
2019-10-23 08:29:24 +02:00
|
|
|
}
|
|
|
|
|
2020-03-19 21:02:46 +02:00
|
|
|
func (noopBoundInstrument) Unbind() {
|
2019-10-09 00:45:49 +02:00
|
|
|
}
|
|
|
|
|
2020-03-19 21:02:46 +02:00
|
|
|
func (NoopSync) Bind(LabelSet) BoundSyncImpl {
|
|
|
|
return noopBoundInstrument{}
|
2020-03-05 22:15:30 +02:00
|
|
|
}
|
|
|
|
|
2020-03-19 21:02:46 +02:00
|
|
|
func (NoopSync) RecordOne(context.Context, core.Number, LabelSet) {
|
2020-03-05 22:15:30 +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
|
|
|
|
2020-03-11 20:57:57 +02:00
|
|
|
func (NoopMeter) RecordBatch(context.Context, LabelSet, ...Measurement) {
|
2019-10-23 08:29:24 +02:00
|
|
|
}
|
|
|
|
|
2020-03-19 21:02:46 +02:00
|
|
|
func (NoopMeter) NewInt64Counter(string, ...Option) (Int64Counter, error) {
|
|
|
|
return Int64Counter{syncInstrument{NoopSync{}}}, nil
|
2019-10-23 08:29:24 +02:00
|
|
|
}
|
|
|
|
|
2020-03-19 21:02:46 +02:00
|
|
|
func (NoopMeter) NewFloat64Counter(string, ...Option) (Float64Counter, error) {
|
|
|
|
return Float64Counter{syncInstrument{NoopSync{}}}, nil
|
2019-10-09 00:45:49 +02:00
|
|
|
}
|
|
|
|
|
2020-03-19 21:02:46 +02:00
|
|
|
func (NoopMeter) NewInt64Measure(string, ...Option) (Int64Measure, error) {
|
|
|
|
return Int64Measure{syncInstrument{NoopSync{}}}, nil
|
2019-10-09 00:45:49 +02:00
|
|
|
}
|
|
|
|
|
2020-03-19 21:02:46 +02:00
|
|
|
func (NoopMeter) NewFloat64Measure(string, ...Option) (Float64Measure, error) {
|
|
|
|
return Float64Measure{syncInstrument{NoopSync{}}}, nil
|
2019-10-09 00:45:49 +02:00
|
|
|
}
|
2020-03-05 22:15:30 +02:00
|
|
|
|
2020-03-19 21:02:46 +02:00
|
|
|
func (NoopMeter) RegisterInt64Observer(string, Int64ObserverCallback, ...Option) (Int64Observer, error) {
|
|
|
|
return Int64Observer{asyncInstrument{NoopAsync{}}}, nil
|
2020-03-05 22:15:30 +02:00
|
|
|
}
|
|
|
|
|
2020-03-19 21:02:46 +02:00
|
|
|
func (NoopMeter) RegisterFloat64Observer(string, Float64ObserverCallback, ...Option) (Float64Observer, error) {
|
|
|
|
return Float64Observer{asyncInstrument{NoopAsync{}}}, nil
|
2020-03-05 22:15:30 +02:00
|
|
|
}
|