chore: upgrade dependencies
This commit is contained in:
70
vendor/go.opentelemetry.io/otel/sdk/metric/sdkapi/descriptor.go
generated
vendored
Normal file
70
vendor/go.opentelemetry.io/otel/sdk/metric/sdkapi/descriptor.go
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
// 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 sdkapi // import "go.opentelemetry.io/otel/sdk/metric/sdkapi"
|
||||
|
||||
import (
|
||||
"go.opentelemetry.io/otel/metric/unit"
|
||||
"go.opentelemetry.io/otel/sdk/metric/number"
|
||||
)
|
||||
|
||||
// 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
|
||||
instrumentKind InstrumentKind
|
||||
numberKind number.Kind
|
||||
description string
|
||||
unit unit.Unit
|
||||
}
|
||||
|
||||
// NewDescriptor returns a Descriptor with the given contents.
|
||||
func NewDescriptor(name string, ikind InstrumentKind, nkind number.Kind, description string, unit unit.Unit) Descriptor {
|
||||
return Descriptor{
|
||||
name: name,
|
||||
instrumentKind: ikind,
|
||||
numberKind: nkind,
|
||||
description: description,
|
||||
unit: unit,
|
||||
}
|
||||
}
|
||||
|
||||
// Name returns the metric instrument's name.
|
||||
func (d Descriptor) Name() string {
|
||||
return d.name
|
||||
}
|
||||
|
||||
// InstrumentKind returns the specific kind of instrument.
|
||||
func (d Descriptor) InstrumentKind() InstrumentKind {
|
||||
return d.instrumentKind
|
||||
}
|
||||
|
||||
// Description provides a human-readable description of the metric
|
||||
// instrument.
|
||||
func (d Descriptor) Description() string {
|
||||
return d.description
|
||||
}
|
||||
|
||||
// Unit describes the units of the metric instrument. Unitless
|
||||
// metrics return the empty string.
|
||||
func (d Descriptor) Unit() unit.Unit {
|
||||
return d.unit
|
||||
}
|
||||
|
||||
// NumberKind returns whether this instrument is declared over int64,
|
||||
// float64, or uint64 values.
|
||||
func (d Descriptor) NumberKind() number.Kind {
|
||||
return d.numberKind
|
||||
}
|
80
vendor/go.opentelemetry.io/otel/sdk/metric/sdkapi/instrumentkind.go
generated
vendored
Normal file
80
vendor/go.opentelemetry.io/otel/sdk/metric/sdkapi/instrumentkind.go
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
// 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=InstrumentKind
|
||||
|
||||
package sdkapi // import "go.opentelemetry.io/otel/sdk/metric/sdkapi"
|
||||
|
||||
// InstrumentKind describes the kind of instrument.
|
||||
type InstrumentKind int8
|
||||
|
||||
const (
|
||||
// HistogramInstrumentKind indicates a Histogram instrument.
|
||||
HistogramInstrumentKind InstrumentKind = iota
|
||||
// GaugeObserverInstrumentKind indicates an GaugeObserver instrument.
|
||||
GaugeObserverInstrumentKind
|
||||
|
||||
// CounterInstrumentKind indicates a Counter instrument.
|
||||
CounterInstrumentKind
|
||||
// UpDownCounterInstrumentKind indicates a UpDownCounter instrument.
|
||||
UpDownCounterInstrumentKind
|
||||
|
||||
// CounterObserverInstrumentKind indicates a CounterObserver instrument.
|
||||
CounterObserverInstrumentKind
|
||||
// UpDownCounterObserverInstrumentKind indicates a UpDownCounterObserver
|
||||
// instrument.
|
||||
UpDownCounterObserverInstrumentKind
|
||||
)
|
||||
|
||||
// Synchronous returns whether this is a synchronous kind of instrument.
|
||||
func (k InstrumentKind) Synchronous() bool {
|
||||
switch k {
|
||||
case CounterInstrumentKind, UpDownCounterInstrumentKind, HistogramInstrumentKind:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Asynchronous returns whether this is an asynchronous kind of instrument.
|
||||
func (k InstrumentKind) Asynchronous() bool {
|
||||
return !k.Synchronous()
|
||||
}
|
||||
|
||||
// Adding returns whether this kind of instrument adds its inputs (as opposed to Grouping).
|
||||
func (k InstrumentKind) Adding() bool {
|
||||
switch k {
|
||||
case CounterInstrumentKind, UpDownCounterInstrumentKind, CounterObserverInstrumentKind, UpDownCounterObserverInstrumentKind:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Grouping returns whether this kind of instrument groups its inputs (as opposed to Adding).
|
||||
func (k InstrumentKind) Grouping() bool {
|
||||
return !k.Adding()
|
||||
}
|
||||
|
||||
// Monotonic returns whether this kind of instrument exposes a non-decreasing sum.
|
||||
func (k InstrumentKind) Monotonic() bool {
|
||||
switch k {
|
||||
case CounterInstrumentKind, CounterObserverInstrumentKind:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// PrecomputedSum returns whether this kind of instrument receives precomputed sums.
|
||||
func (k InstrumentKind) PrecomputedSum() bool {
|
||||
return k.Adding() && k.Asynchronous()
|
||||
}
|
28
vendor/go.opentelemetry.io/otel/sdk/metric/sdkapi/instrumentkind_string.go
generated
vendored
Normal file
28
vendor/go.opentelemetry.io/otel/sdk/metric/sdkapi/instrumentkind_string.go
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
// Code generated by "stringer -type=InstrumentKind"; DO NOT EDIT.
|
||||
|
||||
package sdkapi
|
||||
|
||||
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[HistogramInstrumentKind-0]
|
||||
_ = x[GaugeObserverInstrumentKind-1]
|
||||
_ = x[CounterInstrumentKind-2]
|
||||
_ = x[UpDownCounterInstrumentKind-3]
|
||||
_ = x[CounterObserverInstrumentKind-4]
|
||||
_ = x[UpDownCounterObserverInstrumentKind-5]
|
||||
}
|
||||
|
||||
const _InstrumentKind_name = "HistogramInstrumentKindGaugeObserverInstrumentKindCounterInstrumentKindUpDownCounterInstrumentKindCounterObserverInstrumentKindUpDownCounterObserverInstrumentKind"
|
||||
|
||||
var _InstrumentKind_index = [...]uint8{0, 23, 50, 71, 98, 127, 162}
|
||||
|
||||
func (i InstrumentKind) String() string {
|
||||
if i < 0 || i >= InstrumentKind(len(_InstrumentKind_index)-1) {
|
||||
return "InstrumentKind(" + strconv.FormatInt(int64(i), 10) + ")"
|
||||
}
|
||||
return _InstrumentKind_name[_InstrumentKind_index[i]:_InstrumentKind_index[i+1]]
|
||||
}
|
83
vendor/go.opentelemetry.io/otel/sdk/metric/sdkapi/noop.go
generated
vendored
Normal file
83
vendor/go.opentelemetry.io/otel/sdk/metric/sdkapi/noop.go
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
// 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 sdkapi // import "go.opentelemetry.io/otel/sdk/metric/sdkapi"
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/metric/instrument"
|
||||
"go.opentelemetry.io/otel/sdk/metric/number"
|
||||
) // import (
|
||||
// "context"
|
||||
|
||||
// "go.opentelemetry.io/otel/attribute"
|
||||
// "go.opentelemetry.io/otel/sdk/metric/number"
|
||||
// )
|
||||
|
||||
type noopInstrument struct {
|
||||
descriptor Descriptor
|
||||
}
|
||||
type noopSyncInstrument struct {
|
||||
noopInstrument
|
||||
|
||||
instrument.Synchronous
|
||||
}
|
||||
type noopAsyncInstrument struct {
|
||||
noopInstrument
|
||||
|
||||
instrument.Asynchronous
|
||||
}
|
||||
|
||||
var _ SyncImpl = noopSyncInstrument{}
|
||||
var _ AsyncImpl = noopAsyncInstrument{}
|
||||
|
||||
// NewNoopSyncInstrument returns a No-op implementation of the
|
||||
// synchronous instrument interface.
|
||||
func NewNoopSyncInstrument() SyncImpl {
|
||||
return noopSyncInstrument{
|
||||
noopInstrument: noopInstrument{
|
||||
descriptor: Descriptor{
|
||||
instrumentKind: CounterInstrumentKind,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// NewNoopAsyncInstrument returns a No-op implementation of the
|
||||
// asynchronous instrument interface.
|
||||
func NewNoopAsyncInstrument() AsyncImpl {
|
||||
return noopAsyncInstrument{
|
||||
noopInstrument: noopInstrument{
|
||||
descriptor: Descriptor{
|
||||
instrumentKind: CounterObserverInstrumentKind,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (noopInstrument) Implementation() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n noopInstrument) Descriptor() Descriptor {
|
||||
return n.descriptor
|
||||
}
|
||||
|
||||
func (noopSyncInstrument) RecordOne(context.Context, number.Number, []attribute.KeyValue) {
|
||||
}
|
||||
|
||||
func (noopAsyncInstrument) ObserveOne(context.Context, number.Number, []attribute.KeyValue) {
|
||||
}
|
162
vendor/go.opentelemetry.io/otel/sdk/metric/sdkapi/sdkapi.go
generated
vendored
Normal file
162
vendor/go.opentelemetry.io/otel/sdk/metric/sdkapi/sdkapi.go
generated
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
// 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 sdkapi // import "go.opentelemetry.io/otel/sdk/metric/sdkapi"
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/metric/instrument"
|
||||
"go.opentelemetry.io/otel/sdk/metric/number"
|
||||
)
|
||||
|
||||
// MeterImpl is the interface an SDK must implement to supply a Meter
|
||||
// implementation.
|
||||
type MeterImpl interface {
|
||||
// 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) (AsyncImpl, error)
|
||||
|
||||
// Etc.
|
||||
RegisterCallback(insts []instrument.Asynchronous, callback func(context.Context)) 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., Histogram and Counter instruments).
|
||||
type SyncImpl interface {
|
||||
InstrumentImpl
|
||||
instrument.Synchronous
|
||||
|
||||
// RecordOne captures a single synchronous metric event.
|
||||
RecordOne(ctx context.Context, number number.Number, attrs []attribute.KeyValue)
|
||||
}
|
||||
|
||||
// AsyncImpl is an implementation-level interface to an
|
||||
// asynchronous instrument (e.g., Observer instruments).
|
||||
type AsyncImpl interface {
|
||||
InstrumentImpl
|
||||
instrument.Asynchronous
|
||||
|
||||
// ObserveOne captures a single synchronous metric event.
|
||||
ObserveOne(ctx context.Context, number number.Number, attrs []attribute.KeyValue)
|
||||
}
|
||||
|
||||
// AsyncRunner is expected to convert into an AsyncSingleRunner or an
|
||||
// AsyncBatchRunner. SDKs will encounter an error if the AsyncRunner
|
||||
// does not satisfy one of these interfaces.
|
||||
type AsyncRunner interface {
|
||||
// AnyRunner is a non-exported method with no functional use
|
||||
// other than to make this a non-empty interface.
|
||||
AnyRunner()
|
||||
}
|
||||
|
||||
// AsyncSingleRunner is an interface implemented by single-observer
|
||||
// callbacks.
|
||||
type AsyncSingleRunner interface {
|
||||
// Run accepts a single instrument and function for capturing
|
||||
// observations of that instrument. Each call to the function
|
||||
// receives one captured observation. (The function accepts
|
||||
// multiple observations so the same implementation can be
|
||||
// used for batch runners.)
|
||||
Run(ctx context.Context, single AsyncImpl, capture func([]attribute.KeyValue, ...Observation))
|
||||
|
||||
AsyncRunner
|
||||
}
|
||||
|
||||
// AsyncBatchRunner is an interface implemented by batch-observer
|
||||
// callbacks.
|
||||
type AsyncBatchRunner interface {
|
||||
// Run accepts a function for capturing observations of
|
||||
// multiple instruments.
|
||||
Run(ctx context.Context, capture func([]attribute.KeyValue, ...Observation))
|
||||
|
||||
AsyncRunner
|
||||
}
|
||||
|
||||
// NewMeasurement constructs a single observation, a binding between
|
||||
// an asynchronous instrument and a number.
|
||||
func NewMeasurement(instrument SyncImpl, number number.Number) Measurement {
|
||||
return Measurement{
|
||||
instrument: instrument,
|
||||
number: number,
|
||||
}
|
||||
}
|
||||
|
||||
// Measurement is a low-level type used with synchronous instruments
|
||||
// as a direct interface to the SDK via `RecordBatch`.
|
||||
type Measurement struct {
|
||||
// number needs to be aligned for 64-bit atomic operations.
|
||||
number number.Number
|
||||
instrument SyncImpl
|
||||
}
|
||||
|
||||
// SyncImpl returns the instrument that created this measurement.
|
||||
// This returns an implementation-level object for use by the SDK,
|
||||
// users should not refer to this.
|
||||
func (m Measurement) SyncImpl() SyncImpl {
|
||||
return m.instrument
|
||||
}
|
||||
|
||||
// Number returns a number recorded in this measurement.
|
||||
func (m Measurement) Number() number.Number {
|
||||
return m.number
|
||||
}
|
||||
|
||||
// NewObservation constructs a single observation, a binding between
|
||||
// an asynchronous instrument and a number.
|
||||
func NewObservation(instrument AsyncImpl, number number.Number) Observation {
|
||||
return Observation{
|
||||
instrument: instrument,
|
||||
number: number,
|
||||
}
|
||||
}
|
||||
|
||||
// Observation is a low-level type used with asynchronous instruments
|
||||
// as a direct interface to the SDK via `BatchObserver`.
|
||||
type Observation struct {
|
||||
// number needs to be aligned for 64-bit atomic operations.
|
||||
number number.Number
|
||||
instrument AsyncImpl
|
||||
}
|
||||
|
||||
// AsyncImpl returns the instrument that created this observation.
|
||||
// This returns an implementation-level object for use by the SDK,
|
||||
// users should not refer to this.
|
||||
func (m Observation) AsyncImpl() AsyncImpl {
|
||||
return m.instrument
|
||||
}
|
||||
|
||||
// Number returns a number recorded in this observation.
|
||||
func (m Observation) Number() number.Number {
|
||||
return m.number
|
||||
}
|
181
vendor/go.opentelemetry.io/otel/sdk/metric/sdkapi/wrap.go
generated
vendored
Normal file
181
vendor/go.opentelemetry.io/otel/sdk/metric/sdkapi/wrap.go
generated
vendored
Normal file
@@ -0,0 +1,181 @@
|
||||
// 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 sdkapi // import "go.opentelemetry.io/otel/sdk/metric/sdkapi"
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
"go.opentelemetry.io/otel/metric/instrument"
|
||||
"go.opentelemetry.io/otel/metric/instrument/asyncfloat64"
|
||||
"go.opentelemetry.io/otel/metric/instrument/asyncint64"
|
||||
"go.opentelemetry.io/otel/metric/instrument/syncfloat64"
|
||||
"go.opentelemetry.io/otel/metric/instrument/syncint64"
|
||||
"go.opentelemetry.io/otel/sdk/metric/number"
|
||||
)
|
||||
|
||||
type (
|
||||
meter struct{ MeterImpl }
|
||||
sfMeter struct{ meter }
|
||||
siMeter struct{ meter }
|
||||
afMeter struct{ meter }
|
||||
aiMeter struct{ meter }
|
||||
|
||||
iAdder struct{ SyncImpl }
|
||||
fAdder struct{ SyncImpl }
|
||||
iRecorder struct{ SyncImpl }
|
||||
fRecorder struct{ SyncImpl }
|
||||
iObserver struct{ AsyncImpl }
|
||||
fObserver struct{ AsyncImpl }
|
||||
)
|
||||
|
||||
func WrapMeterImpl(impl MeterImpl) metric.Meter {
|
||||
return meter{impl}
|
||||
}
|
||||
|
||||
func UnwrapMeterImpl(m metric.Meter) MeterImpl {
|
||||
mm, ok := m.(meter)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
return mm.MeterImpl
|
||||
}
|
||||
|
||||
func (m meter) AsyncFloat64() asyncfloat64.InstrumentProvider {
|
||||
return afMeter{m}
|
||||
}
|
||||
|
||||
func (m meter) AsyncInt64() asyncint64.InstrumentProvider {
|
||||
return aiMeter{m}
|
||||
}
|
||||
|
||||
func (m meter) SyncFloat64() syncfloat64.InstrumentProvider {
|
||||
return sfMeter{m}
|
||||
}
|
||||
|
||||
func (m meter) SyncInt64() syncint64.InstrumentProvider {
|
||||
return siMeter{m}
|
||||
}
|
||||
|
||||
func (m meter) RegisterCallback(insts []instrument.Asynchronous, cb func(ctx context.Context)) error {
|
||||
return m.MeterImpl.RegisterCallback(insts, cb)
|
||||
}
|
||||
|
||||
func (m meter) newSync(name string, ikind InstrumentKind, nkind number.Kind, opts []instrument.Option) (SyncImpl, error) {
|
||||
cfg := instrument.NewConfig(opts...)
|
||||
return m.NewSyncInstrument(NewDescriptor(name, ikind, nkind, cfg.Description(), cfg.Unit()))
|
||||
}
|
||||
|
||||
func (m meter) newAsync(name string, ikind InstrumentKind, nkind number.Kind, opts []instrument.Option) (AsyncImpl, error) {
|
||||
cfg := instrument.NewConfig(opts...)
|
||||
return m.NewAsyncInstrument(NewDescriptor(name, ikind, nkind, cfg.Description(), cfg.Unit()))
|
||||
}
|
||||
|
||||
func (m afMeter) Counter(name string, opts ...instrument.Option) (asyncfloat64.Counter, error) {
|
||||
inst, err := m.newAsync(name, CounterObserverInstrumentKind, number.Float64Kind, opts)
|
||||
return fObserver{inst}, err
|
||||
}
|
||||
|
||||
func (m afMeter) UpDownCounter(name string, opts ...instrument.Option) (asyncfloat64.UpDownCounter, error) {
|
||||
inst, err := m.newAsync(name, UpDownCounterObserverInstrumentKind, number.Float64Kind, opts)
|
||||
return fObserver{inst}, err
|
||||
}
|
||||
|
||||
func (m afMeter) Gauge(name string, opts ...instrument.Option) (asyncfloat64.Gauge, error) {
|
||||
inst, err := m.newAsync(name, GaugeObserverInstrumentKind, number.Float64Kind, opts)
|
||||
return fObserver{inst}, err
|
||||
}
|
||||
|
||||
func (m aiMeter) Counter(name string, opts ...instrument.Option) (asyncint64.Counter, error) {
|
||||
inst, err := m.newAsync(name, CounterObserverInstrumentKind, number.Int64Kind, opts)
|
||||
return iObserver{inst}, err
|
||||
}
|
||||
|
||||
func (m aiMeter) UpDownCounter(name string, opts ...instrument.Option) (asyncint64.UpDownCounter, error) {
|
||||
inst, err := m.newAsync(name, UpDownCounterObserverInstrumentKind, number.Int64Kind, opts)
|
||||
return iObserver{inst}, err
|
||||
}
|
||||
|
||||
func (m aiMeter) Gauge(name string, opts ...instrument.Option) (asyncint64.Gauge, error) {
|
||||
inst, err := m.newAsync(name, GaugeObserverInstrumentKind, number.Int64Kind, opts)
|
||||
return iObserver{inst}, err
|
||||
}
|
||||
|
||||
func (m sfMeter) Counter(name string, opts ...instrument.Option) (syncfloat64.Counter, error) {
|
||||
inst, err := m.newSync(name, CounterInstrumentKind, number.Float64Kind, opts)
|
||||
return fAdder{inst}, err
|
||||
}
|
||||
|
||||
func (m sfMeter) UpDownCounter(name string, opts ...instrument.Option) (syncfloat64.UpDownCounter, error) {
|
||||
inst, err := m.newSync(name, UpDownCounterInstrumentKind, number.Float64Kind, opts)
|
||||
return fAdder{inst}, err
|
||||
}
|
||||
|
||||
func (m sfMeter) Histogram(name string, opts ...instrument.Option) (syncfloat64.Histogram, error) {
|
||||
inst, err := m.newSync(name, HistogramInstrumentKind, number.Float64Kind, opts)
|
||||
return fRecorder{inst}, err
|
||||
}
|
||||
|
||||
func (m siMeter) Counter(name string, opts ...instrument.Option) (syncint64.Counter, error) {
|
||||
inst, err := m.newSync(name, CounterInstrumentKind, number.Int64Kind, opts)
|
||||
return iAdder{inst}, err
|
||||
}
|
||||
|
||||
func (m siMeter) UpDownCounter(name string, opts ...instrument.Option) (syncint64.UpDownCounter, error) {
|
||||
inst, err := m.newSync(name, UpDownCounterInstrumentKind, number.Int64Kind, opts)
|
||||
return iAdder{inst}, err
|
||||
}
|
||||
|
||||
func (m siMeter) Histogram(name string, opts ...instrument.Option) (syncint64.Histogram, error) {
|
||||
inst, err := m.newSync(name, HistogramInstrumentKind, number.Int64Kind, opts)
|
||||
return iRecorder{inst}, err
|
||||
}
|
||||
|
||||
func (a fAdder) Add(ctx context.Context, value float64, attrs ...attribute.KeyValue) {
|
||||
if a.SyncImpl != nil {
|
||||
a.SyncImpl.RecordOne(ctx, number.NewFloat64Number(value), attrs)
|
||||
}
|
||||
}
|
||||
|
||||
func (a iAdder) Add(ctx context.Context, value int64, attrs ...attribute.KeyValue) {
|
||||
if a.SyncImpl != nil {
|
||||
a.SyncImpl.RecordOne(ctx, number.NewInt64Number(value), attrs)
|
||||
}
|
||||
}
|
||||
|
||||
func (a fRecorder) Record(ctx context.Context, value float64, attrs ...attribute.KeyValue) {
|
||||
if a.SyncImpl != nil {
|
||||
a.SyncImpl.RecordOne(ctx, number.NewFloat64Number(value), attrs)
|
||||
}
|
||||
}
|
||||
|
||||
func (a iRecorder) Record(ctx context.Context, value int64, attrs ...attribute.KeyValue) {
|
||||
if a.SyncImpl != nil {
|
||||
a.SyncImpl.RecordOne(ctx, number.NewInt64Number(value), attrs)
|
||||
}
|
||||
}
|
||||
|
||||
func (a fObserver) Observe(ctx context.Context, value float64, attrs ...attribute.KeyValue) {
|
||||
if a.AsyncImpl != nil {
|
||||
a.AsyncImpl.ObserveOne(ctx, number.NewFloat64Number(value), attrs)
|
||||
}
|
||||
}
|
||||
|
||||
func (a iObserver) Observe(ctx context.Context, value int64, attrs ...attribute.KeyValue) {
|
||||
if a.AsyncImpl != nil {
|
||||
a.AsyncImpl.ObserveOne(ctx, number.NewInt64Number(value), attrs)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user