1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2024-12-14 10:13:10 +02:00
opentelemetry-go/api/metric/noop.go
Joshua MacDonald 9674c81cb7
Drop the gauge instrument (#537)
* drop gauge instrument

* Restore the benchmark and stress test for lastvalue aggregator, but remove monotonic last-value support

* Rename gauge->lastvalue and remove remaining uses of the word 'gauge'

Co-authored-by: Krzesimir Nowak <krzesimir@kinvolk.io>
2020-03-10 16:00:37 -07:00

82 lines
2.1 KiB
Go

package metric
import (
"context"
"go.opentelemetry.io/otel/api/core"
)
type NoopProvider struct{}
type NoopMeter struct{}
type noopBoundInstrument struct{}
type noopLabelSet struct{}
type noopInstrument struct{}
type noopInt64Observer struct{}
type noopFloat64Observer struct{}
var _ Provider = NoopProvider{}
var _ Meter = NoopMeter{}
var _ InstrumentImpl = noopInstrument{}
var _ BoundInstrumentImpl = noopBoundInstrument{}
var _ LabelSet = noopLabelSet{}
var _ Int64Observer = noopInt64Observer{}
var _ Float64Observer = noopFloat64Observer{}
func (NoopProvider) Meter(name string) Meter {
return NoopMeter{}
}
func (noopBoundInstrument) RecordOne(context.Context, core.Number) {
}
func (noopBoundInstrument) Unbind() {
}
func (noopInstrument) Bind(LabelSet) BoundInstrumentImpl {
return noopBoundInstrument{}
}
func (noopInstrument) RecordOne(context.Context, core.Number, LabelSet) {
}
func (noopInstrument) Meter() Meter {
return NoopMeter{}
}
func (noopInt64Observer) Unregister() {
}
func (noopFloat64Observer) Unregister() {
}
func (NoopMeter) Labels(...core.KeyValue) LabelSet {
return noopLabelSet{}
}
func (NoopMeter) NewInt64Counter(name string, cos ...CounterOptionApplier) Int64Counter {
return WrapInt64CounterInstrument(noopInstrument{})
}
func (NoopMeter) NewFloat64Counter(name string, cos ...CounterOptionApplier) Float64Counter {
return WrapFloat64CounterInstrument(noopInstrument{})
}
func (NoopMeter) NewInt64Measure(name string, mos ...MeasureOptionApplier) Int64Measure {
return WrapInt64MeasureInstrument(noopInstrument{})
}
func (NoopMeter) NewFloat64Measure(name string, mos ...MeasureOptionApplier) Float64Measure {
return WrapFloat64MeasureInstrument(noopInstrument{})
}
func (NoopMeter) RecordBatch(context.Context, LabelSet, ...Measurement) {
}
func (NoopMeter) RegisterInt64Observer(name string, callback Int64ObserverCallback, oos ...ObserverOptionApplier) Int64Observer {
return noopInt64Observer{}
}
func (NoopMeter) RegisterFloat64Observer(name string, callback Float64ObserverCallback, oos ...ObserverOptionApplier) Float64Observer {
return noopFloat64Observer{}
}