1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2024-12-12 10:04:29 +02:00
opentelemetry-go/api/metric/noop.go
Krzesimir Nowak 388d3248fe Some metrics followup (#177)
* prevent passing observer descriptors to NewHandle

* add some test for metrics

* reword some docs
2019-10-15 09:28:36 -07:00

43 lines
797 B
Go

package metric
import (
"context"
"go.opentelemetry.io/api/core"
)
type noopMeter struct{}
type noopHandle struct{}
type noopLabelSet struct{}
var _ Meter = noopMeter{}
var _ Handle = noopHandle{}
var _ LabelSet = noopLabelSet{}
func (noopHandle) RecordOne(context.Context, MeasurementValue) {
}
func (noopLabelSet) Meter() Meter {
return noopMeter{}
}
func (noopMeter) DefineLabels(context.Context, ...core.KeyValue) LabelSet {
return noopLabelSet{}
}
func (noopMeter) NewHandle(ExplicitReportingMetric, LabelSet) Handle {
return noopHandle{}
}
func (noopMeter) DeleteHandle(Handle) {
}
func (noopMeter) RecordBatch(context.Context, LabelSet, ...Measurement) {
}
func (noopMeter) RegisterObserver(Observer, ObserverCallback) {
}
func (noopMeter) UnregisterObserver(Observer) {
}