2019-07-11 15:28:38 -07:00
|
|
|
package metric
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2019-11-01 11:40:29 -07:00
|
|
|
"go.opentelemetry.io/otel/api/core"
|
2019-07-11 15:28:38 -07:00
|
|
|
)
|
|
|
|
|
2019-10-30 23:35:02 -07:00
|
|
|
type NoopProvider struct{}
|
2020-03-19 12:02:46 -07:00
|
|
|
type NoopMeter struct{}
|
2020-03-11 11:57:57 -07:00
|
|
|
|
2019-10-08 15:45:49 -07:00
|
|
|
type noopLabelSet struct{}
|
2019-10-23 08:29:24 +02:00
|
|
|
type noopInstrument struct{}
|
2020-03-19 12:02:46 -07:00
|
|
|
type noopBoundInstrument struct{}
|
|
|
|
type NoopSync struct{ noopInstrument }
|
|
|
|
type NoopAsync struct{ noopInstrument }
|
2019-07-11 15:28:38 -07:00
|
|
|
|
2019-10-30 23:35:02 -07:00
|
|
|
var _ Provider = NoopProvider{}
|
2019-10-30 20:59:34 +01:00
|
|
|
var _ Meter = NoopMeter{}
|
2020-03-19 12:02:46 -07:00
|
|
|
var _ SyncImpl = NoopSync{}
|
|
|
|
var _ BoundSyncImpl = noopBoundInstrument{}
|
2019-10-08 15:45:49 -07:00
|
|
|
var _ LabelSet = noopLabelSet{}
|
2020-03-19 12:02:46 -07:00
|
|
|
var _ AsyncImpl = NoopAsync{}
|
2019-07-11 15:28:38 -07:00
|
|
|
|
2019-11-27 01:54:05 +08:00
|
|
|
func (NoopProvider) Meter(name string) Meter {
|
2019-10-30 23:35:02 -07:00
|
|
|
return NoopMeter{}
|
|
|
|
}
|
|
|
|
|
2020-03-19 12:02:46 -07:00
|
|
|
func (noopInstrument) Implementation() interface{} {
|
|
|
|
return nil
|
2019-10-08 15:45:49 -07:00
|
|
|
}
|
|
|
|
|
2020-03-19 12:02:46 -07:00
|
|
|
func (noopInstrument) Descriptor() Descriptor {
|
|
|
|
return Descriptor{}
|
2019-10-23 08:29:24 +02:00
|
|
|
}
|
|
|
|
|
2020-03-19 12:02:46 -07:00
|
|
|
func (noopBoundInstrument) RecordOne(context.Context, core.Number) {
|
2019-10-23 08:29:24 +02:00
|
|
|
}
|
|
|
|
|
2020-03-19 12:02:46 -07:00
|
|
|
func (noopBoundInstrument) Unbind() {
|
2019-10-08 15:45:49 -07:00
|
|
|
}
|
|
|
|
|
2020-03-19 12:02:46 -07:00
|
|
|
func (NoopSync) Bind(LabelSet) BoundSyncImpl {
|
|
|
|
return noopBoundInstrument{}
|
2020-03-05 12:15:30 -08:00
|
|
|
}
|
|
|
|
|
2020-03-19 12:02:46 -07:00
|
|
|
func (NoopSync) RecordOne(context.Context, core.Number, LabelSet) {
|
2020-03-05 12:15:30 -08:00
|
|
|
}
|
|
|
|
|
2019-10-30 20:59:34 +01:00
|
|
|
func (NoopMeter) Labels(...core.KeyValue) LabelSet {
|
2019-10-08 15:45:49 -07:00
|
|
|
return noopLabelSet{}
|
|
|
|
}
|
2019-07-11 15:28:38 -07:00
|
|
|
|
2020-03-11 11:57:57 -07:00
|
|
|
func (NoopMeter) RecordBatch(context.Context, LabelSet, ...Measurement) {
|
2019-10-23 08:29:24 +02:00
|
|
|
}
|
|
|
|
|
2020-03-19 12:02:46 -07:00
|
|
|
func (NoopMeter) NewInt64Counter(string, ...Option) (Int64Counter, error) {
|
|
|
|
return Int64Counter{syncInstrument{NoopSync{}}}, nil
|
2019-10-23 08:29:24 +02:00
|
|
|
}
|
|
|
|
|
2020-03-19 12:02:46 -07:00
|
|
|
func (NoopMeter) NewFloat64Counter(string, ...Option) (Float64Counter, error) {
|
|
|
|
return Float64Counter{syncInstrument{NoopSync{}}}, nil
|
2019-10-08 15:45:49 -07:00
|
|
|
}
|
|
|
|
|
2020-03-19 12:02:46 -07:00
|
|
|
func (NoopMeter) NewInt64Measure(string, ...Option) (Int64Measure, error) {
|
|
|
|
return Int64Measure{syncInstrument{NoopSync{}}}, nil
|
2019-10-08 15:45:49 -07:00
|
|
|
}
|
|
|
|
|
2020-03-19 12:02:46 -07:00
|
|
|
func (NoopMeter) NewFloat64Measure(string, ...Option) (Float64Measure, error) {
|
|
|
|
return Float64Measure{syncInstrument{NoopSync{}}}, nil
|
2019-10-08 15:45:49 -07:00
|
|
|
}
|
2020-03-05 12:15:30 -08:00
|
|
|
|
2020-03-19 12:02:46 -07:00
|
|
|
func (NoopMeter) RegisterInt64Observer(string, Int64ObserverCallback, ...Option) (Int64Observer, error) {
|
|
|
|
return Int64Observer{asyncInstrument{NoopAsync{}}}, nil
|
2020-03-05 12:15:30 -08:00
|
|
|
}
|
|
|
|
|
2020-03-19 12:02:46 -07:00
|
|
|
func (NoopMeter) RegisterFloat64Observer(string, Float64ObserverCallback, ...Option) (Float64Observer, error) {
|
|
|
|
return Float64Observer{asyncInstrument{NoopAsync{}}}, nil
|
2020-03-05 12:15:30 -08:00
|
|
|
}
|