2020-03-23 22:41:10 -07: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 16:28:32 +01:00
|
|
|
package metric // import "go.opentelemetry.io/otel/metric"
|
2019-07-11 15:28:38 -07:00
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2021-02-18 12:59:37 -05:00
|
|
|
"go.opentelemetry.io/otel/attribute"
|
2020-11-11 16:24:12 +01:00
|
|
|
"go.opentelemetry.io/otel/metric/number"
|
2019-07-11 15:28:38 -07:00
|
|
|
)
|
|
|
|
|
2020-09-23 15:16:13 -07:00
|
|
|
type NoopMeterProvider struct{}
|
2020-03-11 11:57:57 -07:00
|
|
|
|
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
|
|
|
|
2020-09-23 15:16:13 -07:00
|
|
|
var _ MeterProvider = NoopMeterProvider{}
|
2020-03-19 12:02:46 -07:00
|
|
|
var _ SyncImpl = NoopSync{}
|
|
|
|
var _ BoundSyncImpl = noopBoundInstrument{}
|
|
|
|
var _ AsyncImpl = NoopAsync{}
|
2019-07-11 15:28:38 -07:00
|
|
|
|
2020-09-23 15:16:13 -07:00
|
|
|
func (NoopMeterProvider) Meter(_ string, _ ...MeterOption) Meter {
|
2020-05-11 20:29:06 -07:00
|
|
|
return Meter{}
|
2019-10-30 23:35:02 -07:00
|
|
|
}
|
|
|
|
|
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-11-11 16:24:12 +01:00
|
|
|
func (noopBoundInstrument) RecordOne(context.Context, number.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
|
|
|
}
|
|
|
|
|
2021-02-18 12:59:37 -05:00
|
|
|
func (NoopSync) Bind([]attribute.KeyValue) BoundSyncImpl {
|
2020-03-19 12:02:46 -07:00
|
|
|
return noopBoundInstrument{}
|
2020-03-05 12:15:30 -08:00
|
|
|
}
|
|
|
|
|
2021-02-18 12:59:37 -05:00
|
|
|
func (NoopSync) RecordOne(context.Context, number.Number, []attribute.KeyValue) {
|
2020-03-05 12:15:30 -08:00
|
|
|
}
|