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.

package metric

import (
	

	
)
The file is organized as follows: - Observation type - Three kinds of Observer callback (int64, float64, batch) - Three kinds of Observer result (int64, float64, batch) - Three kinds of Observe() function (int64, float64, batch) - Three kinds of AsyncRunner interface (abstract, single, batch) - Two kinds of Observer constructor (int64, float64) - Two kinds of Observation() function (int64, float64) - Various internals
Observation is used for reporting an asynchronous batch of metric values. Instances of this type should be created by asynchronous instruments (e.g., Int64ValueObserver.Observation()).
number needs to be aligned for 64-bit atomic operations.
Int64ObserverFunc is a type of callback that integral observers run.
Float64ObserverFunc is a type of callback that floating point observers run.
BatchObserverFunc is a callback argument for use with any Observer instrument that will be reported as a batch of observations.
Int64ObserverResult is passed to an observer callback to capture observations for one asynchronous integer metric instrument.
Float64ObserverResult is passed to an observer callback to capture observations for one asynchronous floating point metric instrument.
BatchObserverResult is passed to a batch observer callback to capture observations for multiple asynchronous instruments.
Observe captures a single integer value from the associated instrument callback, with the given labels.
func ( Int64ObserverResult) ( int64,  ...label.KeyValue) {
	.function(, Observation{
		instrument: .instrument,
		number:     NewInt64Number(),
	})
}
Observe captures a single floating point value from the associated instrument callback, with the given labels.
Observe captures a multiple observations from the associated batch instrument callback, with the given labels.
func ( BatchObserverResult) ( []label.KeyValue,  ...Observation) {
	.function(, ...)
}
AsyncRunner is expected to convert into an AsyncSingleRunner or an AsyncBatchRunner. SDKs will encounter an error if the AsyncRunner does not satisfy one of these interfaces.
AnyRunner() is a non-exported method with no functional use other than to make this a non-empty interface.
	AnyRunner()
}
AsyncSingleRunner is an interface implemented by single-observer callbacks.
Run accepts a single instrument and function for capturing observations of that instrument. Each call to the function receives one captured observation. (The function accepts multiple observations so the same implementation can be used for batch runners.)
	Run(ctx context.Context, single AsyncImpl, capture func([]label.KeyValue, ...Observation))

	AsyncRunner
}
AsyncBatchRunner is an interface implemented by batch-observer callbacks.
Run accepts a function for capturing observations of multiple instruments.
newInt64AsyncRunner returns a single-observer callback for integer Observer instruments.
newFloat64AsyncRunner returns a single-observer callback for floating point Observer instruments.
newBatchAsyncRunner returns a batch-observer callback use with multiple Observer instruments.
AnyRunner implements AsyncRunner.
AnyRunner implements AsyncRunner.
AnyRunner implements AsyncRunner.
Run implements AsyncSingleRunner.
func ( *Int64ObserverFunc) ( context.Context,  AsyncImpl,  func([]label.KeyValue, ...Observation)) {
	(*)(, Int64ObserverResult{
		instrument: ,
		function:   ,
	})
}
Run implements AsyncSingleRunner.
func ( *Float64ObserverFunc) ( context.Context,  AsyncImpl,  func([]label.KeyValue, ...Observation)) {
	(*)(, Float64ObserverResult{
		instrument: ,
		function:   ,
	})
}
Run implements AsyncBatchRunner.
func ( *BatchObserverFunc) ( context.Context,  func([]label.KeyValue, ...Observation)) {
	(*)(, BatchObserverResult{
		function: ,
	})
}
wrapInt64ValueObserverInstrument converts an AsyncImpl into Int64ValueObserver.
func ( AsyncImpl,  error) (Int64ValueObserver, error) {
	,  := checkNewAsync(, )
	return Int64ValueObserver{asyncInstrument: }, 
}
wrapFloat64ValueObserverInstrument converts an AsyncImpl into Float64ValueObserver.
func ( AsyncImpl,  error) (Float64ValueObserver, error) {
	,  := checkNewAsync(, )
	return Float64ValueObserver{asyncInstrument: }, 
}
wrapInt64SumObserverInstrument converts an AsyncImpl into Int64SumObserver.
func ( AsyncImpl,  error) (Int64SumObserver, error) {
	,  := checkNewAsync(, )
	return Int64SumObserver{asyncInstrument: }, 
}
wrapFloat64SumObserverInstrument converts an AsyncImpl into Float64SumObserver.
func ( AsyncImpl,  error) (Float64SumObserver, error) {
	,  := checkNewAsync(, )
	return Float64SumObserver{asyncInstrument: }, 
}
wrapInt64UpDownSumObserverInstrument converts an AsyncImpl into Int64UpDownSumObserver.
func ( AsyncImpl,  error) (Int64UpDownSumObserver, error) {
	,  := checkNewAsync(, )
	return Int64UpDownSumObserver{asyncInstrument: }, 
}
wrapFloat64UpDownSumObserverInstrument converts an AsyncImpl into Float64UpDownSumObserver.