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.
|
|
|
|
|
2019-07-11 15:28:38 -07:00
|
|
|
package metric
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2020-05-14 07:06:03 +08:00
|
|
|
"go.opentelemetry.io/otel/api/kv"
|
2019-07-11 15:28:38 -07:00
|
|
|
)
|
|
|
|
|
2019-10-30 23:35:02 -07:00
|
|
|
type NoopProvider 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
|
|
|
|
2019-10-30 23:35:02 -07:00
|
|
|
var _ Provider = NoopProvider{}
|
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
|
|
|
|
2019-11-27 01:54:05 +08:00
|
|
|
func (NoopProvider) Meter(name string) 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-05-11 14:44:42 +08:00
|
|
|
func (noopBoundInstrument) RecordOne(context.Context, 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
|
|
|
}
|
|
|
|
|
2020-05-14 07:06:03 +08:00
|
|
|
func (NoopSync) Bind([]kv.KeyValue) BoundSyncImpl {
|
2020-03-19 12:02:46 -07:00
|
|
|
return noopBoundInstrument{}
|
2020-03-05 12:15:30 -08:00
|
|
|
}
|
|
|
|
|
2020-05-14 07:06:03 +08:00
|
|
|
func (NoopSync) RecordOne(context.Context, Number, []kv.KeyValue) {
|
2020-03-05 12:15:30 -08:00
|
|
|
}
|