VOL-4925 - Build and release components.
Misc/
o Bulk copyright notice udpate to 2023.
go.mod
go.sum
------
o Bump component version strings to the latest release.
Cosmetic edit to force a build.
Change-Id: Icc8869463d1f1a4451938466c39fcc3d11ebad73
diff --git a/vendor/go.opentelemetry.io/otel/api/metric/async.go b/vendor/go.opentelemetry.io/otel/api/metric/async.go
new file mode 100644
index 0000000..d0d488d
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/api/metric/async.go
@@ -0,0 +1,217 @@
+// 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 (
+ "context"
+
+ "go.opentelemetry.io/otel/label"
+)
+
+// 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()).
+type Observation struct {
+ // number needs to be aligned for 64-bit atomic operations.
+ number Number
+ instrument AsyncImpl
+}
+
+// Int64ObserverFunc is a type of callback that integral
+// observers run.
+type Int64ObserverFunc func(context.Context, Int64ObserverResult)
+
+// Float64ObserverFunc is a type of callback that floating point
+// observers run.
+type Float64ObserverFunc func(context.Context, Float64ObserverResult)
+
+// BatchObserverFunc is a callback argument for use with any
+// Observer instrument that will be reported as a batch of
+// observations.
+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
+ function func([]label.KeyValue, ...Observation)
+}
+
+// Float64ObserverResult is passed to an observer callback to capture
+// observations for one asynchronous floating point metric instrument.
+type Float64ObserverResult struct {
+ instrument AsyncImpl
+ function func([]label.KeyValue, ...Observation)
+}
+
+// BatchObserverResult is passed to a batch observer callback to
+// capture observations for multiple asynchronous instruments.
+type BatchObserverResult struct {
+ function func([]label.KeyValue, ...Observation)
+}
+
+// Observe captures a single integer value from the associated
+// instrument callback, with the given labels.
+func (ir Int64ObserverResult) Observe(value int64, labels ...label.KeyValue) {
+ ir.function(labels, Observation{
+ instrument: 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 ...label.KeyValue) {
+ fr.function(labels, Observation{
+ instrument: fr.instrument,
+ number: NewFloat64Number(value),
+ })
+}
+
+// Observe captures a multiple observations from the associated batch
+// instrument callback, with the given labels.
+func (br BatchObserverResult) Observe(labels []label.KeyValue, obs ...Observation) {
+ 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([]label.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([]label.KeyValue, ...Observation))
+
+ AsyncRunner
+}
+
+var _ AsyncSingleRunner = (*Int64ObserverFunc)(nil)
+var _ AsyncSingleRunner = (*Float64ObserverFunc)(nil)
+var _ AsyncBatchRunner = (*BatchObserverFunc)(nil)
+
+// newInt64AsyncRunner returns a single-observer callback for integer Observer instruments.
+func newInt64AsyncRunner(c Int64ObserverFunc) AsyncSingleRunner {
+ return &c
+}
+
+// newFloat64AsyncRunner returns a single-observer callback for floating point Observer instruments.
+func newFloat64AsyncRunner(c Float64ObserverFunc) AsyncSingleRunner {
+ return &c
+}
+
+// newBatchAsyncRunner returns a batch-observer callback use with multiple Observer instruments.
+func newBatchAsyncRunner(c BatchObserverFunc) AsyncBatchRunner {
+ return &c
+}
+
+// AnyRunner implements AsyncRunner.
+func (*Int64ObserverFunc) AnyRunner() {}
+
+// AnyRunner implements AsyncRunner.
+func (*Float64ObserverFunc) AnyRunner() {}
+
+// AnyRunner implements AsyncRunner.
+func (*BatchObserverFunc) AnyRunner() {}
+
+// Run implements AsyncSingleRunner.
+func (i *Int64ObserverFunc) Run(ctx context.Context, impl AsyncImpl, function func([]label.KeyValue, ...Observation)) {
+ (*i)(ctx, Int64ObserverResult{
+ instrument: impl,
+ function: function,
+ })
+}
+
+// Run implements AsyncSingleRunner.
+func (f *Float64ObserverFunc) Run(ctx context.Context, impl AsyncImpl, function func([]label.KeyValue, ...Observation)) {
+ (*f)(ctx, Float64ObserverResult{
+ instrument: impl,
+ function: function,
+ })
+}
+
+// Run implements AsyncBatchRunner.
+func (b *BatchObserverFunc) Run(ctx context.Context, function func([]label.KeyValue, ...Observation)) {
+ (*b)(ctx, BatchObserverResult{
+ function: function,
+ })
+}
+
+// wrapInt64ValueObserverInstrument converts an AsyncImpl into Int64ValueObserver.
+func wrapInt64ValueObserverInstrument(asyncInst AsyncImpl, err error) (Int64ValueObserver, error) {
+ common, err := checkNewAsync(asyncInst, err)
+ return Int64ValueObserver{asyncInstrument: common}, err
+}
+
+// wrapFloat64ValueObserverInstrument converts an AsyncImpl into Float64ValueObserver.
+func wrapFloat64ValueObserverInstrument(asyncInst AsyncImpl, err error) (Float64ValueObserver, error) {
+ common, err := checkNewAsync(asyncInst, err)
+ return Float64ValueObserver{asyncInstrument: common}, err
+}
+
+// wrapInt64SumObserverInstrument converts an AsyncImpl into Int64SumObserver.
+func wrapInt64SumObserverInstrument(asyncInst AsyncImpl, err error) (Int64SumObserver, error) {
+ common, err := checkNewAsync(asyncInst, err)
+ return Int64SumObserver{asyncInstrument: common}, err
+}
+
+// wrapFloat64SumObserverInstrument converts an AsyncImpl into Float64SumObserver.
+func wrapFloat64SumObserverInstrument(asyncInst AsyncImpl, err error) (Float64SumObserver, error) {
+ common, err := checkNewAsync(asyncInst, err)
+ return Float64SumObserver{asyncInstrument: common}, err
+}
+
+// wrapInt64UpDownSumObserverInstrument converts an AsyncImpl into Int64UpDownSumObserver.
+func wrapInt64UpDownSumObserverInstrument(asyncInst AsyncImpl, err error) (Int64UpDownSumObserver, error) {
+ common, err := checkNewAsync(asyncInst, err)
+ return Int64UpDownSumObserver{asyncInstrument: common}, err
+}
+
+// wrapFloat64UpDownSumObserverInstrument converts an AsyncImpl into Float64UpDownSumObserver.
+func wrapFloat64UpDownSumObserverInstrument(asyncInst AsyncImpl, err error) (Float64UpDownSumObserver, error) {
+ common, err := checkNewAsync(asyncInst, err)
+ return Float64UpDownSumObserver{asyncInstrument: common}, err
+}
diff --git a/vendor/go.opentelemetry.io/otel/api/metric/config.go b/vendor/go.opentelemetry.io/otel/api/metric/config.go
new file mode 100644
index 0000000..3cd8fe8
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/api/metric/config.go
@@ -0,0 +1,125 @@
+// 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 "go.opentelemetry.io/otel/unit"
+
+// InstrumentConfig contains options for instrument descriptors.
+type InstrumentConfig struct {
+ // Description describes the instrument in human-readable terms.
+ Description string
+ // Unit describes the measurement unit for a instrument.
+ Unit unit.Unit
+ // InstrumentationName is the name of the library providing
+ // instrumentation.
+ InstrumentationName string
+ // InstrumentationVersion is the version of the library providing
+ // instrumentation.
+ InstrumentationVersion string
+}
+
+// InstrumentOption is an interface for applying instrument options.
+type InstrumentOption interface {
+ // ApplyMeter is used to set a InstrumentOption value of a
+ // InstrumentConfig.
+ ApplyInstrument(*InstrumentConfig)
+}
+
+// NewInstrumentConfig creates a new InstrumentConfig
+// and applies all the given options.
+func NewInstrumentConfig(opts ...InstrumentOption) InstrumentConfig {
+ var config InstrumentConfig
+ for _, o := range opts {
+ o.ApplyInstrument(&config)
+ }
+ return config
+}
+
+// WithDescription applies provided description.
+func WithDescription(desc string) InstrumentOption {
+ return descriptionOption(desc)
+}
+
+type descriptionOption string
+
+func (d descriptionOption) ApplyInstrument(config *InstrumentConfig) {
+ config.Description = string(d)
+}
+
+// WithUnit applies provided unit.
+func WithUnit(unit unit.Unit) InstrumentOption {
+ return unitOption(unit)
+}
+
+type unitOption unit.Unit
+
+func (u unitOption) ApplyInstrument(config *InstrumentConfig) {
+ config.Unit = unit.Unit(u)
+}
+
+// WithInstrumentationName sets the instrumentation name.
+func WithInstrumentationName(name string) InstrumentOption {
+ return instrumentationNameOption(name)
+}
+
+type instrumentationNameOption string
+
+func (i instrumentationNameOption) ApplyInstrument(config *InstrumentConfig) {
+ config.InstrumentationName = string(i)
+}
+
+// MeterConfig contains options for Meters.
+type MeterConfig struct {
+ // InstrumentationVersion is the version of the library providing
+ // instrumentation.
+ InstrumentationVersion string
+}
+
+// MeterOption is an interface for applying Meter options.
+type MeterOption interface {
+ // ApplyMeter is used to set a MeterOption value of a MeterConfig.
+ ApplyMeter(*MeterConfig)
+}
+
+// NewMeterConfig creates a new MeterConfig and applies
+// all the given options.
+func NewMeterConfig(opts ...MeterOption) MeterConfig {
+ var config MeterConfig
+ for _, o := range opts {
+ o.ApplyMeter(&config)
+ }
+ return config
+}
+
+// Option is an interface for applying Instrument or Meter options.
+type Option interface {
+ InstrumentOption
+ MeterOption
+}
+
+// WithInstrumentationVersion sets the instrumentation version.
+func WithInstrumentationVersion(version string) Option {
+ return instrumentationVersionOption(version)
+}
+
+type instrumentationVersionOption string
+
+func (i instrumentationVersionOption) ApplyMeter(config *MeterConfig) {
+ config.InstrumentationVersion = string(i)
+}
+
+func (i instrumentationVersionOption) ApplyInstrument(config *InstrumentConfig) {
+ config.InstrumentationVersion = string(i)
+}
diff --git a/vendor/go.opentelemetry.io/otel/api/metric/counter.go b/vendor/go.opentelemetry.io/otel/api/metric/counter.go
new file mode 100644
index 0000000..c03421d
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/api/metric/counter.go
@@ -0,0 +1,95 @@
+// 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 (
+ "context"
+
+ "go.opentelemetry.io/otel/label"
+)
+
+// Float64Counter is a metric that accumulates float64 values.
+type Float64Counter struct {
+ syncInstrument
+}
+
+// Int64Counter is a metric that accumulates int64 values.
+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 ...label.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 ...label.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 {
+ return c.float64Measurement(value)
+}
+
+// Measurement creates a Measurement object to use with batch
+// recording.
+func (c Int64Counter) Measurement(value int64) Measurement {
+ return c.int64Measurement(value)
+}
+
+// Add adds the value to the counter's sum. The labels should contain
+// the keys and values to be associated with this value.
+func (c Float64Counter) Add(ctx context.Context, value float64, labels ...label.KeyValue) {
+ c.directRecord(ctx, NewFloat64Number(value), labels)
+}
+
+// Add adds the value to the counter's sum. The labels should contain
+// the keys and values to be associated with this value.
+func (c Int64Counter) Add(ctx context.Context, value int64, labels ...label.KeyValue) {
+ c.directRecord(ctx, 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, 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, NewInt64Number(value))
+}
diff --git a/vendor/go.opentelemetry.io/otel/api/metric/descriptor.go b/vendor/go.opentelemetry.io/otel/api/metric/descriptor.go
new file mode 100644
index 0000000..3af55e5
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/api/metric/descriptor.go
@@ -0,0 +1,77 @@
+// 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 "go.opentelemetry.io/otel/unit"
+
+// Descriptor contains all the settings that describe an instrument,
+// including its name, metric kind, number kind, and the configurable
+// options.
+type Descriptor struct {
+ name string
+ kind Kind
+ numberKind NumberKind
+ config InstrumentConfig
+}
+
+// NewDescriptor returns a Descriptor with the given contents.
+func NewDescriptor(name string, mkind Kind, nkind NumberKind, opts ...InstrumentOption) Descriptor {
+ return Descriptor{
+ name: name,
+ kind: mkind,
+ numberKind: nkind,
+ config: NewInstrumentConfig(opts...),
+ }
+}
+
+// Name returns the metric instrument's name.
+func (d Descriptor) Name() string {
+ return d.name
+}
+
+// MetricKind returns the specific kind of instrument.
+func (d Descriptor) MetricKind() Kind {
+ return d.kind
+}
+
+// Description provides a human-readable description of the metric
+// instrument.
+func (d Descriptor) Description() string {
+ return d.config.Description
+}
+
+// Unit describes the units of the metric instrument. Unitless
+// metrics return the empty string.
+func (d Descriptor) Unit() unit.Unit {
+ return d.config.Unit
+}
+
+// NumberKind returns whether this instrument is declared over int64,
+// float64, or uint64 values.
+func (d Descriptor) NumberKind() NumberKind {
+ return d.numberKind
+}
+
+// InstrumentationName returns the name of the library that provided
+// instrumentation for this instrument.
+func (d Descriptor) InstrumentationName() string {
+ return d.config.InstrumentationName
+}
+
+// InstrumentationVersion returns the version of the library that provided
+// instrumentation for this instrument.
+func (d Descriptor) InstrumentationVersion() string {
+ return d.config.InstrumentationVersion
+}
diff --git a/vendor/go.opentelemetry.io/otel/api/metric/doc.go b/vendor/go.opentelemetry.io/otel/api/metric/doc.go
new file mode 100644
index 0000000..48a59c5
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/api/metric/doc.go
@@ -0,0 +1,50 @@
+// 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 provides support for reporting measurements using instruments.
+//
+// Instruments are categorized as below:
+//
+// Synchronous instruments are called by the user with a Context.
+// Asynchronous instruments are called by the SDK during collection.
+//
+// Additive instruments are semantically intended for capturing a sum.
+// Non-additive instruments are intended for capturing a distribution.
+//
+// Additive instruments may be monotonic, in which case they are
+// non-descreasing and naturally define a rate.
+//
+// The synchronous instrument names are:
+//
+// Counter: additive, monotonic
+// UpDownCounter: additive
+// ValueRecorder: non-additive
+//
+// and the asynchronous instruments are:
+//
+// SumObserver: additive, monotonic
+// UpDownSumObserver: additive
+// ValueObserver: non-additive
+//
+// All instruments are provided with support for either float64 or
+// int64 input values.
+//
+// The Meter interface supports allocating new instruments as well as
+// interfaces for recording batches of synchronous measurements or
+// asynchronous observations. To obtain a Meter, use a MeterProvider.
+//
+// The MeterProvider interface supports obtaining a named Meter interface. To
+// obtain a MeterProvider implementation, initialize and configure any
+// compatible SDK.
+package metric // import "go.opentelemetry.io/otel/api/metric"
diff --git a/vendor/go.opentelemetry.io/otel/api/metric/kind.go b/vendor/go.opentelemetry.io/otel/api/metric/kind.go
new file mode 100644
index 0000000..9d4b453
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/api/metric/kind.go
@@ -0,0 +1,79 @@
+// 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.
+
+//go:generate stringer -type=Kind
+
+package metric
+
+// Kind describes the kind of instrument.
+type Kind int8
+
+const (
+ // ValueRecorderKind indicates a ValueRecorder instrument.
+ ValueRecorderKind Kind = iota
+ // ValueObserverKind indicates an ValueObserver instrument.
+ ValueObserverKind
+
+ // CounterKind indicates a Counter instrument.
+ CounterKind
+ // UpDownCounterKind indicates a UpDownCounter instrument.
+ UpDownCounterKind
+
+ // SumObserverKind indicates a SumObserver instrument.
+ SumObserverKind
+ // UpDownSumObserverKind indicates a UpDownSumObserver instrument.
+ UpDownSumObserverKind
+)
+
+// Synchronous returns whether this is a synchronous kind of instrument.
+func (k Kind) Synchronous() bool {
+ switch k {
+ case CounterKind, UpDownCounterKind, ValueRecorderKind:
+ return true
+ }
+ return false
+}
+
+// Asynchronous returns whether this is an asynchronous kind of instrument.
+func (k Kind) Asynchronous() bool {
+ return !k.Synchronous()
+}
+
+// Adding returns whether this kind of instrument adds its inputs (as opposed to Grouping).
+func (k Kind) Adding() bool {
+ switch k {
+ case CounterKind, UpDownCounterKind, SumObserverKind, UpDownSumObserverKind:
+ return true
+ }
+ return false
+}
+
+// Adding returns whether this kind of instrument groups its inputs (as opposed to Adding).
+func (k Kind) Grouping() bool {
+ return !k.Adding()
+}
+
+// Monotonic returns whether this kind of instrument exposes a non-decreasing sum.
+func (k Kind) Monotonic() bool {
+ switch k {
+ case CounterKind, SumObserverKind:
+ return true
+ }
+ return false
+}
+
+// Cumulative returns whether this kind of instrument receives precomputed sums.
+func (k Kind) PrecomputedSum() bool {
+ return k.Adding() && k.Asynchronous()
+}
diff --git a/vendor/go.opentelemetry.io/otel/api/metric/kind_string.go b/vendor/go.opentelemetry.io/otel/api/metric/kind_string.go
new file mode 100644
index 0000000..eb1a0d5
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/api/metric/kind_string.go
@@ -0,0 +1,28 @@
+// Code generated by "stringer -type=Kind"; DO NOT EDIT.
+
+package metric
+
+import "strconv"
+
+func _() {
+ // An "invalid array index" compiler error signifies that the constant values have changed.
+ // Re-run the stringer command to generate them again.
+ var x [1]struct{}
+ _ = x[ValueRecorderKind-0]
+ _ = x[ValueObserverKind-1]
+ _ = x[CounterKind-2]
+ _ = x[UpDownCounterKind-3]
+ _ = x[SumObserverKind-4]
+ _ = x[UpDownSumObserverKind-5]
+}
+
+const _Kind_name = "ValueRecorderKindValueObserverKindCounterKindUpDownCounterKindSumObserverKindUpDownSumObserverKind"
+
+var _Kind_index = [...]uint8{0, 17, 34, 45, 62, 77, 98}
+
+func (i Kind) String() string {
+ if i < 0 || i >= Kind(len(_Kind_index)-1) {
+ return "Kind(" + strconv.FormatInt(int64(i), 10) + ")"
+ }
+ return _Kind_name[_Kind_index[i]:_Kind_index[i+1]]
+}
diff --git a/vendor/go.opentelemetry.io/otel/api/metric/meter.go b/vendor/go.opentelemetry.io/otel/api/metric/meter.go
new file mode 100644
index 0000000..d174913
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/api/metric/meter.go
@@ -0,0 +1,320 @@
+// 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 (
+ "context"
+
+ "go.opentelemetry.io/otel/label"
+)
+
+// The file is organized as follows:
+//
+// - MeterProvider interface
+// - Meter struct
+// - RecordBatch
+// - BatchObserver
+// - Synchronous instrument constructors (2 x int64,float64)
+// - Asynchronous instrument constructors (1 x int64,float64)
+// - Batch asynchronous constructors (1 x int64,float64)
+// - Internals
+
+// MeterProvider supports named Meter instances.
+type MeterProvider interface {
+ // Meter creates an implementation of the Meter interface.
+ // The instrumentationName must be the name of the library providing
+ // instrumentation. This name may be the same as the instrumented code
+ // only if that code provides built-in instrumentation. If the
+ // instrumentationName is empty, then a implementation defined default
+ // name will be used instead.
+ Meter(instrumentationName string, opts ...MeterOption) Meter
+}
+
+// Meter is the OpenTelemetry metric API, based on a `MeterImpl`
+// implementation and the `Meter` library name.
+//
+// An uninitialized Meter is a no-op implementation.
+type Meter struct {
+ impl MeterImpl
+ name, version string
+}
+
+// RecordBatch atomically records a batch of measurements.
+func (m Meter) RecordBatch(ctx context.Context, ls []label.KeyValue, ms ...Measurement) {
+ if m.impl == nil {
+ return
+ }
+ m.impl.RecordBatch(ctx, ls, ms...)
+}
+
+// NewBatchObserver creates a new BatchObserver that supports
+// making batches of observations for multiple instruments.
+func (m Meter) NewBatchObserver(callback BatchObserverFunc) BatchObserver {
+ return BatchObserver{
+ meter: m,
+ runner: newBatchAsyncRunner(callback),
+ }
+}
+
+// NewInt64Counter creates a new integer Counter instrument with the
+// given name, customized with options. May return an error if the
+// name is invalid (e.g., empty) or improperly registered (e.g.,
+// duplicate registration).
+func (m Meter) NewInt64Counter(name string, options ...InstrumentOption) (Int64Counter, error) {
+ return wrapInt64CounterInstrument(
+ m.newSync(name, CounterKind, Int64NumberKind, options))
+}
+
+// NewFloat64Counter creates a new floating point Counter with the
+// given name, customized with options. May return an error if the
+// name is invalid (e.g., empty) or improperly registered (e.g.,
+// duplicate registration).
+func (m Meter) NewFloat64Counter(name string, options ...InstrumentOption) (Float64Counter, error) {
+ return wrapFloat64CounterInstrument(
+ m.newSync(name, CounterKind, Float64NumberKind, options))
+}
+
+// NewInt64UpDownCounter creates a new integer UpDownCounter instrument with the
+// given name, customized with options. May return an error if the
+// name is invalid (e.g., empty) or improperly registered (e.g.,
+// duplicate registration).
+func (m Meter) NewInt64UpDownCounter(name string, options ...InstrumentOption) (Int64UpDownCounter, error) {
+ return wrapInt64UpDownCounterInstrument(
+ m.newSync(name, UpDownCounterKind, Int64NumberKind, options))
+}
+
+// NewFloat64UpDownCounter creates a new floating point UpDownCounter with the
+// given name, customized with options. May return an error if the
+// name is invalid (e.g., empty) or improperly registered (e.g.,
+// duplicate registration).
+func (m Meter) NewFloat64UpDownCounter(name string, options ...InstrumentOption) (Float64UpDownCounter, error) {
+ return wrapFloat64UpDownCounterInstrument(
+ m.newSync(name, UpDownCounterKind, Float64NumberKind, options))
+}
+
+// NewInt64ValueRecorder creates a new integer ValueRecorder instrument with the
+// given name, customized with options. May return an error if the
+// name is invalid (e.g., empty) or improperly registered (e.g.,
+// duplicate registration).
+func (m Meter) NewInt64ValueRecorder(name string, opts ...InstrumentOption) (Int64ValueRecorder, error) {
+ return wrapInt64ValueRecorderInstrument(
+ m.newSync(name, ValueRecorderKind, Int64NumberKind, opts))
+}
+
+// NewFloat64ValueRecorder creates a new floating point ValueRecorder with the
+// given name, customized with options. May return an error if the
+// name is invalid (e.g., empty) or improperly registered (e.g.,
+// duplicate registration).
+func (m Meter) NewFloat64ValueRecorder(name string, opts ...InstrumentOption) (Float64ValueRecorder, error) {
+ return wrapFloat64ValueRecorderInstrument(
+ m.newSync(name, ValueRecorderKind, Float64NumberKind, opts))
+}
+
+// NewInt64ValueObserver creates a new integer ValueObserver instrument
+// with the given name, running a given callback, and customized with
+// options. May return an error if the name is invalid (e.g., empty)
+// or improperly registered (e.g., duplicate registration).
+func (m Meter) NewInt64ValueObserver(name string, callback Int64ObserverFunc, opts ...InstrumentOption) (Int64ValueObserver, error) {
+ if callback == nil {
+ return wrapInt64ValueObserverInstrument(NoopAsync{}, nil)
+ }
+ return wrapInt64ValueObserverInstrument(
+ m.newAsync(name, ValueObserverKind, Int64NumberKind, opts,
+ newInt64AsyncRunner(callback)))
+}
+
+// NewFloat64ValueObserver creates a new floating point ValueObserver with
+// the given name, running a given callback, and customized with
+// options. May return an error if the name is invalid (e.g., empty)
+// or improperly registered (e.g., duplicate registration).
+func (m Meter) NewFloat64ValueObserver(name string, callback Float64ObserverFunc, opts ...InstrumentOption) (Float64ValueObserver, error) {
+ if callback == nil {
+ return wrapFloat64ValueObserverInstrument(NoopAsync{}, nil)
+ }
+ return wrapFloat64ValueObserverInstrument(
+ m.newAsync(name, ValueObserverKind, Float64NumberKind, opts,
+ newFloat64AsyncRunner(callback)))
+}
+
+// NewInt64SumObserver creates a new integer SumObserver instrument
+// with the given name, running a given callback, and customized with
+// options. May return an error if the name is invalid (e.g., empty)
+// or improperly registered (e.g., duplicate registration).
+func (m Meter) NewInt64SumObserver(name string, callback Int64ObserverFunc, opts ...InstrumentOption) (Int64SumObserver, error) {
+ if callback == nil {
+ return wrapInt64SumObserverInstrument(NoopAsync{}, nil)
+ }
+ return wrapInt64SumObserverInstrument(
+ m.newAsync(name, SumObserverKind, Int64NumberKind, opts,
+ newInt64AsyncRunner(callback)))
+}
+
+// NewFloat64SumObserver creates a new floating point SumObserver with
+// the given name, running a given callback, and customized with
+// options. May return an error if the name is invalid (e.g., empty)
+// or improperly registered (e.g., duplicate registration).
+func (m Meter) NewFloat64SumObserver(name string, callback Float64ObserverFunc, opts ...InstrumentOption) (Float64SumObserver, error) {
+ if callback == nil {
+ return wrapFloat64SumObserverInstrument(NoopAsync{}, nil)
+ }
+ return wrapFloat64SumObserverInstrument(
+ m.newAsync(name, SumObserverKind, Float64NumberKind, opts,
+ newFloat64AsyncRunner(callback)))
+}
+
+// NewInt64UpDownSumObserver creates a new integer UpDownSumObserver instrument
+// with the given name, running a given callback, and customized with
+// options. May return an error if the name is invalid (e.g., empty)
+// or improperly registered (e.g., duplicate registration).
+func (m Meter) NewInt64UpDownSumObserver(name string, callback Int64ObserverFunc, opts ...InstrumentOption) (Int64UpDownSumObserver, error) {
+ if callback == nil {
+ return wrapInt64UpDownSumObserverInstrument(NoopAsync{}, nil)
+ }
+ return wrapInt64UpDownSumObserverInstrument(
+ m.newAsync(name, UpDownSumObserverKind, Int64NumberKind, opts,
+ newInt64AsyncRunner(callback)))
+}
+
+// NewFloat64UpDownSumObserver creates a new floating point UpDownSumObserver with
+// the given name, running a given callback, and customized with
+// options. May return an error if the name is invalid (e.g., empty)
+// or improperly registered (e.g., duplicate registration).
+func (m Meter) NewFloat64UpDownSumObserver(name string, callback Float64ObserverFunc, opts ...InstrumentOption) (Float64UpDownSumObserver, error) {
+ if callback == nil {
+ return wrapFloat64UpDownSumObserverInstrument(NoopAsync{}, nil)
+ }
+ return wrapFloat64UpDownSumObserverInstrument(
+ m.newAsync(name, UpDownSumObserverKind, Float64NumberKind, opts,
+ newFloat64AsyncRunner(callback)))
+}
+
+// NewInt64ValueObserver creates a new integer ValueObserver instrument
+// with the given name, running in a batch callback, and customized with
+// options. May return an error if the name is invalid (e.g., empty)
+// or improperly registered (e.g., duplicate registration).
+func (b BatchObserver) NewInt64ValueObserver(name string, opts ...InstrumentOption) (Int64ValueObserver, error) {
+ if b.runner == nil {
+ return wrapInt64ValueObserverInstrument(NoopAsync{}, nil)
+ }
+ return wrapInt64ValueObserverInstrument(
+ b.meter.newAsync(name, ValueObserverKind, Int64NumberKind, opts, b.runner))
+}
+
+// NewFloat64ValueObserver creates a new floating point ValueObserver with
+// the given name, running in a batch callback, and customized with
+// options. May return an error if the name is invalid (e.g., empty)
+// or improperly registered (e.g., duplicate registration).
+func (b BatchObserver) NewFloat64ValueObserver(name string, opts ...InstrumentOption) (Float64ValueObserver, error) {
+ if b.runner == nil {
+ return wrapFloat64ValueObserverInstrument(NoopAsync{}, nil)
+ }
+ return wrapFloat64ValueObserverInstrument(
+ b.meter.newAsync(name, ValueObserverKind, Float64NumberKind, opts,
+ b.runner))
+}
+
+// NewInt64SumObserver creates a new integer SumObserver instrument
+// with the given name, running in a batch callback, and customized with
+// options. May return an error if the name is invalid (e.g., empty)
+// or improperly registered (e.g., duplicate registration).
+func (b BatchObserver) NewInt64SumObserver(name string, opts ...InstrumentOption) (Int64SumObserver, error) {
+ if b.runner == nil {
+ return wrapInt64SumObserverInstrument(NoopAsync{}, nil)
+ }
+ return wrapInt64SumObserverInstrument(
+ b.meter.newAsync(name, SumObserverKind, Int64NumberKind, opts, b.runner))
+}
+
+// NewFloat64SumObserver creates a new floating point SumObserver with
+// the given name, running in a batch callback, and customized with
+// options. May return an error if the name is invalid (e.g., empty)
+// or improperly registered (e.g., duplicate registration).
+func (b BatchObserver) NewFloat64SumObserver(name string, opts ...InstrumentOption) (Float64SumObserver, error) {
+ if b.runner == nil {
+ return wrapFloat64SumObserverInstrument(NoopAsync{}, nil)
+ }
+ return wrapFloat64SumObserverInstrument(
+ b.meter.newAsync(name, SumObserverKind, Float64NumberKind, opts,
+ b.runner))
+}
+
+// NewInt64UpDownSumObserver creates a new integer UpDownSumObserver instrument
+// with the given name, running in a batch callback, and customized with
+// options. May return an error if the name is invalid (e.g., empty)
+// or improperly registered (e.g., duplicate registration).
+func (b BatchObserver) NewInt64UpDownSumObserver(name string, opts ...InstrumentOption) (Int64UpDownSumObserver, error) {
+ if b.runner == nil {
+ return wrapInt64UpDownSumObserverInstrument(NoopAsync{}, nil)
+ }
+ return wrapInt64UpDownSumObserverInstrument(
+ b.meter.newAsync(name, UpDownSumObserverKind, Int64NumberKind, opts, b.runner))
+}
+
+// NewFloat64UpDownSumObserver creates a new floating point UpDownSumObserver with
+// the given name, running in a batch callback, and customized with
+// options. May return an error if the name is invalid (e.g., empty)
+// or improperly registered (e.g., duplicate registration).
+func (b BatchObserver) NewFloat64UpDownSumObserver(name string, opts ...InstrumentOption) (Float64UpDownSumObserver, error) {
+ if b.runner == nil {
+ return wrapFloat64UpDownSumObserverInstrument(NoopAsync{}, nil)
+ }
+ return wrapFloat64UpDownSumObserverInstrument(
+ b.meter.newAsync(name, UpDownSumObserverKind, Float64NumberKind, opts,
+ b.runner))
+}
+
+// MeterImpl returns the underlying MeterImpl of this Meter.
+func (m Meter) MeterImpl() MeterImpl {
+ return m.impl
+}
+
+// newAsync constructs one new asynchronous instrument.
+func (m Meter) newAsync(
+ name string,
+ mkind Kind,
+ nkind NumberKind,
+ opts []InstrumentOption,
+ runner AsyncRunner,
+) (
+ AsyncImpl,
+ error,
+) {
+ if m.impl == nil {
+ return NoopAsync{}, nil
+ }
+ desc := NewDescriptor(name, mkind, nkind, opts...)
+ desc.config.InstrumentationName = m.name
+ desc.config.InstrumentationVersion = m.version
+ return m.impl.NewAsyncInstrument(desc, runner)
+}
+
+// newSync constructs one new synchronous instrument.
+func (m Meter) newSync(
+ name string,
+ metricKind Kind,
+ numberKind NumberKind,
+ opts []InstrumentOption,
+) (
+ SyncImpl,
+ error,
+) {
+ if m.impl == nil {
+ return NoopSync{}, nil
+ }
+ desc := NewDescriptor(name, metricKind, numberKind, opts...)
+ desc.config.InstrumentationName = m.name
+ desc.config.InstrumentationVersion = m.version
+ return m.impl.NewSyncInstrument(desc)
+}
diff --git a/vendor/go.opentelemetry.io/otel/api/metric/must.go b/vendor/go.opentelemetry.io/otel/api/metric/must.go
new file mode 100644
index 0000000..c88e050
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/api/metric/must.go
@@ -0,0 +1,222 @@
+// 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
+
+// MeterMust is a wrapper for Meter interfaces that panics when any
+// instrument constructor encounters an error.
+type MeterMust struct {
+ meter Meter
+}
+
+// BatchObserverMust is a wrapper for BatchObserver that panics when
+// any instrument constructor encounters an error.
+type BatchObserverMust struct {
+ batch BatchObserver
+}
+
+// Must constructs a MeterMust implementation from a Meter, allowing
+// the application to panic when any instrument constructor yields an
+// error.
+func Must(meter Meter) MeterMust {
+ return MeterMust{meter: meter}
+}
+
+// NewInt64Counter calls `Meter.NewInt64Counter` and returns the
+// instrument, panicking if it encounters an error.
+func (mm MeterMust) NewInt64Counter(name string, cos ...InstrumentOption) Int64Counter {
+ if inst, err := mm.meter.NewInt64Counter(name, cos...); err != nil {
+ panic(err)
+ } else {
+ return inst
+ }
+}
+
+// NewFloat64Counter calls `Meter.NewFloat64Counter` and returns the
+// instrument, panicking if it encounters an error.
+func (mm MeterMust) NewFloat64Counter(name string, cos ...InstrumentOption) Float64Counter {
+ if inst, err := mm.meter.NewFloat64Counter(name, cos...); err != nil {
+ panic(err)
+ } else {
+ return inst
+ }
+}
+
+// NewInt64UpDownCounter calls `Meter.NewInt64UpDownCounter` and returns the
+// instrument, panicking if it encounters an error.
+func (mm MeterMust) NewInt64UpDownCounter(name string, cos ...InstrumentOption) Int64UpDownCounter {
+ if inst, err := mm.meter.NewInt64UpDownCounter(name, cos...); err != nil {
+ panic(err)
+ } else {
+ return inst
+ }
+}
+
+// NewFloat64UpDownCounter calls `Meter.NewFloat64UpDownCounter` and returns the
+// instrument, panicking if it encounters an error.
+func (mm MeterMust) NewFloat64UpDownCounter(name string, cos ...InstrumentOption) Float64UpDownCounter {
+ if inst, err := mm.meter.NewFloat64UpDownCounter(name, cos...); err != nil {
+ panic(err)
+ } else {
+ return inst
+ }
+}
+
+// NewInt64ValueRecorder calls `Meter.NewInt64ValueRecorder` and returns the
+// instrument, panicking if it encounters an error.
+func (mm MeterMust) NewInt64ValueRecorder(name string, mos ...InstrumentOption) Int64ValueRecorder {
+ if inst, err := mm.meter.NewInt64ValueRecorder(name, mos...); err != nil {
+ panic(err)
+ } else {
+ return inst
+ }
+}
+
+// NewFloat64ValueRecorder calls `Meter.NewFloat64ValueRecorder` and returns the
+// instrument, panicking if it encounters an error.
+func (mm MeterMust) NewFloat64ValueRecorder(name string, mos ...InstrumentOption) Float64ValueRecorder {
+ if inst, err := mm.meter.NewFloat64ValueRecorder(name, mos...); err != nil {
+ panic(err)
+ } else {
+ return inst
+ }
+}
+
+// NewInt64ValueObserver calls `Meter.NewInt64ValueObserver` and
+// returns the instrument, panicking if it encounters an error.
+func (mm MeterMust) NewInt64ValueObserver(name string, callback Int64ObserverFunc, oos ...InstrumentOption) Int64ValueObserver {
+ if inst, err := mm.meter.NewInt64ValueObserver(name, callback, oos...); err != nil {
+ panic(err)
+ } else {
+ return inst
+ }
+}
+
+// NewFloat64ValueObserver calls `Meter.NewFloat64ValueObserver` and
+// returns the instrument, panicking if it encounters an error.
+func (mm MeterMust) NewFloat64ValueObserver(name string, callback Float64ObserverFunc, oos ...InstrumentOption) Float64ValueObserver {
+ if inst, err := mm.meter.NewFloat64ValueObserver(name, callback, oos...); err != nil {
+ panic(err)
+ } else {
+ return inst
+ }
+}
+
+// NewInt64SumObserver calls `Meter.NewInt64SumObserver` and
+// returns the instrument, panicking if it encounters an error.
+func (mm MeterMust) NewInt64SumObserver(name string, callback Int64ObserverFunc, oos ...InstrumentOption) Int64SumObserver {
+ if inst, err := mm.meter.NewInt64SumObserver(name, callback, oos...); err != nil {
+ panic(err)
+ } else {
+ return inst
+ }
+}
+
+// NewFloat64SumObserver calls `Meter.NewFloat64SumObserver` and
+// returns the instrument, panicking if it encounters an error.
+func (mm MeterMust) NewFloat64SumObserver(name string, callback Float64ObserverFunc, oos ...InstrumentOption) Float64SumObserver {
+ if inst, err := mm.meter.NewFloat64SumObserver(name, callback, oos...); err != nil {
+ panic(err)
+ } else {
+ return inst
+ }
+}
+
+// NewInt64UpDownSumObserver calls `Meter.NewInt64UpDownSumObserver` and
+// returns the instrument, panicking if it encounters an error.
+func (mm MeterMust) NewInt64UpDownSumObserver(name string, callback Int64ObserverFunc, oos ...InstrumentOption) Int64UpDownSumObserver {
+ if inst, err := mm.meter.NewInt64UpDownSumObserver(name, callback, oos...); err != nil {
+ panic(err)
+ } else {
+ return inst
+ }
+}
+
+// NewFloat64UpDownSumObserver calls `Meter.NewFloat64UpDownSumObserver` and
+// returns the instrument, panicking if it encounters an error.
+func (mm MeterMust) NewFloat64UpDownSumObserver(name string, callback Float64ObserverFunc, oos ...InstrumentOption) Float64UpDownSumObserver {
+ if inst, err := mm.meter.NewFloat64UpDownSumObserver(name, callback, oos...); err != nil {
+ panic(err)
+ } else {
+ return inst
+ }
+}
+
+// NewBatchObserver returns a wrapper around BatchObserver that panics
+// when any instrument constructor returns an error.
+func (mm MeterMust) NewBatchObserver(callback BatchObserverFunc) BatchObserverMust {
+ return BatchObserverMust{
+ batch: mm.meter.NewBatchObserver(callback),
+ }
+}
+
+// NewInt64ValueObserver calls `BatchObserver.NewInt64ValueObserver` and
+// returns the instrument, panicking if it encounters an error.
+func (bm BatchObserverMust) NewInt64ValueObserver(name string, oos ...InstrumentOption) Int64ValueObserver {
+ if inst, err := bm.batch.NewInt64ValueObserver(name, oos...); err != nil {
+ panic(err)
+ } else {
+ return inst
+ }
+}
+
+// NewFloat64ValueObserver calls `BatchObserver.NewFloat64ValueObserver` and
+// returns the instrument, panicking if it encounters an error.
+func (bm BatchObserverMust) NewFloat64ValueObserver(name string, oos ...InstrumentOption) Float64ValueObserver {
+ if inst, err := bm.batch.NewFloat64ValueObserver(name, oos...); err != nil {
+ panic(err)
+ } else {
+ return inst
+ }
+}
+
+// NewInt64SumObserver calls `BatchObserver.NewInt64SumObserver` and
+// returns the instrument, panicking if it encounters an error.
+func (bm BatchObserverMust) NewInt64SumObserver(name string, oos ...InstrumentOption) Int64SumObserver {
+ if inst, err := bm.batch.NewInt64SumObserver(name, oos...); err != nil {
+ panic(err)
+ } else {
+ return inst
+ }
+}
+
+// NewFloat64SumObserver calls `BatchObserver.NewFloat64SumObserver` and
+// returns the instrument, panicking if it encounters an error.
+func (bm BatchObserverMust) NewFloat64SumObserver(name string, oos ...InstrumentOption) Float64SumObserver {
+ if inst, err := bm.batch.NewFloat64SumObserver(name, oos...); err != nil {
+ panic(err)
+ } else {
+ return inst
+ }
+}
+
+// NewInt64UpDownSumObserver calls `BatchObserver.NewInt64UpDownSumObserver` and
+// returns the instrument, panicking if it encounters an error.
+func (bm BatchObserverMust) NewInt64UpDownSumObserver(name string, oos ...InstrumentOption) Int64UpDownSumObserver {
+ if inst, err := bm.batch.NewInt64UpDownSumObserver(name, oos...); err != nil {
+ panic(err)
+ } else {
+ return inst
+ }
+}
+
+// NewFloat64UpDownSumObserver calls `BatchObserver.NewFloat64UpDownSumObserver` and
+// returns the instrument, panicking if it encounters an error.
+func (bm BatchObserverMust) NewFloat64UpDownSumObserver(name string, oos ...InstrumentOption) Float64UpDownSumObserver {
+ if inst, err := bm.batch.NewFloat64UpDownSumObserver(name, oos...); err != nil {
+ panic(err)
+ } else {
+ return inst
+ }
+}
diff --git a/vendor/go.opentelemetry.io/otel/api/metric/noop.go b/vendor/go.opentelemetry.io/otel/api/metric/noop.go
new file mode 100644
index 0000000..97867d9
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/api/metric/noop.go
@@ -0,0 +1,58 @@
+// 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 (
+ "context"
+
+ "go.opentelemetry.io/otel/label"
+)
+
+type NoopMeterProvider struct{}
+
+type noopInstrument struct{}
+type noopBoundInstrument struct{}
+type NoopSync struct{ noopInstrument }
+type NoopAsync struct{ noopInstrument }
+
+var _ MeterProvider = NoopMeterProvider{}
+var _ SyncImpl = NoopSync{}
+var _ BoundSyncImpl = noopBoundInstrument{}
+var _ AsyncImpl = NoopAsync{}
+
+func (NoopMeterProvider) Meter(_ string, _ ...MeterOption) Meter {
+ return Meter{}
+}
+
+func (noopInstrument) Implementation() interface{} {
+ return nil
+}
+
+func (noopInstrument) Descriptor() Descriptor {
+ return Descriptor{}
+}
+
+func (noopBoundInstrument) RecordOne(context.Context, Number) {
+}
+
+func (noopBoundInstrument) Unbind() {
+}
+
+func (NoopSync) Bind([]label.KeyValue) BoundSyncImpl {
+ return noopBoundInstrument{}
+}
+
+func (NoopSync) RecordOne(context.Context, Number, []label.KeyValue) {
+}
diff --git a/vendor/go.opentelemetry.io/otel/api/metric/number.go b/vendor/go.opentelemetry.io/otel/api/metric/number.go
new file mode 100644
index 0000000..c3ca0ed
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/api/metric/number.go
@@ -0,0 +1,540 @@
+// 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
+
+//go:generate stringer -type=NumberKind
+
+import (
+ "fmt"
+ "math"
+ "sync/atomic"
+
+ "go.opentelemetry.io/otel/internal"
+)
+
+// NumberKind describes the data type of the Number.
+type NumberKind int8
+
+const (
+ // Int64NumberKind means that the Number stores int64.
+ Int64NumberKind NumberKind = iota
+ // Float64NumberKind means that the Number stores float64.
+ Float64NumberKind
+)
+
+// Zero returns a zero value for a given NumberKind
+func (k NumberKind) Zero() Number {
+ switch k {
+ case Int64NumberKind:
+ return NewInt64Number(0)
+ case Float64NumberKind:
+ return NewFloat64Number(0.)
+ default:
+ return Number(0)
+ }
+}
+
+// Minimum returns the minimum representable value
+// for a given NumberKind
+func (k NumberKind) Minimum() Number {
+ switch k {
+ case Int64NumberKind:
+ return NewInt64Number(math.MinInt64)
+ case Float64NumberKind:
+ return NewFloat64Number(-1. * math.MaxFloat64)
+ default:
+ return Number(0)
+ }
+}
+
+// Maximum returns the maximum representable value
+// for a given NumberKind
+func (k NumberKind) Maximum() Number {
+ switch k {
+ case Int64NumberKind:
+ return NewInt64Number(math.MaxInt64)
+ case Float64NumberKind:
+ return NewFloat64Number(math.MaxFloat64)
+ default:
+ return Number(0)
+ }
+}
+
+// Number represents either an integral or a floating point value. It
+// needs to be accompanied with a source of NumberKind that describes
+// the actual type of the value stored within Number.
+type Number uint64
+
+// - constructors
+
+// NewNumberFromRaw creates a new Number from a raw value.
+func NewNumberFromRaw(r uint64) Number {
+ return Number(r)
+}
+
+// NewInt64Number creates an integral Number.
+func NewInt64Number(i int64) Number {
+ return NewNumberFromRaw(internal.Int64ToRaw(i))
+}
+
+// NewFloat64Number creates a floating point Number.
+func NewFloat64Number(f float64) Number {
+ return NewNumberFromRaw(internal.Float64ToRaw(f))
+}
+
+// NewNumberSignChange returns a number with the same magnitude and
+// the opposite sign. `kind` must describe the kind of number in `nn`.
+//
+// Does not change Uint64NumberKind values.
+func NewNumberSignChange(kind NumberKind, nn Number) Number {
+ switch kind {
+ case Int64NumberKind:
+ return NewInt64Number(-nn.AsInt64())
+ case Float64NumberKind:
+ return NewFloat64Number(-nn.AsFloat64())
+ }
+ return nn
+}
+
+// - as x
+
+// AsNumber gets the Number.
+func (n *Number) AsNumber() Number {
+ return *n
+}
+
+// AsRaw gets the uninterpreted raw value. Might be useful for some
+// atomic operations.
+func (n *Number) AsRaw() uint64 {
+ return uint64(*n)
+}
+
+// AsInt64 assumes that the value contains an int64 and returns it as
+// such.
+func (n *Number) AsInt64() int64 {
+ return internal.RawToInt64(n.AsRaw())
+}
+
+// AsFloat64 assumes that the measurement value contains a float64 and
+// returns it as such.
+func (n *Number) AsFloat64() float64 {
+ return internal.RawToFloat64(n.AsRaw())
+}
+
+// - as x atomic
+
+// AsNumberAtomic gets the Number atomically.
+func (n *Number) AsNumberAtomic() Number {
+ return NewNumberFromRaw(n.AsRawAtomic())
+}
+
+// AsRawAtomic gets the uninterpreted raw value atomically. Might be
+// useful for some atomic operations.
+func (n *Number) AsRawAtomic() uint64 {
+ return atomic.LoadUint64(n.AsRawPtr())
+}
+
+// AsInt64Atomic assumes that the number contains an int64 and returns
+// it as such atomically.
+func (n *Number) AsInt64Atomic() int64 {
+ return atomic.LoadInt64(n.AsInt64Ptr())
+}
+
+// AsFloat64Atomic assumes that the measurement value contains a
+// float64 and returns it as such atomically.
+func (n *Number) AsFloat64Atomic() float64 {
+ return internal.RawToFloat64(n.AsRawAtomic())
+}
+
+// - as x ptr
+
+// AsRawPtr gets the pointer to the raw, uninterpreted raw
+// value. Might be useful for some atomic operations.
+func (n *Number) AsRawPtr() *uint64 {
+ return (*uint64)(n)
+}
+
+// AsInt64Ptr assumes that the number contains an int64 and returns a
+// pointer to it.
+func (n *Number) AsInt64Ptr() *int64 {
+ return internal.RawPtrToInt64Ptr(n.AsRawPtr())
+}
+
+// AsFloat64Ptr assumes that the number contains a float64 and returns a
+// pointer to it.
+func (n *Number) AsFloat64Ptr() *float64 {
+ return internal.RawPtrToFloat64Ptr(n.AsRawPtr())
+}
+
+// - coerce
+
+// CoerceToInt64 casts the number to int64. May result in
+// data/precision loss.
+func (n *Number) CoerceToInt64(kind NumberKind) int64 {
+ switch kind {
+ case Int64NumberKind:
+ return n.AsInt64()
+ case Float64NumberKind:
+ return int64(n.AsFloat64())
+ default:
+ // you get what you deserve
+ return 0
+ }
+}
+
+// CoerceToFloat64 casts the number to float64. May result in
+// data/precision loss.
+func (n *Number) CoerceToFloat64(kind NumberKind) float64 {
+ switch kind {
+ case Int64NumberKind:
+ return float64(n.AsInt64())
+ case Float64NumberKind:
+ return n.AsFloat64()
+ default:
+ // you get what you deserve
+ return 0
+ }
+}
+
+// - set
+
+// SetNumber sets the number to the passed number. Both should be of
+// the same kind.
+func (n *Number) SetNumber(nn Number) {
+ *n.AsRawPtr() = nn.AsRaw()
+}
+
+// SetRaw sets the number to the passed raw value. Both number and the
+// raw number should represent the same kind.
+func (n *Number) SetRaw(r uint64) {
+ *n.AsRawPtr() = r
+}
+
+// SetInt64 assumes that the number contains an int64 and sets it to
+// the passed value.
+func (n *Number) SetInt64(i int64) {
+ *n.AsInt64Ptr() = i
+}
+
+// SetFloat64 assumes that the number contains a float64 and sets it
+// to the passed value.
+func (n *Number) SetFloat64(f float64) {
+ *n.AsFloat64Ptr() = f
+}
+
+// - set atomic
+
+// SetNumberAtomic sets the number to the passed number
+// atomically. Both should be of the same kind.
+func (n *Number) SetNumberAtomic(nn Number) {
+ atomic.StoreUint64(n.AsRawPtr(), nn.AsRaw())
+}
+
+// SetRawAtomic sets the number to the passed raw value
+// atomically. Both number and the raw number should represent the
+// same kind.
+func (n *Number) SetRawAtomic(r uint64) {
+ atomic.StoreUint64(n.AsRawPtr(), r)
+}
+
+// SetInt64Atomic assumes that the number contains an int64 and sets
+// it to the passed value atomically.
+func (n *Number) SetInt64Atomic(i int64) {
+ atomic.StoreInt64(n.AsInt64Ptr(), i)
+}
+
+// SetFloat64Atomic assumes that the number contains a float64 and
+// sets it to the passed value atomically.
+func (n *Number) SetFloat64Atomic(f float64) {
+ atomic.StoreUint64(n.AsRawPtr(), internal.Float64ToRaw(f))
+}
+
+// - swap
+
+// SwapNumber sets the number to the passed number and returns the old
+// number. Both this number and the passed number should be of the
+// same kind.
+func (n *Number) SwapNumber(nn Number) Number {
+ old := *n
+ n.SetNumber(nn)
+ return old
+}
+
+// SwapRaw sets the number to the passed raw value and returns the old
+// raw value. Both number and the raw number should represent the same
+// kind.
+func (n *Number) SwapRaw(r uint64) uint64 {
+ old := n.AsRaw()
+ n.SetRaw(r)
+ return old
+}
+
+// SwapInt64 assumes that the number contains an int64, sets it to the
+// passed value and returns the old int64 value.
+func (n *Number) SwapInt64(i int64) int64 {
+ old := n.AsInt64()
+ n.SetInt64(i)
+ return old
+}
+
+// SwapFloat64 assumes that the number contains an float64, sets it to
+// the passed value and returns the old float64 value.
+func (n *Number) SwapFloat64(f float64) float64 {
+ old := n.AsFloat64()
+ n.SetFloat64(f)
+ return old
+}
+
+// - swap atomic
+
+// SwapNumberAtomic sets the number to the passed number and returns
+// the old number atomically. Both this number and the passed number
+// should be of the same kind.
+func (n *Number) SwapNumberAtomic(nn Number) Number {
+ return NewNumberFromRaw(atomic.SwapUint64(n.AsRawPtr(), nn.AsRaw()))
+}
+
+// SwapRawAtomic sets the number to the passed raw value and returns
+// the old raw value atomically. Both number and the raw number should
+// represent the same kind.
+func (n *Number) SwapRawAtomic(r uint64) uint64 {
+ return atomic.SwapUint64(n.AsRawPtr(), r)
+}
+
+// SwapInt64Atomic assumes that the number contains an int64, sets it
+// to the passed value and returns the old int64 value atomically.
+func (n *Number) SwapInt64Atomic(i int64) int64 {
+ return atomic.SwapInt64(n.AsInt64Ptr(), i)
+}
+
+// SwapFloat64Atomic assumes that the number contains an float64, sets
+// it to the passed value and returns the old float64 value
+// atomically.
+func (n *Number) SwapFloat64Atomic(f float64) float64 {
+ return internal.RawToFloat64(atomic.SwapUint64(n.AsRawPtr(), internal.Float64ToRaw(f)))
+}
+
+// - add
+
+// AddNumber assumes that this and the passed number are of the passed
+// kind and adds the passed number to this number.
+func (n *Number) AddNumber(kind NumberKind, nn Number) {
+ switch kind {
+ case Int64NumberKind:
+ n.AddInt64(nn.AsInt64())
+ case Float64NumberKind:
+ n.AddFloat64(nn.AsFloat64())
+ }
+}
+
+// AddRaw assumes that this number and the passed raw value are of the
+// passed kind and adds the passed raw value to this number.
+func (n *Number) AddRaw(kind NumberKind, r uint64) {
+ n.AddNumber(kind, NewNumberFromRaw(r))
+}
+
+// AddInt64 assumes that the number contains an int64 and adds the
+// passed int64 to it.
+func (n *Number) AddInt64(i int64) {
+ *n.AsInt64Ptr() += i
+}
+
+// AddFloat64 assumes that the number contains a float64 and adds the
+// passed float64 to it.
+func (n *Number) AddFloat64(f float64) {
+ *n.AsFloat64Ptr() += f
+}
+
+// - add atomic
+
+// AddNumberAtomic assumes that this and the passed number are of the
+// passed kind and adds the passed number to this number atomically.
+func (n *Number) AddNumberAtomic(kind NumberKind, nn Number) {
+ switch kind {
+ case Int64NumberKind:
+ n.AddInt64Atomic(nn.AsInt64())
+ case Float64NumberKind:
+ n.AddFloat64Atomic(nn.AsFloat64())
+ }
+}
+
+// AddRawAtomic assumes that this number and the passed raw value are
+// of the passed kind and adds the passed raw value to this number
+// atomically.
+func (n *Number) AddRawAtomic(kind NumberKind, r uint64) {
+ n.AddNumberAtomic(kind, NewNumberFromRaw(r))
+}
+
+// AddInt64Atomic assumes that the number contains an int64 and adds
+// the passed int64 to it atomically.
+func (n *Number) AddInt64Atomic(i int64) {
+ atomic.AddInt64(n.AsInt64Ptr(), i)
+}
+
+// AddFloat64Atomic assumes that the number contains a float64 and
+// adds the passed float64 to it atomically.
+func (n *Number) AddFloat64Atomic(f float64) {
+ for {
+ o := n.AsFloat64Atomic()
+ if n.CompareAndSwapFloat64(o, o+f) {
+ break
+ }
+ }
+}
+
+// - compare and swap (atomic only)
+
+// CompareAndSwapNumber does the atomic CAS operation on this
+// number. This number and passed old and new numbers should be of the
+// same kind.
+func (n *Number) CompareAndSwapNumber(on, nn Number) bool {
+ return atomic.CompareAndSwapUint64(n.AsRawPtr(), on.AsRaw(), nn.AsRaw())
+}
+
+// CompareAndSwapRaw does the atomic CAS operation on this
+// number. This number and passed old and new raw values should be of
+// the same kind.
+func (n *Number) CompareAndSwapRaw(or, nr uint64) bool {
+ return atomic.CompareAndSwapUint64(n.AsRawPtr(), or, nr)
+}
+
+// CompareAndSwapInt64 assumes that this number contains an int64 and
+// does the atomic CAS operation on it.
+func (n *Number) CompareAndSwapInt64(oi, ni int64) bool {
+ return atomic.CompareAndSwapInt64(n.AsInt64Ptr(), oi, ni)
+}
+
+// CompareAndSwapFloat64 assumes that this number contains a float64 and
+// does the atomic CAS operation on it.
+func (n *Number) CompareAndSwapFloat64(of, nf float64) bool {
+ return atomic.CompareAndSwapUint64(n.AsRawPtr(), internal.Float64ToRaw(of), internal.Float64ToRaw(nf))
+}
+
+// - compare
+
+// CompareNumber compares two Numbers given their kind. Both numbers
+// should have the same kind. This returns:
+// 0 if the numbers are equal
+// -1 if the subject `n` is less than the argument `nn`
+// +1 if the subject `n` is greater than the argument `nn`
+func (n *Number) CompareNumber(kind NumberKind, nn Number) int {
+ switch kind {
+ case Int64NumberKind:
+ return n.CompareInt64(nn.AsInt64())
+ case Float64NumberKind:
+ return n.CompareFloat64(nn.AsFloat64())
+ default:
+ // you get what you deserve
+ return 0
+ }
+}
+
+// CompareRaw compares two numbers, where one is input as a raw
+// uint64, interpreting both values as a `kind` of number.
+func (n *Number) CompareRaw(kind NumberKind, r uint64) int {
+ return n.CompareNumber(kind, NewNumberFromRaw(r))
+}
+
+// CompareInt64 assumes that the Number contains an int64 and performs
+// a comparison between the value and the other value. It returns the
+// typical result of the compare function: -1 if the value is less
+// than the other, 0 if both are equal, 1 if the value is greater than
+// the other.
+func (n *Number) CompareInt64(i int64) int {
+ this := n.AsInt64()
+ if this < i {
+ return -1
+ } else if this > i {
+ return 1
+ }
+ return 0
+}
+
+// CompareFloat64 assumes that the Number contains a float64 and
+// performs a comparison between the value and the other value. It
+// returns the typical result of the compare function: -1 if the value
+// is less than the other, 0 if both are equal, 1 if the value is
+// greater than the other.
+//
+// Do not compare NaN values.
+func (n *Number) CompareFloat64(f float64) int {
+ this := n.AsFloat64()
+ if this < f {
+ return -1
+ } else if this > f {
+ return 1
+ }
+ return 0
+}
+
+// - relations to zero
+
+// IsPositive returns true if the actual value is greater than zero.
+func (n *Number) IsPositive(kind NumberKind) bool {
+ return n.compareWithZero(kind) > 0
+}
+
+// IsNegative returns true if the actual value is less than zero.
+func (n *Number) IsNegative(kind NumberKind) bool {
+ return n.compareWithZero(kind) < 0
+}
+
+// IsZero returns true if the actual value is equal to zero.
+func (n *Number) IsZero(kind NumberKind) bool {
+ return n.compareWithZero(kind) == 0
+}
+
+// - misc
+
+// Emit returns a string representation of the raw value of the
+// Number. A %d is used for integral values, %f for floating point
+// values.
+func (n *Number) Emit(kind NumberKind) string {
+ switch kind {
+ case Int64NumberKind:
+ return fmt.Sprintf("%d", n.AsInt64())
+ case Float64NumberKind:
+ return fmt.Sprintf("%f", n.AsFloat64())
+ default:
+ return ""
+ }
+}
+
+// AsInterface returns the number as an interface{}, typically used
+// for NumberKind-correct JSON conversion.
+func (n *Number) AsInterface(kind NumberKind) interface{} {
+ switch kind {
+ case Int64NumberKind:
+ return n.AsInt64()
+ case Float64NumberKind:
+ return n.AsFloat64()
+ default:
+ return math.NaN()
+ }
+}
+
+// - private stuff
+
+func (n *Number) compareWithZero(kind NumberKind) int {
+ switch kind {
+ case Int64NumberKind:
+ return n.CompareInt64(0)
+ case Float64NumberKind:
+ return n.CompareFloat64(0.)
+ default:
+ // you get what you deserve
+ return 0
+ }
+}
diff --git a/vendor/go.opentelemetry.io/otel/api/metric/numberkind_string.go b/vendor/go.opentelemetry.io/otel/api/metric/numberkind_string.go
new file mode 100644
index 0000000..e99a874
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/api/metric/numberkind_string.go
@@ -0,0 +1,24 @@
+// Code generated by "stringer -type=NumberKind"; DO NOT EDIT.
+
+package metric
+
+import "strconv"
+
+func _() {
+ // An "invalid array index" compiler error signifies that the constant values have changed.
+ // Re-run the stringer command to generate them again.
+ var x [1]struct{}
+ _ = x[Int64NumberKind-0]
+ _ = x[Float64NumberKind-1]
+}
+
+const _NumberKind_name = "Int64NumberKindFloat64NumberKind"
+
+var _NumberKind_index = [...]uint8{0, 15, 32}
+
+func (i NumberKind) String() string {
+ if i < 0 || i >= NumberKind(len(_NumberKind_index)-1) {
+ return "NumberKind(" + strconv.FormatInt(int64(i), 10) + ")"
+ }
+ return _NumberKind_name[_NumberKind_index[i]:_NumberKind_index[i+1]]
+}
diff --git a/vendor/go.opentelemetry.io/otel/api/metric/observer.go b/vendor/go.opentelemetry.io/otel/api/metric/observer.go
new file mode 100644
index 0000000..c347da7
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/api/metric/observer.go
@@ -0,0 +1,124 @@
+// 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
+
+// BatchObserver represents an Observer callback that can report
+// observations for multiple instruments.
+type BatchObserver struct {
+ meter Meter
+ runner AsyncBatchRunner
+}
+
+// Int64ValueObserver is a metric that captures a set of int64 values at a
+// point in time.
+type Int64ValueObserver struct {
+ asyncInstrument
+}
+
+// Float64ValueObserver is a metric that captures a set of float64 values
+// at a point in time.
+type Float64ValueObserver struct {
+ asyncInstrument
+}
+
+// Int64SumObserver is a metric that captures a precomputed sum of
+// int64 values at a point in time.
+type Int64SumObserver struct {
+ asyncInstrument
+}
+
+// Float64SumObserver is a metric that captures a precomputed sum of
+// float64 values at a point in time.
+type Float64SumObserver struct {
+ asyncInstrument
+}
+
+// Int64UpDownSumObserver is a metric that captures a precomputed sum of
+// int64 values at a point in time.
+type Int64UpDownSumObserver struct {
+ asyncInstrument
+}
+
+// Float64UpDownSumObserver is a metric that captures a precomputed sum of
+// float64 values at a point in time.
+type Float64UpDownSumObserver struct {
+ asyncInstrument
+}
+
+// Observation returns an Observation, a BatchObserverFunc
+// argument, for an asynchronous integer instrument.
+// This returns an implementation-level object for use by the SDK,
+// users should not refer to this.
+func (i Int64ValueObserver) Observation(v int64) Observation {
+ return Observation{
+ number: NewInt64Number(v),
+ instrument: i.instrument,
+ }
+}
+
+// Observation returns an Observation, a BatchObserverFunc
+// argument, for an asynchronous integer instrument.
+// This returns an implementation-level object for use by the SDK,
+// users should not refer to this.
+func (f Float64ValueObserver) Observation(v float64) Observation {
+ return Observation{
+ number: NewFloat64Number(v),
+ instrument: f.instrument,
+ }
+}
+
+// Observation returns an Observation, a BatchObserverFunc
+// argument, for an asynchronous integer instrument.
+// This returns an implementation-level object for use by the SDK,
+// users should not refer to this.
+func (i Int64SumObserver) Observation(v int64) Observation {
+ return Observation{
+ number: NewInt64Number(v),
+ instrument: i.instrument,
+ }
+}
+
+// Observation returns an Observation, a BatchObserverFunc
+// argument, for an asynchronous integer instrument.
+// This returns an implementation-level object for use by the SDK,
+// users should not refer to this.
+func (f Float64SumObserver) Observation(v float64) Observation {
+ return Observation{
+ number: NewFloat64Number(v),
+ instrument: f.instrument,
+ }
+}
+
+// Observation returns an Observation, a BatchObserverFunc
+// argument, for an asynchronous integer instrument.
+// This returns an implementation-level object for use by the SDK,
+// users should not refer to this.
+func (i Int64UpDownSumObserver) Observation(v int64) Observation {
+ return Observation{
+ number: NewInt64Number(v),
+ instrument: i.instrument,
+ }
+}
+
+// Observation returns an Observation, a BatchObserverFunc
+// argument, for an asynchronous integer instrument.
+// This returns an implementation-level object for use by the SDK,
+// users should not refer to this.
+func (f Float64UpDownSumObserver) Observation(v float64) Observation {
+ return Observation{
+ number: NewFloat64Number(v),
+ instrument: f.instrument,
+ }
+}
diff --git a/vendor/go.opentelemetry.io/otel/api/metric/registry/registry.go b/vendor/go.opentelemetry.io/otel/api/metric/registry/registry.go
new file mode 100644
index 0000000..ed9eccc
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/api/metric/registry/registry.go
@@ -0,0 +1,170 @@
+// 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 registry // import "go.opentelemetry.io/otel/api/metric/registry"
+
+import (
+ "context"
+ "fmt"
+ "sync"
+
+ "go.opentelemetry.io/otel/api/metric"
+ "go.opentelemetry.io/otel/label"
+)
+
+// MeterProvider is a standard MeterProvider for wrapping `MeterImpl`
+type MeterProvider struct {
+ impl metric.MeterImpl
+}
+
+var _ metric.MeterProvider = (*MeterProvider)(nil)
+
+// uniqueInstrumentMeterImpl implements the metric.MeterImpl interface, adding
+// uniqueness checking for instrument descriptors. Use NewUniqueInstrumentMeter
+// to wrap an implementation with uniqueness checking.
+type uniqueInstrumentMeterImpl struct {
+ lock sync.Mutex
+ impl metric.MeterImpl
+ state map[key]metric.InstrumentImpl
+}
+
+var _ metric.MeterImpl = (*uniqueInstrumentMeterImpl)(nil)
+
+type key struct {
+ instrumentName string
+ instrumentationName string
+ InstrumentationVersion string
+}
+
+// NewMeterProvider returns a new provider that implements instrument
+// name-uniqueness checking.
+func NewMeterProvider(impl metric.MeterImpl) *MeterProvider {
+ return &MeterProvider{
+ impl: NewUniqueInstrumentMeterImpl(impl),
+ }
+}
+
+// Meter implements MeterProvider.
+func (p *MeterProvider) Meter(instrumentationName string, opts ...metric.MeterOption) metric.Meter {
+ return metric.WrapMeterImpl(p.impl, instrumentationName, opts...)
+}
+
+// ErrMetricKindMismatch is the standard error for mismatched metric
+// instrument definitions.
+var ErrMetricKindMismatch = fmt.Errorf(
+ "A metric was already registered by this name with another kind or number type")
+
+// NewUniqueInstrumentMeterImpl returns a wrapped metric.MeterImpl with
+// the addition of uniqueness checking.
+func NewUniqueInstrumentMeterImpl(impl metric.MeterImpl) metric.MeterImpl {
+ return &uniqueInstrumentMeterImpl{
+ impl: impl,
+ state: map[key]metric.InstrumentImpl{},
+ }
+}
+
+// RecordBatch implements metric.MeterImpl.
+func (u *uniqueInstrumentMeterImpl) RecordBatch(ctx context.Context, labels []label.KeyValue, ms ...metric.Measurement) {
+ u.impl.RecordBatch(ctx, labels, ms...)
+}
+
+func keyOf(descriptor metric.Descriptor) key {
+ return key{
+ descriptor.Name(),
+ descriptor.InstrumentationName(),
+ descriptor.InstrumentationVersion(),
+ }
+}
+
+// NewMetricKindMismatchError formats an error that describes a
+// mismatched metric instrument definition.
+func NewMetricKindMismatchError(desc metric.Descriptor) error {
+ return fmt.Errorf("Metric was %s (%s %s)registered as a %s %s: %w",
+ desc.Name(),
+ desc.InstrumentationName(),
+ desc.InstrumentationVersion(),
+ desc.NumberKind(),
+ desc.MetricKind(),
+ ErrMetricKindMismatch)
+}
+
+// Compatible determines whether two metric.Descriptors are considered
+// the same for the purpose of uniqueness checking.
+func Compatible(candidate, existing metric.Descriptor) bool {
+ return candidate.MetricKind() == existing.MetricKind() &&
+ candidate.NumberKind() == existing.NumberKind()
+}
+
+// checkUniqueness returns an ErrMetricKindMismatch error if there is
+// a conflict between a descriptor that was already registered and the
+// `descriptor` argument. If there is an existing compatible
+// registration, this returns the already-registered instrument. If
+// there is no conflict and no prior registration, returns (nil, nil).
+func (u *uniqueInstrumentMeterImpl) checkUniqueness(descriptor metric.Descriptor) (metric.InstrumentImpl, error) {
+ impl, ok := u.state[keyOf(descriptor)]
+ if !ok {
+ return nil, nil
+ }
+
+ if !Compatible(descriptor, impl.Descriptor()) {
+ return nil, NewMetricKindMismatchError(impl.Descriptor())
+ }
+
+ return impl, nil
+}
+
+// NewSyncInstrument implements metric.MeterImpl.
+func (u *uniqueInstrumentMeterImpl) NewSyncInstrument(descriptor metric.Descriptor) (metric.SyncImpl, error) {
+ u.lock.Lock()
+ defer u.lock.Unlock()
+
+ impl, err := u.checkUniqueness(descriptor)
+
+ if err != nil {
+ return nil, err
+ } else if impl != nil {
+ return impl.(metric.SyncImpl), nil
+ }
+
+ syncInst, err := u.impl.NewSyncInstrument(descriptor)
+ if err != nil {
+ return nil, err
+ }
+ u.state[keyOf(descriptor)] = syncInst
+ return syncInst, nil
+}
+
+// NewAsyncInstrument implements metric.MeterImpl.
+func (u *uniqueInstrumentMeterImpl) NewAsyncInstrument(
+ descriptor metric.Descriptor,
+ runner metric.AsyncRunner,
+) (metric.AsyncImpl, error) {
+ u.lock.Lock()
+ defer u.lock.Unlock()
+
+ impl, err := u.checkUniqueness(descriptor)
+
+ if err != nil {
+ return nil, err
+ } else if impl != nil {
+ return impl.(metric.AsyncImpl), nil
+ }
+
+ asyncInst, err := u.impl.NewAsyncInstrument(descriptor, runner)
+ if err != nil {
+ return nil, err
+ }
+ u.state[keyOf(descriptor)] = asyncInst
+ return asyncInst, nil
+}
diff --git a/vendor/go.opentelemetry.io/otel/api/metric/sdkapi.go b/vendor/go.opentelemetry.io/otel/api/metric/sdkapi.go
new file mode 100644
index 0000000..122c9ba
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/api/metric/sdkapi.go
@@ -0,0 +1,94 @@
+// 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 (
+ "context"
+
+ "go.opentelemetry.io/otel/label"
+)
+
+// MeterImpl is the interface an SDK must implement to supply a Meter
+// implementation.
+type MeterImpl interface {
+ // RecordBatch atomically records a batch of measurements.
+ RecordBatch(ctx context.Context, labels []label.KeyValue, measurement ...Measurement)
+
+ // NewSyncInstrument returns a newly constructed
+ // synchronous instrument implementation or an error, should
+ // one occur.
+ NewSyncInstrument(descriptor Descriptor) (SyncImpl, error)
+
+ // NewAsyncInstrument returns a newly constructed
+ // asynchronous instrument implementation or an error, should
+ // one occur.
+ NewAsyncInstrument(
+ descriptor Descriptor,
+ runner AsyncRunner,
+ ) (AsyncImpl, error)
+}
+
+// InstrumentImpl is a common interface for synchronous and
+// asynchronous instruments.
+type InstrumentImpl interface {
+ // Implementation returns the underlying implementation of the
+ // instrument, which allows the implementation to gain access
+ // to its own representation especially from a `Measurement`.
+ Implementation() interface{}
+
+ // Descriptor returns a copy of the instrument's Descriptor.
+ Descriptor() Descriptor
+}
+
+// SyncImpl is the implementation-level interface to a generic
+// synchronous instrument (e.g., ValueRecorder and Counter instruments).
+type SyncImpl interface {
+ InstrumentImpl
+
+ // Bind creates an implementation-level bound instrument,
+ // binding a label set with this instrument implementation.
+ Bind(labels []label.KeyValue) BoundSyncImpl
+
+ // RecordOne captures a single synchronous metric event.
+ RecordOne(ctx context.Context, number Number, labels []label.KeyValue)
+}
+
+// BoundSyncImpl is the implementation-level interface to a
+// generic bound synchronous instrument
+type BoundSyncImpl interface {
+
+ // RecordOne captures a single synchronous metric event.
+ RecordOne(ctx context.Context, number Number)
+
+ // Unbind frees the resources associated with this bound instrument. It
+ // does not affect the metric this bound instrument was created through.
+ Unbind()
+}
+
+// AsyncImpl is an implementation-level interface to an
+// asynchronous instrument (e.g., Observer instruments).
+type AsyncImpl interface {
+ InstrumentImpl
+}
+
+// WrapMeterImpl constructs a `Meter` implementation from a
+// `MeterImpl` implementation.
+func WrapMeterImpl(impl MeterImpl, instrumentationName string, opts ...MeterOption) Meter {
+ return Meter{
+ impl: impl,
+ name: instrumentationName,
+ version: NewMeterConfig(opts...).InstrumentationVersion,
+ }
+}
diff --git a/vendor/go.opentelemetry.io/otel/api/metric/sync.go b/vendor/go.opentelemetry.io/otel/api/metric/sync.go
new file mode 100644
index 0000000..a08a65b
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/api/metric/sync.go
@@ -0,0 +1,192 @@
+// 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 (
+ "context"
+ "errors"
+
+ "go.opentelemetry.io/otel/label"
+)
+
+// ErrSDKReturnedNilImpl is returned when a new `MeterImpl` returns nil.
+var ErrSDKReturnedNilImpl = errors.New("SDK returned a nil implementation")
+
+// 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
+ instrument SyncImpl
+}
+
+// syncInstrument contains a SyncImpl.
+type syncInstrument struct {
+ instrument SyncImpl
+}
+
+// syncBoundInstrument contains a BoundSyncImpl.
+type syncBoundInstrument struct {
+ boundInstrument BoundSyncImpl
+}
+
+// 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 {
+ 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 {
+ return m.number
+}
+
+// AsyncImpl implements AsyncImpl.
+func (a asyncInstrument) AsyncImpl() AsyncImpl {
+ return a.instrument
+}
+
+// SyncImpl returns the implementation object for synchronous instruments.
+func (s syncInstrument) SyncImpl() SyncImpl {
+ return s.instrument
+}
+
+func (s syncInstrument) bind(labels []label.KeyValue) syncBoundInstrument {
+ return newSyncBoundInstrument(s.instrument.Bind(labels))
+}
+
+func (s syncInstrument) float64Measurement(value float64) Measurement {
+ return newMeasurement(s.instrument, NewFloat64Number(value))
+}
+
+func (s syncInstrument) int64Measurement(value int64) Measurement {
+ return newMeasurement(s.instrument, NewInt64Number(value))
+}
+
+func (s syncInstrument) directRecord(ctx context.Context, number Number, labels []label.KeyValue) {
+ s.instrument.RecordOne(ctx, number, labels)
+}
+
+func (h syncBoundInstrument) directRecord(ctx context.Context, 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) {
+ if instrument == nil {
+ if err == nil {
+ err = ErrSDKReturnedNilImpl
+ }
+ instrument = NoopAsync{}
+ }
+ return asyncInstrument{
+ instrument: instrument,
+ }, err
+}
+
+// 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) {
+ if instrument == nil {
+ if err == nil {
+ err = ErrSDKReturnedNilImpl
+ }
+ // Note: an alternate behavior would be to synthesize a new name
+ // or group all duplicately-named instruments of a certain type
+ // together and use a tag for the original name, e.g.,
+ // name = 'invalid.counter.int64'
+ // label = 'original-name=duplicate-counter-name'
+ instrument = NoopSync{}
+ }
+ return syncInstrument{
+ instrument: instrument,
+ }, err
+}
+
+func newSyncBoundInstrument(boundInstrument BoundSyncImpl) syncBoundInstrument {
+ return syncBoundInstrument{
+ boundInstrument: boundInstrument,
+ }
+}
+
+func newMeasurement(instrument SyncImpl, number Number) Measurement {
+ return Measurement{
+ instrument: instrument,
+ number: number,
+ }
+}
+
+// wrapInt64CounterInstrument converts a SyncImpl into Int64Counter.
+func wrapInt64CounterInstrument(syncInst 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) {
+ common, err := checkNewSync(syncInst, err)
+ return Float64Counter{syncInstrument: common}, err
+}
+
+// wrapInt64UpDownCounterInstrument converts a SyncImpl into Int64UpDownCounter.
+func wrapInt64UpDownCounterInstrument(syncInst 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) {
+ common, err := checkNewSync(syncInst, err)
+ return Float64UpDownCounter{syncInstrument: common}, err
+}
+
+// wrapInt64ValueRecorderInstrument converts a SyncImpl into Int64ValueRecorder.
+func wrapInt64ValueRecorderInstrument(syncInst SyncImpl, err error) (Int64ValueRecorder, error) {
+ common, err := checkNewSync(syncInst, err)
+ return Int64ValueRecorder{syncInstrument: common}, err
+}
+
+// wrapFloat64ValueRecorderInstrument converts a SyncImpl into Float64ValueRecorder.
+func wrapFloat64ValueRecorderInstrument(syncInst SyncImpl, err error) (Float64ValueRecorder, error) {
+ common, err := checkNewSync(syncInst, err)
+ return Float64ValueRecorder{syncInstrument: common}, err
+}
diff --git a/vendor/go.opentelemetry.io/otel/api/metric/updowncounter.go b/vendor/go.opentelemetry.io/otel/api/metric/updowncounter.go
new file mode 100644
index 0000000..1018246
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/api/metric/updowncounter.go
@@ -0,0 +1,96 @@
+// 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 (
+ "context"
+
+ "go.opentelemetry.io/otel/label"
+)
+
+// Float64UpDownCounter is a metric instrument that sums floating
+// point values.
+type Float64UpDownCounter struct {
+ syncInstrument
+}
+
+// Int64UpDownCounter is a metric instrument that sums integer values.
+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 ...label.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 ...label.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 {
+ return c.float64Measurement(value)
+}
+
+// Measurement creates a Measurement object to use with batch
+// recording.
+func (c Int64UpDownCounter) Measurement(value int64) Measurement {
+ return c.int64Measurement(value)
+}
+
+// Add adds the value to the counter's sum. The labels should contain
+// the keys and values to be associated with this value.
+func (c Float64UpDownCounter) Add(ctx context.Context, value float64, labels ...label.KeyValue) {
+ c.directRecord(ctx, NewFloat64Number(value), labels)
+}
+
+// Add adds the value to the counter's sum. The labels should contain
+// the keys and values to be associated with this value.
+func (c Int64UpDownCounter) Add(ctx context.Context, value int64, labels ...label.KeyValue) {
+ c.directRecord(ctx, 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, 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, NewInt64Number(value))
+}
diff --git a/vendor/go.opentelemetry.io/otel/api/metric/valuerecorder.go b/vendor/go.opentelemetry.io/otel/api/metric/valuerecorder.go
new file mode 100644
index 0000000..fa7e2d4
--- /dev/null
+++ b/vendor/go.opentelemetry.io/otel/api/metric/valuerecorder.go
@@ -0,0 +1,97 @@
+// 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 (
+ "context"
+
+ "go.opentelemetry.io/otel/label"
+)
+
+// Float64ValueRecorder is a metric that records float64 values.
+type Float64ValueRecorder struct {
+ syncInstrument
+}
+
+// Int64ValueRecorder is a metric that records int64 values.
+type Int64ValueRecorder struct {
+ syncInstrument
+}
+
+// BoundFloat64ValueRecorder is a bound instrument for Float64ValueRecorder.
+//
+// It inherits the Unbind function from syncBoundInstrument.
+type BoundFloat64ValueRecorder struct {
+ syncBoundInstrument
+}
+
+// BoundInt64ValueRecorder is a bound instrument for Int64ValueRecorder.
+//
+// It inherits the Unbind function from syncBoundInstrument.
+type BoundInt64ValueRecorder struct {
+ syncBoundInstrument
+}
+
+// Bind creates a bound instrument for this ValueRecorder. The labels are
+// associated with values recorded via subsequent calls to Record.
+func (c Float64ValueRecorder) Bind(labels ...label.KeyValue) (h BoundFloat64ValueRecorder) {
+ h.syncBoundInstrument = c.bind(labels)
+ return
+}
+
+// Bind creates a bound instrument for this ValueRecorder. The labels are
+// associated with values recorded via subsequent calls to Record.
+func (c Int64ValueRecorder) Bind(labels ...label.KeyValue) (h BoundInt64ValueRecorder) {
+ h.syncBoundInstrument = c.bind(labels)
+ return
+}
+
+// Measurement creates a Measurement object to use with batch
+// recording.
+func (c Float64ValueRecorder) Measurement(value float64) Measurement {
+ return c.float64Measurement(value)
+}
+
+// Measurement creates a Measurement object to use with batch
+// recording.
+func (c Int64ValueRecorder) Measurement(value int64) Measurement {
+ return c.int64Measurement(value)
+}
+
+// Record adds a new value to the list of ValueRecorder's records. The
+// labels should contain the keys and values to be associated with
+// this value.
+func (c Float64ValueRecorder) Record(ctx context.Context, value float64, labels ...label.KeyValue) {
+ c.directRecord(ctx, NewFloat64Number(value), labels)
+}
+
+// Record adds a new value to the ValueRecorder's distribution. The
+// labels should contain the keys and values to be associated with
+// this value.
+func (c Int64ValueRecorder) Record(ctx context.Context, value int64, labels ...label.KeyValue) {
+ c.directRecord(ctx, NewInt64Number(value), labels)
+}
+
+// Record adds a new value to the ValueRecorder's distribution using the labels
+// previously bound to the ValueRecorder via Bind().
+func (b BoundFloat64ValueRecorder) Record(ctx context.Context, value float64) {
+ b.directRecord(ctx, NewFloat64Number(value))
+}
+
+// Record adds a new value to the ValueRecorder's distribution using the labels
+// previously bound to the ValueRecorder via Bind().
+func (b BoundInt64ValueRecorder) Record(ctx context.Context, value int64) {
+ b.directRecord(ctx, NewInt64Number(value))
+}