mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-04-13 11:30:31 +02:00
Fixes the instrument kind for noop async instruments (#2461)
* Fixes the instrument kind for noop async instruments Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com> * Update CHANGELOG.md Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
This commit is contained in:
parent
49987ad852
commit
4aedc1cdaf
@ -14,6 +14,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||
- Import path changed `import "go.opentelemetry.io/otel/sdk/export/metric"` to `import go.opentelemetry.io/otel/sdk/metric/export` (#2382).
|
||||
- Deprecate `AtomicFieldOffsets`, unnecessary public func (#2445)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixes the instrument kind for noop async instruments. (#2461)
|
||||
|
||||
## [1.3.0] - 2021-12-10
|
||||
|
||||
### ⚠️ Notice ⚠️
|
||||
|
@ -21,7 +21,9 @@ import (
|
||||
"go.opentelemetry.io/otel/metric/number"
|
||||
)
|
||||
|
||||
type noopInstrument struct{}
|
||||
type noopInstrument struct {
|
||||
descriptor Descriptor
|
||||
}
|
||||
type noopSyncInstrument struct{ noopInstrument }
|
||||
type noopAsyncInstrument struct{ noopInstrument }
|
||||
|
||||
@ -31,21 +33,33 @@ var _ AsyncImpl = noopAsyncInstrument{}
|
||||
// NewNoopSyncInstrument returns a No-op implementation of the
|
||||
// synchronous instrument interface.
|
||||
func NewNoopSyncInstrument() SyncImpl {
|
||||
return noopSyncInstrument{}
|
||||
return noopSyncInstrument{
|
||||
noopInstrument{
|
||||
descriptor: Descriptor{
|
||||
instrumentKind: CounterInstrumentKind,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// NewNoopAsyncInstrument returns a No-op implementation of the
|
||||
// asynchronous instrument interface.
|
||||
func NewNoopAsyncInstrument() AsyncImpl {
|
||||
return noopAsyncInstrument{}
|
||||
return noopAsyncInstrument{
|
||||
noopInstrument{
|
||||
descriptor: Descriptor{
|
||||
instrumentKind: CounterObserverInstrumentKind,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (noopInstrument) Implementation() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (noopInstrument) Descriptor() Descriptor {
|
||||
return Descriptor{}
|
||||
func (n noopInstrument) Descriptor() Descriptor {
|
||||
return n.descriptor
|
||||
}
|
||||
|
||||
func (noopSyncInstrument) RecordOne(context.Context, number.Number, []attribute.KeyValue) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user