mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-21 18:58:03 +08:00
vendor: update buildkit to 2f99651
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
332
vendor/go.opentelemetry.io/otel/metric/metric_instrument.go
generated
vendored
332
vendor/go.opentelemetry.io/otel/metric/metric_instrument.go
generated
vendored
@@ -20,20 +20,12 @@ import (
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/metric/number"
|
||||
"go.opentelemetry.io/otel/metric/sdkapi"
|
||||
)
|
||||
|
||||
// ErrSDKReturnedNilImpl is returned when a new `MeterImpl` returns nil.
|
||||
var ErrSDKReturnedNilImpl = errors.New("SDK returned a nil implementation")
|
||||
|
||||
// Observation is used for reporting an asynchronous batch of metric
|
||||
// values. Instances of this type should be created by asynchronous
|
||||
// instruments (e.g., Int64GaugeObserver.Observation()).
|
||||
type Observation struct {
|
||||
// number needs to be aligned for 64-bit atomic operations.
|
||||
number number.Number
|
||||
instrument AsyncImpl
|
||||
}
|
||||
|
||||
// Int64ObserverFunc is a type of callback that integral
|
||||
// observers run.
|
||||
type Int64ObserverFunc func(context.Context, Int64ObserverResult)
|
||||
@@ -50,14 +42,14 @@ type BatchObserverFunc func(context.Context, BatchObserverResult)
|
||||
// Int64ObserverResult is passed to an observer callback to capture
|
||||
// observations for one asynchronous integer metric instrument.
|
||||
type Int64ObserverResult struct {
|
||||
instrument AsyncImpl
|
||||
instrument sdkapi.AsyncImpl
|
||||
function func([]attribute.KeyValue, ...Observation)
|
||||
}
|
||||
|
||||
// Float64ObserverResult is passed to an observer callback to capture
|
||||
// observations for one asynchronous floating point metric instrument.
|
||||
type Float64ObserverResult struct {
|
||||
instrument AsyncImpl
|
||||
instrument sdkapi.AsyncImpl
|
||||
function func([]attribute.KeyValue, ...Observation)
|
||||
}
|
||||
|
||||
@@ -70,19 +62,13 @@ type BatchObserverResult struct {
|
||||
// Observe captures a single integer value from the associated
|
||||
// instrument callback, with the given labels.
|
||||
func (ir Int64ObserverResult) Observe(value int64, labels ...attribute.KeyValue) {
|
||||
ir.function(labels, Observation{
|
||||
instrument: ir.instrument,
|
||||
number: number.NewInt64Number(value),
|
||||
})
|
||||
ir.function(labels, sdkapi.NewObservation(ir.instrument, number.NewInt64Number(value)))
|
||||
}
|
||||
|
||||
// Observe captures a single floating point value from the associated
|
||||
// instrument callback, with the given labels.
|
||||
func (fr Float64ObserverResult) Observe(value float64, labels ...attribute.KeyValue) {
|
||||
fr.function(labels, Observation{
|
||||
instrument: fr.instrument,
|
||||
number: number.NewFloat64Number(value),
|
||||
})
|
||||
fr.function(labels, sdkapi.NewObservation(fr.instrument, number.NewFloat64Number(value)))
|
||||
}
|
||||
|
||||
// Observe captures a multiple observations from the associated batch
|
||||
@@ -91,54 +77,22 @@ func (br BatchObserverResult) Observe(labels []attribute.KeyValue, obs ...Observ
|
||||
br.function(labels, obs...)
|
||||
}
|
||||
|
||||
// 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.
|
||||
type AsyncRunner interface {
|
||||
// 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.
|
||||
type AsyncSingleRunner interface {
|
||||
// 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([]attribute.KeyValue, ...Observation))
|
||||
|
||||
AsyncRunner
|
||||
}
|
||||
|
||||
// AsyncBatchRunner is an interface implemented by batch-observer
|
||||
// callbacks.
|
||||
type AsyncBatchRunner interface {
|
||||
// Run accepts a function for capturing observations of
|
||||
// multiple instruments.
|
||||
Run(ctx context.Context, capture func([]attribute.KeyValue, ...Observation))
|
||||
|
||||
AsyncRunner
|
||||
}
|
||||
|
||||
var _ AsyncSingleRunner = (*Int64ObserverFunc)(nil)
|
||||
var _ AsyncSingleRunner = (*Float64ObserverFunc)(nil)
|
||||
var _ AsyncBatchRunner = (*BatchObserverFunc)(nil)
|
||||
var _ sdkapi.AsyncSingleRunner = (*Int64ObserverFunc)(nil)
|
||||
var _ sdkapi.AsyncSingleRunner = (*Float64ObserverFunc)(nil)
|
||||
var _ sdkapi.AsyncBatchRunner = (*BatchObserverFunc)(nil)
|
||||
|
||||
// newInt64AsyncRunner returns a single-observer callback for integer Observer instruments.
|
||||
func newInt64AsyncRunner(c Int64ObserverFunc) AsyncSingleRunner {
|
||||
func newInt64AsyncRunner(c Int64ObserverFunc) sdkapi.AsyncSingleRunner {
|
||||
return &c
|
||||
}
|
||||
|
||||
// newFloat64AsyncRunner returns a single-observer callback for floating point Observer instruments.
|
||||
func newFloat64AsyncRunner(c Float64ObserverFunc) AsyncSingleRunner {
|
||||
func newFloat64AsyncRunner(c Float64ObserverFunc) sdkapi.AsyncSingleRunner {
|
||||
return &c
|
||||
}
|
||||
|
||||
// newBatchAsyncRunner returns a batch-observer callback use with multiple Observer instruments.
|
||||
func newBatchAsyncRunner(c BatchObserverFunc) AsyncBatchRunner {
|
||||
func newBatchAsyncRunner(c BatchObserverFunc) sdkapi.AsyncBatchRunner {
|
||||
return &c
|
||||
}
|
||||
|
||||
@@ -152,7 +106,7 @@ func (*Float64ObserverFunc) AnyRunner() {}
|
||||
func (*BatchObserverFunc) AnyRunner() {}
|
||||
|
||||
// Run implements AsyncSingleRunner.
|
||||
func (i *Int64ObserverFunc) Run(ctx context.Context, impl AsyncImpl, function func([]attribute.KeyValue, ...Observation)) {
|
||||
func (i *Int64ObserverFunc) Run(ctx context.Context, impl sdkapi.AsyncImpl, function func([]attribute.KeyValue, ...Observation)) {
|
||||
(*i)(ctx, Int64ObserverResult{
|
||||
instrument: impl,
|
||||
function: function,
|
||||
@@ -160,7 +114,7 @@ func (i *Int64ObserverFunc) Run(ctx context.Context, impl AsyncImpl, function fu
|
||||
}
|
||||
|
||||
// Run implements AsyncSingleRunner.
|
||||
func (f *Float64ObserverFunc) Run(ctx context.Context, impl AsyncImpl, function func([]attribute.KeyValue, ...Observation)) {
|
||||
func (f *Float64ObserverFunc) Run(ctx context.Context, impl sdkapi.AsyncImpl, function func([]attribute.KeyValue, ...Observation)) {
|
||||
(*f)(ctx, Float64ObserverResult{
|
||||
instrument: impl,
|
||||
function: function,
|
||||
@@ -175,37 +129,37 @@ func (b *BatchObserverFunc) Run(ctx context.Context, function func([]attribute.K
|
||||
}
|
||||
|
||||
// wrapInt64GaugeObserverInstrument converts an AsyncImpl into Int64GaugeObserver.
|
||||
func wrapInt64GaugeObserverInstrument(asyncInst AsyncImpl, err error) (Int64GaugeObserver, error) {
|
||||
func wrapInt64GaugeObserverInstrument(asyncInst sdkapi.AsyncImpl, err error) (Int64GaugeObserver, error) {
|
||||
common, err := checkNewAsync(asyncInst, err)
|
||||
return Int64GaugeObserver{asyncInstrument: common}, err
|
||||
}
|
||||
|
||||
// wrapFloat64GaugeObserverInstrument converts an AsyncImpl into Float64GaugeObserver.
|
||||
func wrapFloat64GaugeObserverInstrument(asyncInst AsyncImpl, err error) (Float64GaugeObserver, error) {
|
||||
func wrapFloat64GaugeObserverInstrument(asyncInst sdkapi.AsyncImpl, err error) (Float64GaugeObserver, error) {
|
||||
common, err := checkNewAsync(asyncInst, err)
|
||||
return Float64GaugeObserver{asyncInstrument: common}, err
|
||||
}
|
||||
|
||||
// wrapInt64CounterObserverInstrument converts an AsyncImpl into Int64CounterObserver.
|
||||
func wrapInt64CounterObserverInstrument(asyncInst AsyncImpl, err error) (Int64CounterObserver, error) {
|
||||
func wrapInt64CounterObserverInstrument(asyncInst sdkapi.AsyncImpl, err error) (Int64CounterObserver, error) {
|
||||
common, err := checkNewAsync(asyncInst, err)
|
||||
return Int64CounterObserver{asyncInstrument: common}, err
|
||||
}
|
||||
|
||||
// wrapFloat64CounterObserverInstrument converts an AsyncImpl into Float64CounterObserver.
|
||||
func wrapFloat64CounterObserverInstrument(asyncInst AsyncImpl, err error) (Float64CounterObserver, error) {
|
||||
func wrapFloat64CounterObserverInstrument(asyncInst sdkapi.AsyncImpl, err error) (Float64CounterObserver, error) {
|
||||
common, err := checkNewAsync(asyncInst, err)
|
||||
return Float64CounterObserver{asyncInstrument: common}, err
|
||||
}
|
||||
|
||||
// wrapInt64UpDownCounterObserverInstrument converts an AsyncImpl into Int64UpDownCounterObserver.
|
||||
func wrapInt64UpDownCounterObserverInstrument(asyncInst AsyncImpl, err error) (Int64UpDownCounterObserver, error) {
|
||||
func wrapInt64UpDownCounterObserverInstrument(asyncInst sdkapi.AsyncImpl, err error) (Int64UpDownCounterObserver, error) {
|
||||
common, err := checkNewAsync(asyncInst, err)
|
||||
return Int64UpDownCounterObserver{asyncInstrument: common}, err
|
||||
}
|
||||
|
||||
// wrapFloat64UpDownCounterObserverInstrument converts an AsyncImpl into Float64UpDownCounterObserver.
|
||||
func wrapFloat64UpDownCounterObserverInstrument(asyncInst AsyncImpl, err error) (Float64UpDownCounterObserver, error) {
|
||||
func wrapFloat64UpDownCounterObserverInstrument(asyncInst sdkapi.AsyncImpl, err error) (Float64UpDownCounterObserver, error) {
|
||||
common, err := checkNewAsync(asyncInst, err)
|
||||
return Float64UpDownCounterObserver{asyncInstrument: common}, err
|
||||
}
|
||||
@@ -214,7 +168,7 @@ func wrapFloat64UpDownCounterObserverInstrument(asyncInst AsyncImpl, err error)
|
||||
// observations for multiple instruments.
|
||||
type BatchObserver struct {
|
||||
meter Meter
|
||||
runner AsyncBatchRunner
|
||||
runner sdkapi.AsyncBatchRunner
|
||||
}
|
||||
|
||||
// Int64GaugeObserver is a metric that captures a set of int64 values at a
|
||||
@@ -258,10 +212,7 @@ type Float64UpDownCounterObserver struct {
|
||||
// This returns an implementation-level object for use by the SDK,
|
||||
// users should not refer to this.
|
||||
func (i Int64GaugeObserver) Observation(v int64) Observation {
|
||||
return Observation{
|
||||
number: number.NewInt64Number(v),
|
||||
instrument: i.instrument,
|
||||
}
|
||||
return sdkapi.NewObservation(i.instrument, number.NewInt64Number(v))
|
||||
}
|
||||
|
||||
// Observation returns an Observation, a BatchObserverFunc
|
||||
@@ -269,10 +220,7 @@ func (i Int64GaugeObserver) Observation(v int64) Observation {
|
||||
// This returns an implementation-level object for use by the SDK,
|
||||
// users should not refer to this.
|
||||
func (f Float64GaugeObserver) Observation(v float64) Observation {
|
||||
return Observation{
|
||||
number: number.NewFloat64Number(v),
|
||||
instrument: f.instrument,
|
||||
}
|
||||
return sdkapi.NewObservation(f.instrument, number.NewFloat64Number(v))
|
||||
}
|
||||
|
||||
// Observation returns an Observation, a BatchObserverFunc
|
||||
@@ -280,10 +228,7 @@ func (f Float64GaugeObserver) Observation(v float64) Observation {
|
||||
// This returns an implementation-level object for use by the SDK,
|
||||
// users should not refer to this.
|
||||
func (i Int64CounterObserver) Observation(v int64) Observation {
|
||||
return Observation{
|
||||
number: number.NewInt64Number(v),
|
||||
instrument: i.instrument,
|
||||
}
|
||||
return sdkapi.NewObservation(i.instrument, number.NewInt64Number(v))
|
||||
}
|
||||
|
||||
// Observation returns an Observation, a BatchObserverFunc
|
||||
@@ -291,10 +236,7 @@ func (i Int64CounterObserver) Observation(v int64) Observation {
|
||||
// This returns an implementation-level object for use by the SDK,
|
||||
// users should not refer to this.
|
||||
func (f Float64CounterObserver) Observation(v float64) Observation {
|
||||
return Observation{
|
||||
number: number.NewFloat64Number(v),
|
||||
instrument: f.instrument,
|
||||
}
|
||||
return sdkapi.NewObservation(f.instrument, number.NewFloat64Number(v))
|
||||
}
|
||||
|
||||
// Observation returns an Observation, a BatchObserverFunc
|
||||
@@ -302,10 +244,7 @@ func (f Float64CounterObserver) Observation(v float64) Observation {
|
||||
// This returns an implementation-level object for use by the SDK,
|
||||
// users should not refer to this.
|
||||
func (i Int64UpDownCounterObserver) Observation(v int64) Observation {
|
||||
return Observation{
|
||||
number: number.NewInt64Number(v),
|
||||
instrument: i.instrument,
|
||||
}
|
||||
return sdkapi.NewObservation(i.instrument, number.NewInt64Number(v))
|
||||
}
|
||||
|
||||
// Observation returns an Observation, a BatchObserverFunc
|
||||
@@ -313,104 +252,50 @@ func (i Int64UpDownCounterObserver) Observation(v int64) Observation {
|
||||
// This returns an implementation-level object for use by the SDK,
|
||||
// users should not refer to this.
|
||||
func (f Float64UpDownCounterObserver) Observation(v float64) Observation {
|
||||
return Observation{
|
||||
number: number.NewFloat64Number(v),
|
||||
instrument: f.instrument,
|
||||
}
|
||||
}
|
||||
|
||||
// Measurement is used for reporting a synchronous batch of metric
|
||||
// values. Instances of this type should be created by synchronous
|
||||
// instruments (e.g., Int64Counter.Measurement()).
|
||||
type Measurement struct {
|
||||
// number needs to be aligned for 64-bit atomic operations.
|
||||
number number.Number
|
||||
instrument SyncImpl
|
||||
return sdkapi.NewObservation(f.instrument, number.NewFloat64Number(v))
|
||||
}
|
||||
|
||||
// syncInstrument contains a SyncImpl.
|
||||
type syncInstrument struct {
|
||||
instrument SyncImpl
|
||||
}
|
||||
|
||||
// syncBoundInstrument contains a BoundSyncImpl.
|
||||
type syncBoundInstrument struct {
|
||||
boundInstrument BoundSyncImpl
|
||||
instrument sdkapi.SyncImpl
|
||||
}
|
||||
|
||||
// asyncInstrument contains a AsyncImpl.
|
||||
type asyncInstrument struct {
|
||||
instrument AsyncImpl
|
||||
}
|
||||
|
||||
// SyncImpl returns the instrument that created this measurement.
|
||||
// This returns an implementation-level object for use by the SDK,
|
||||
// users should not refer to this.
|
||||
func (m Measurement) SyncImpl() SyncImpl {
|
||||
return m.instrument
|
||||
}
|
||||
|
||||
// Number returns a number recorded in this measurement.
|
||||
func (m Measurement) Number() number.Number {
|
||||
return m.number
|
||||
}
|
||||
|
||||
// AsyncImpl returns the instrument that created this observation.
|
||||
// This returns an implementation-level object for use by the SDK,
|
||||
// users should not refer to this.
|
||||
func (m Observation) AsyncImpl() AsyncImpl {
|
||||
return m.instrument
|
||||
}
|
||||
|
||||
// Number returns a number recorded in this observation.
|
||||
func (m Observation) Number() number.Number {
|
||||
return m.number
|
||||
instrument sdkapi.AsyncImpl
|
||||
}
|
||||
|
||||
// AsyncImpl implements AsyncImpl.
|
||||
func (a asyncInstrument) AsyncImpl() AsyncImpl {
|
||||
func (a asyncInstrument) AsyncImpl() sdkapi.AsyncImpl {
|
||||
return a.instrument
|
||||
}
|
||||
|
||||
// SyncImpl returns the implementation object for synchronous instruments.
|
||||
func (s syncInstrument) SyncImpl() SyncImpl {
|
||||
func (s syncInstrument) SyncImpl() sdkapi.SyncImpl {
|
||||
return s.instrument
|
||||
}
|
||||
|
||||
func (s syncInstrument) bind(labels []attribute.KeyValue) syncBoundInstrument {
|
||||
return newSyncBoundInstrument(s.instrument.Bind(labels))
|
||||
}
|
||||
|
||||
func (s syncInstrument) float64Measurement(value float64) Measurement {
|
||||
return newMeasurement(s.instrument, number.NewFloat64Number(value))
|
||||
return sdkapi.NewMeasurement(s.instrument, number.NewFloat64Number(value))
|
||||
}
|
||||
|
||||
func (s syncInstrument) int64Measurement(value int64) Measurement {
|
||||
return newMeasurement(s.instrument, number.NewInt64Number(value))
|
||||
return sdkapi.NewMeasurement(s.instrument, number.NewInt64Number(value))
|
||||
}
|
||||
|
||||
func (s syncInstrument) directRecord(ctx context.Context, number number.Number, labels []attribute.KeyValue) {
|
||||
s.instrument.RecordOne(ctx, number, labels)
|
||||
}
|
||||
|
||||
func (h syncBoundInstrument) directRecord(ctx context.Context, number number.Number) {
|
||||
h.boundInstrument.RecordOne(ctx, number)
|
||||
}
|
||||
|
||||
// Unbind calls SyncImpl.Unbind.
|
||||
func (h syncBoundInstrument) Unbind() {
|
||||
h.boundInstrument.Unbind()
|
||||
}
|
||||
|
||||
// checkNewAsync receives an AsyncImpl and potential
|
||||
// error, and returns the same types, checking for and ensuring that
|
||||
// the returned interface is not nil.
|
||||
func checkNewAsync(instrument AsyncImpl, err error) (asyncInstrument, error) {
|
||||
func checkNewAsync(instrument sdkapi.AsyncImpl, err error) (asyncInstrument, error) {
|
||||
if instrument == nil {
|
||||
if err == nil {
|
||||
err = ErrSDKReturnedNilImpl
|
||||
}
|
||||
instrument = NoopAsync{}
|
||||
instrument = sdkapi.NewNoopAsyncInstrument()
|
||||
}
|
||||
return asyncInstrument{
|
||||
instrument: instrument,
|
||||
@@ -420,7 +305,7 @@ func checkNewAsync(instrument AsyncImpl, err error) (asyncInstrument, error) {
|
||||
// checkNewSync receives an SyncImpl and potential
|
||||
// error, and returns the same types, checking for and ensuring that
|
||||
// the returned interface is not nil.
|
||||
func checkNewSync(instrument SyncImpl, err error) (syncInstrument, error) {
|
||||
func checkNewSync(instrument sdkapi.SyncImpl, err error) (syncInstrument, error) {
|
||||
if instrument == nil {
|
||||
if err == nil {
|
||||
err = ErrSDKReturnedNilImpl
|
||||
@@ -430,58 +315,45 @@ func checkNewSync(instrument SyncImpl, err error) (syncInstrument, error) {
|
||||
// together and use a tag for the original name, e.g.,
|
||||
// name = 'invalid.counter.int64'
|
||||
// label = 'original-name=duplicate-counter-name'
|
||||
instrument = NoopSync{}
|
||||
instrument = sdkapi.NewNoopSyncInstrument()
|
||||
}
|
||||
return syncInstrument{
|
||||
instrument: instrument,
|
||||
}, err
|
||||
}
|
||||
|
||||
func newSyncBoundInstrument(boundInstrument BoundSyncImpl) syncBoundInstrument {
|
||||
return syncBoundInstrument{
|
||||
boundInstrument: boundInstrument,
|
||||
}
|
||||
}
|
||||
|
||||
func newMeasurement(instrument SyncImpl, number number.Number) Measurement {
|
||||
return Measurement{
|
||||
instrument: instrument,
|
||||
number: number,
|
||||
}
|
||||
}
|
||||
|
||||
// wrapInt64CounterInstrument converts a SyncImpl into Int64Counter.
|
||||
func wrapInt64CounterInstrument(syncInst SyncImpl, err error) (Int64Counter, error) {
|
||||
func wrapInt64CounterInstrument(syncInst sdkapi.SyncImpl, err error) (Int64Counter, error) {
|
||||
common, err := checkNewSync(syncInst, err)
|
||||
return Int64Counter{syncInstrument: common}, err
|
||||
}
|
||||
|
||||
// wrapFloat64CounterInstrument converts a SyncImpl into Float64Counter.
|
||||
func wrapFloat64CounterInstrument(syncInst SyncImpl, err error) (Float64Counter, error) {
|
||||
func wrapFloat64CounterInstrument(syncInst sdkapi.SyncImpl, err error) (Float64Counter, error) {
|
||||
common, err := checkNewSync(syncInst, err)
|
||||
return Float64Counter{syncInstrument: common}, err
|
||||
}
|
||||
|
||||
// wrapInt64UpDownCounterInstrument converts a SyncImpl into Int64UpDownCounter.
|
||||
func wrapInt64UpDownCounterInstrument(syncInst SyncImpl, err error) (Int64UpDownCounter, error) {
|
||||
func wrapInt64UpDownCounterInstrument(syncInst sdkapi.SyncImpl, err error) (Int64UpDownCounter, error) {
|
||||
common, err := checkNewSync(syncInst, err)
|
||||
return Int64UpDownCounter{syncInstrument: common}, err
|
||||
}
|
||||
|
||||
// wrapFloat64UpDownCounterInstrument converts a SyncImpl into Float64UpDownCounter.
|
||||
func wrapFloat64UpDownCounterInstrument(syncInst SyncImpl, err error) (Float64UpDownCounter, error) {
|
||||
func wrapFloat64UpDownCounterInstrument(syncInst sdkapi.SyncImpl, err error) (Float64UpDownCounter, error) {
|
||||
common, err := checkNewSync(syncInst, err)
|
||||
return Float64UpDownCounter{syncInstrument: common}, err
|
||||
}
|
||||
|
||||
// wrapInt64HistogramInstrument converts a SyncImpl into Int64Histogram.
|
||||
func wrapInt64HistogramInstrument(syncInst SyncImpl, err error) (Int64Histogram, error) {
|
||||
func wrapInt64HistogramInstrument(syncInst sdkapi.SyncImpl, err error) (Int64Histogram, error) {
|
||||
common, err := checkNewSync(syncInst, err)
|
||||
return Int64Histogram{syncInstrument: common}, err
|
||||
}
|
||||
|
||||
// wrapFloat64HistogramInstrument converts a SyncImpl into Float64Histogram.
|
||||
func wrapFloat64HistogramInstrument(syncInst SyncImpl, err error) (Float64Histogram, error) {
|
||||
func wrapFloat64HistogramInstrument(syncInst sdkapi.SyncImpl, err error) (Float64Histogram, error) {
|
||||
common, err := checkNewSync(syncInst, err)
|
||||
return Float64Histogram{syncInstrument: common}, err
|
||||
}
|
||||
@@ -496,34 +368,6 @@ type Int64Counter struct {
|
||||
syncInstrument
|
||||
}
|
||||
|
||||
// BoundFloat64Counter is a bound instrument for Float64Counter.
|
||||
//
|
||||
// It inherits the Unbind function from syncBoundInstrument.
|
||||
type BoundFloat64Counter struct {
|
||||
syncBoundInstrument
|
||||
}
|
||||
|
||||
// BoundInt64Counter is a boundInstrument for Int64Counter.
|
||||
//
|
||||
// It inherits the Unbind function from syncBoundInstrument.
|
||||
type BoundInt64Counter struct {
|
||||
syncBoundInstrument
|
||||
}
|
||||
|
||||
// Bind creates a bound instrument for this counter. The labels are
|
||||
// associated with values recorded via subsequent calls to Record.
|
||||
func (c Float64Counter) Bind(labels ...attribute.KeyValue) (h BoundFloat64Counter) {
|
||||
h.syncBoundInstrument = c.bind(labels)
|
||||
return
|
||||
}
|
||||
|
||||
// Bind creates a bound instrument for this counter. The labels are
|
||||
// associated with values recorded via subsequent calls to Record.
|
||||
func (c Int64Counter) Bind(labels ...attribute.KeyValue) (h BoundInt64Counter) {
|
||||
h.syncBoundInstrument = c.bind(labels)
|
||||
return
|
||||
}
|
||||
|
||||
// Measurement creates a Measurement object to use with batch
|
||||
// recording.
|
||||
func (c Float64Counter) Measurement(value float64) Measurement {
|
||||
@@ -548,18 +392,6 @@ func (c Int64Counter) Add(ctx context.Context, value int64, labels ...attribute.
|
||||
c.directRecord(ctx, number.NewInt64Number(value), labels)
|
||||
}
|
||||
|
||||
// Add adds the value to the counter's sum using the labels
|
||||
// previously bound to this counter via Bind()
|
||||
func (b BoundFloat64Counter) Add(ctx context.Context, value float64) {
|
||||
b.directRecord(ctx, number.NewFloat64Number(value))
|
||||
}
|
||||
|
||||
// Add adds the value to the counter's sum using the labels
|
||||
// previously bound to this counter via Bind()
|
||||
func (b BoundInt64Counter) Add(ctx context.Context, value int64) {
|
||||
b.directRecord(ctx, number.NewInt64Number(value))
|
||||
}
|
||||
|
||||
// Float64UpDownCounter is a metric instrument that sums floating
|
||||
// point values.
|
||||
type Float64UpDownCounter struct {
|
||||
@@ -571,34 +403,6 @@ type Int64UpDownCounter struct {
|
||||
syncInstrument
|
||||
}
|
||||
|
||||
// BoundFloat64UpDownCounter is a bound instrument for Float64UpDownCounter.
|
||||
//
|
||||
// It inherits the Unbind function from syncBoundInstrument.
|
||||
type BoundFloat64UpDownCounter struct {
|
||||
syncBoundInstrument
|
||||
}
|
||||
|
||||
// BoundInt64UpDownCounter is a boundInstrument for Int64UpDownCounter.
|
||||
//
|
||||
// It inherits the Unbind function from syncBoundInstrument.
|
||||
type BoundInt64UpDownCounter struct {
|
||||
syncBoundInstrument
|
||||
}
|
||||
|
||||
// Bind creates a bound instrument for this counter. The labels are
|
||||
// associated with values recorded via subsequent calls to Record.
|
||||
func (c Float64UpDownCounter) Bind(labels ...attribute.KeyValue) (h BoundFloat64UpDownCounter) {
|
||||
h.syncBoundInstrument = c.bind(labels)
|
||||
return
|
||||
}
|
||||
|
||||
// Bind creates a bound instrument for this counter. The labels are
|
||||
// associated with values recorded via subsequent calls to Record.
|
||||
func (c Int64UpDownCounter) Bind(labels ...attribute.KeyValue) (h BoundInt64UpDownCounter) {
|
||||
h.syncBoundInstrument = c.bind(labels)
|
||||
return
|
||||
}
|
||||
|
||||
// Measurement creates a Measurement object to use with batch
|
||||
// recording.
|
||||
func (c Float64UpDownCounter) Measurement(value float64) Measurement {
|
||||
@@ -623,18 +427,6 @@ func (c Int64UpDownCounter) Add(ctx context.Context, value int64, labels ...attr
|
||||
c.directRecord(ctx, number.NewInt64Number(value), labels)
|
||||
}
|
||||
|
||||
// Add adds the value to the counter's sum using the labels
|
||||
// previously bound to this counter via Bind()
|
||||
func (b BoundFloat64UpDownCounter) Add(ctx context.Context, value float64) {
|
||||
b.directRecord(ctx, number.NewFloat64Number(value))
|
||||
}
|
||||
|
||||
// Add adds the value to the counter's sum using the labels
|
||||
// previously bound to this counter via Bind()
|
||||
func (b BoundInt64UpDownCounter) Add(ctx context.Context, value int64) {
|
||||
b.directRecord(ctx, number.NewInt64Number(value))
|
||||
}
|
||||
|
||||
// Float64Histogram is a metric that records float64 values.
|
||||
type Float64Histogram struct {
|
||||
syncInstrument
|
||||
@@ -645,34 +437,6 @@ type Int64Histogram struct {
|
||||
syncInstrument
|
||||
}
|
||||
|
||||
// BoundFloat64Histogram is a bound instrument for Float64Histogram.
|
||||
//
|
||||
// It inherits the Unbind function from syncBoundInstrument.
|
||||
type BoundFloat64Histogram struct {
|
||||
syncBoundInstrument
|
||||
}
|
||||
|
||||
// BoundInt64Histogram is a bound instrument for Int64Histogram.
|
||||
//
|
||||
// It inherits the Unbind function from syncBoundInstrument.
|
||||
type BoundInt64Histogram struct {
|
||||
syncBoundInstrument
|
||||
}
|
||||
|
||||
// Bind creates a bound instrument for this Histogram. The labels are
|
||||
// associated with values recorded via subsequent calls to Record.
|
||||
func (c Float64Histogram) Bind(labels ...attribute.KeyValue) (h BoundFloat64Histogram) {
|
||||
h.syncBoundInstrument = c.bind(labels)
|
||||
return
|
||||
}
|
||||
|
||||
// Bind creates a bound instrument for this Histogram. The labels are
|
||||
// associated with values recorded via subsequent calls to Record.
|
||||
func (c Int64Histogram) Bind(labels ...attribute.KeyValue) (h BoundInt64Histogram) {
|
||||
h.syncBoundInstrument = c.bind(labels)
|
||||
return
|
||||
}
|
||||
|
||||
// Measurement creates a Measurement object to use with batch
|
||||
// recording.
|
||||
func (c Float64Histogram) Measurement(value float64) Measurement {
|
||||
@@ -698,15 +462,3 @@ func (c Float64Histogram) Record(ctx context.Context, value float64, labels ...a
|
||||
func (c Int64Histogram) Record(ctx context.Context, value int64, labels ...attribute.KeyValue) {
|
||||
c.directRecord(ctx, number.NewInt64Number(value), labels)
|
||||
}
|
||||
|
||||
// Record adds a new value to the Histogram's distribution using the labels
|
||||
// previously bound to the Histogram via Bind().
|
||||
func (b BoundFloat64Histogram) Record(ctx context.Context, value float64) {
|
||||
b.directRecord(ctx, number.NewFloat64Number(value))
|
||||
}
|
||||
|
||||
// Record adds a new value to the Histogram's distribution using the labels
|
||||
// previously bound to the Histogram via Bind().
|
||||
func (b BoundInt64Histogram) Record(ctx context.Context, value int64) {
|
||||
b.directRecord(ctx, number.NewInt64Number(value))
|
||||
}
|
||||
|
Reference in New Issue
Block a user