2020-03-24 07:41:10 +02:00
|
|
|
// Copyright The OpenTelemetry Authors
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
2020-11-12 17:28:32 +02:00
|
|
|
package metric // import "go.opentelemetry.io/otel/metric"
|
2019-07-12 00:28:38 +02:00
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2020-08-18 05:25:03 +02:00
|
|
|
"go.opentelemetry.io/otel/label"
|
2020-11-11 17:24:12 +02:00
|
|
|
"go.opentelemetry.io/otel/metric/number"
|
2019-07-12 00:28:38 +02:00
|
|
|
)
|
|
|
|
|
2020-09-24 00:16:13 +02:00
|
|
|
type NoopMeterProvider struct{}
|
2020-03-11 20:57:57 +02:00
|
|
|
|
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
|
|
|
|
2020-09-24 00:16:13 +02:00
|
|
|
var _ MeterProvider = NoopMeterProvider{}
|
2020-03-19 21:02:46 +02:00
|
|
|
var _ SyncImpl = NoopSync{}
|
|
|
|
var _ BoundSyncImpl = noopBoundInstrument{}
|
|
|
|
var _ AsyncImpl = NoopAsync{}
|
2019-07-12 00:28:38 +02:00
|
|
|
|
2020-09-24 00:16:13 +02:00
|
|
|
func (NoopMeterProvider) Meter(_ string, _ ...MeterOption) Meter {
|
2020-05-12 05:29:06 +02:00
|
|
|
return Meter{}
|
2019-10-31 08:35:02 +02:00
|
|
|
}
|
|
|
|
|
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-11-11 17:24:12 +02:00
|
|
|
func (noopBoundInstrument) RecordOne(context.Context, number.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-08-18 05:25:03 +02:00
|
|
|
func (NoopSync) Bind([]label.KeyValue) BoundSyncImpl {
|
2020-03-19 21:02:46 +02:00
|
|
|
return noopBoundInstrument{}
|
2020-03-05 22:15:30 +02:00
|
|
|
}
|
|
|
|
|
2020-11-11 17:24:12 +02:00
|
|
|
func (NoopSync) RecordOne(context.Context, number.Number, []label.KeyValue) {
|
2020-03-05 22:15:30 +02:00
|
|
|
}
|