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 dd781560d4
Rename handle to bound instrument (@sircelsius) (#400)
* Rename metric Handle to Bound Instrument

* Rename metric Handle to Bound Instrument

* Rename metric Handle to Bound Instrument

* chore(meter): renamed from *BoundInstrument to Bound*, renamed AcquireBoundInstrument to Bind

* chore(meter): renamed Release to Unbind

* Self feedback in doc.go

* Rename confusing method name

Co-authored-by: Marc Bramaud <sircelsius@users.noreply.github.com>
2019-12-27 16:30:19 -08:00

72 lines
1.8 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{}
var _ Provider = NoopProvider{}
var _ Meter = NoopMeter{}
var _ InstrumentImpl = noopInstrument{}
var _ BoundInstrumentImpl = noopBoundInstrument{}
var _ LabelSet = noopLabelSet{}
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 (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) NewInt64Gauge(name string, gos ...GaugeOptionApplier) Int64Gauge {
return WrapInt64GaugeInstrument(noopInstrument{})
}
func (NoopMeter) NewFloat64Gauge(name string, gos ...GaugeOptionApplier) Float64Gauge {
return WrapFloat64GaugeInstrument(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) {
}