diff options
Diffstat (limited to 'vendor/go.opentelemetry.io/otel/metric/internal/global/instruments.go')
-rw-r--r-- | vendor/go.opentelemetry.io/otel/metric/internal/global/instruments.go | 167 |
1 files changed, 81 insertions, 86 deletions
diff --git a/vendor/go.opentelemetry.io/otel/metric/internal/global/instruments.go b/vendor/go.opentelemetry.io/otel/metric/internal/global/instruments.go index a3b898bfd..d1480fa5f 100644 --- a/vendor/go.opentelemetry.io/otel/metric/internal/global/instruments.go +++ b/vendor/go.opentelemetry.io/otel/metric/internal/global/instruments.go @@ -19,27 +19,27 @@ import ( "sync/atomic" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/embedded" + "go.opentelemetry.io/otel/metric/instrument" ) // unwrapper unwraps to return the underlying instrument implementation. type unwrapper interface { - Unwrap() metric.Observable + Unwrap() instrument.Asynchronous } type afCounter struct { - embedded.Float64ObservableCounter - metric.Float64Observable + instrument.Float64Observable name string - opts []metric.Float64ObservableCounterOption + opts []instrument.Float64ObserverOption - delegate atomic.Value //metric.Float64ObservableCounter + delegate atomic.Value //instrument.Float64ObservableCounter } var _ unwrapper = (*afCounter)(nil) -var _ metric.Float64ObservableCounter = (*afCounter)(nil) +var _ instrument.Float64ObservableCounter = (*afCounter)(nil) func (i *afCounter) setDelegate(m metric.Meter) { ctr, err := m.Float64ObservableCounter(i.name, i.opts...) @@ -50,25 +50,24 @@ func (i *afCounter) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *afCounter) Unwrap() metric.Observable { +func (i *afCounter) Unwrap() instrument.Asynchronous { if ctr := i.delegate.Load(); ctr != nil { - return ctr.(metric.Float64ObservableCounter) + return ctr.(instrument.Float64ObservableCounter) } return nil } type afUpDownCounter struct { - embedded.Float64ObservableUpDownCounter - metric.Float64Observable + instrument.Float64Observable name string - opts []metric.Float64ObservableUpDownCounterOption + opts []instrument.Float64ObserverOption - delegate atomic.Value //metric.Float64ObservableUpDownCounter + delegate atomic.Value //instrument.Float64ObservableUpDownCounter } var _ unwrapper = (*afUpDownCounter)(nil) -var _ metric.Float64ObservableUpDownCounter = (*afUpDownCounter)(nil) +var _ instrument.Float64ObservableUpDownCounter = (*afUpDownCounter)(nil) func (i *afUpDownCounter) setDelegate(m metric.Meter) { ctr, err := m.Float64ObservableUpDownCounter(i.name, i.opts...) @@ -79,25 +78,24 @@ func (i *afUpDownCounter) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *afUpDownCounter) Unwrap() metric.Observable { +func (i *afUpDownCounter) Unwrap() instrument.Asynchronous { if ctr := i.delegate.Load(); ctr != nil { - return ctr.(metric.Float64ObservableUpDownCounter) + return ctr.(instrument.Float64ObservableUpDownCounter) } return nil } type afGauge struct { - embedded.Float64ObservableGauge - metric.Float64Observable + instrument.Float64Observable name string - opts []metric.Float64ObservableGaugeOption + opts []instrument.Float64ObserverOption - delegate atomic.Value //metric.Float64ObservableGauge + delegate atomic.Value //instrument.Float64ObservableGauge } var _ unwrapper = (*afGauge)(nil) -var _ metric.Float64ObservableGauge = (*afGauge)(nil) +var _ instrument.Float64ObservableGauge = (*afGauge)(nil) func (i *afGauge) setDelegate(m metric.Meter) { ctr, err := m.Float64ObservableGauge(i.name, i.opts...) @@ -108,25 +106,24 @@ func (i *afGauge) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *afGauge) Unwrap() metric.Observable { +func (i *afGauge) Unwrap() instrument.Asynchronous { if ctr := i.delegate.Load(); ctr != nil { - return ctr.(metric.Float64ObservableGauge) + return ctr.(instrument.Float64ObservableGauge) } return nil } type aiCounter struct { - embedded.Int64ObservableCounter - metric.Int64Observable + instrument.Int64Observable name string - opts []metric.Int64ObservableCounterOption + opts []instrument.Int64ObserverOption - delegate atomic.Value //metric.Int64ObservableCounter + delegate atomic.Value //instrument.Int64ObservableCounter } var _ unwrapper = (*aiCounter)(nil) -var _ metric.Int64ObservableCounter = (*aiCounter)(nil) +var _ instrument.Int64ObservableCounter = (*aiCounter)(nil) func (i *aiCounter) setDelegate(m metric.Meter) { ctr, err := m.Int64ObservableCounter(i.name, i.opts...) @@ -137,25 +134,24 @@ func (i *aiCounter) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *aiCounter) Unwrap() metric.Observable { +func (i *aiCounter) Unwrap() instrument.Asynchronous { if ctr := i.delegate.Load(); ctr != nil { - return ctr.(metric.Int64ObservableCounter) + return ctr.(instrument.Int64ObservableCounter) } return nil } type aiUpDownCounter struct { - embedded.Int64ObservableUpDownCounter - metric.Int64Observable + instrument.Int64Observable name string - opts []metric.Int64ObservableUpDownCounterOption + opts []instrument.Int64ObserverOption - delegate atomic.Value //metric.Int64ObservableUpDownCounter + delegate atomic.Value //instrument.Int64ObservableUpDownCounter } var _ unwrapper = (*aiUpDownCounter)(nil) -var _ metric.Int64ObservableUpDownCounter = (*aiUpDownCounter)(nil) +var _ instrument.Int64ObservableUpDownCounter = (*aiUpDownCounter)(nil) func (i *aiUpDownCounter) setDelegate(m metric.Meter) { ctr, err := m.Int64ObservableUpDownCounter(i.name, i.opts...) @@ -166,25 +162,24 @@ func (i *aiUpDownCounter) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *aiUpDownCounter) Unwrap() metric.Observable { +func (i *aiUpDownCounter) Unwrap() instrument.Asynchronous { if ctr := i.delegate.Load(); ctr != nil { - return ctr.(metric.Int64ObservableUpDownCounter) + return ctr.(instrument.Int64ObservableUpDownCounter) } return nil } type aiGauge struct { - embedded.Int64ObservableGauge - metric.Int64Observable + instrument.Int64Observable name string - opts []metric.Int64ObservableGaugeOption + opts []instrument.Int64ObserverOption - delegate atomic.Value //metric.Int64ObservableGauge + delegate atomic.Value //instrument.Int64ObservableGauge } var _ unwrapper = (*aiGauge)(nil) -var _ metric.Int64ObservableGauge = (*aiGauge)(nil) +var _ instrument.Int64ObservableGauge = (*aiGauge)(nil) func (i *aiGauge) setDelegate(m metric.Meter) { ctr, err := m.Int64ObservableGauge(i.name, i.opts...) @@ -195,24 +190,24 @@ func (i *aiGauge) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *aiGauge) Unwrap() metric.Observable { +func (i *aiGauge) Unwrap() instrument.Asynchronous { if ctr := i.delegate.Load(); ctr != nil { - return ctr.(metric.Int64ObservableGauge) + return ctr.(instrument.Int64ObservableGauge) } return nil } // Sync Instruments. type sfCounter struct { - embedded.Float64Counter - name string - opts []metric.Float64CounterOption + opts []instrument.Float64Option + + delegate atomic.Value //instrument.Float64Counter - delegate atomic.Value //metric.Float64Counter + instrument.Synchronous } -var _ metric.Float64Counter = (*sfCounter)(nil) +var _ instrument.Float64Counter = (*sfCounter)(nil) func (i *sfCounter) setDelegate(m metric.Meter) { ctr, err := m.Float64Counter(i.name, i.opts...) @@ -223,22 +218,22 @@ func (i *sfCounter) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *sfCounter) Add(ctx context.Context, incr float64, opts ...metric.AddOption) { +func (i *sfCounter) Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) { if ctr := i.delegate.Load(); ctr != nil { - ctr.(metric.Float64Counter).Add(ctx, incr, opts...) + ctr.(instrument.Float64Counter).Add(ctx, incr, attrs...) } } type sfUpDownCounter struct { - embedded.Float64UpDownCounter - name string - opts []metric.Float64UpDownCounterOption + opts []instrument.Float64Option - delegate atomic.Value //metric.Float64UpDownCounter + delegate atomic.Value //instrument.Float64UpDownCounter + + instrument.Synchronous } -var _ metric.Float64UpDownCounter = (*sfUpDownCounter)(nil) +var _ instrument.Float64UpDownCounter = (*sfUpDownCounter)(nil) func (i *sfUpDownCounter) setDelegate(m metric.Meter) { ctr, err := m.Float64UpDownCounter(i.name, i.opts...) @@ -249,22 +244,22 @@ func (i *sfUpDownCounter) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *sfUpDownCounter) Add(ctx context.Context, incr float64, opts ...metric.AddOption) { +func (i *sfUpDownCounter) Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) { if ctr := i.delegate.Load(); ctr != nil { - ctr.(metric.Float64UpDownCounter).Add(ctx, incr, opts...) + ctr.(instrument.Float64UpDownCounter).Add(ctx, incr, attrs...) } } type sfHistogram struct { - embedded.Float64Histogram - name string - opts []metric.Float64HistogramOption + opts []instrument.Float64Option + + delegate atomic.Value //instrument.Float64Histogram - delegate atomic.Value //metric.Float64Histogram + instrument.Synchronous } -var _ metric.Float64Histogram = (*sfHistogram)(nil) +var _ instrument.Float64Histogram = (*sfHistogram)(nil) func (i *sfHistogram) setDelegate(m metric.Meter) { ctr, err := m.Float64Histogram(i.name, i.opts...) @@ -275,22 +270,22 @@ func (i *sfHistogram) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *sfHistogram) Record(ctx context.Context, x float64, opts ...metric.RecordOption) { +func (i *sfHistogram) Record(ctx context.Context, x float64, attrs ...attribute.KeyValue) { if ctr := i.delegate.Load(); ctr != nil { - ctr.(metric.Float64Histogram).Record(ctx, x, opts...) + ctr.(instrument.Float64Histogram).Record(ctx, x, attrs...) } } type siCounter struct { - embedded.Int64Counter - name string - opts []metric.Int64CounterOption + opts []instrument.Int64Option + + delegate atomic.Value //instrument.Int64Counter - delegate atomic.Value //metric.Int64Counter + instrument.Synchronous } -var _ metric.Int64Counter = (*siCounter)(nil) +var _ instrument.Int64Counter = (*siCounter)(nil) func (i *siCounter) setDelegate(m metric.Meter) { ctr, err := m.Int64Counter(i.name, i.opts...) @@ -301,22 +296,22 @@ func (i *siCounter) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *siCounter) Add(ctx context.Context, x int64, opts ...metric.AddOption) { +func (i *siCounter) Add(ctx context.Context, x int64, attrs ...attribute.KeyValue) { if ctr := i.delegate.Load(); ctr != nil { - ctr.(metric.Int64Counter).Add(ctx, x, opts...) + ctr.(instrument.Int64Counter).Add(ctx, x, attrs...) } } type siUpDownCounter struct { - embedded.Int64UpDownCounter - name string - opts []metric.Int64UpDownCounterOption + opts []instrument.Int64Option - delegate atomic.Value //metric.Int64UpDownCounter + delegate atomic.Value //instrument.Int64UpDownCounter + + instrument.Synchronous } -var _ metric.Int64UpDownCounter = (*siUpDownCounter)(nil) +var _ instrument.Int64UpDownCounter = (*siUpDownCounter)(nil) func (i *siUpDownCounter) setDelegate(m metric.Meter) { ctr, err := m.Int64UpDownCounter(i.name, i.opts...) @@ -327,22 +322,22 @@ func (i *siUpDownCounter) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *siUpDownCounter) Add(ctx context.Context, x int64, opts ...metric.AddOption) { +func (i *siUpDownCounter) Add(ctx context.Context, x int64, attrs ...attribute.KeyValue) { if ctr := i.delegate.Load(); ctr != nil { - ctr.(metric.Int64UpDownCounter).Add(ctx, x, opts...) + ctr.(instrument.Int64UpDownCounter).Add(ctx, x, attrs...) } } type siHistogram struct { - embedded.Int64Histogram - name string - opts []metric.Int64HistogramOption + opts []instrument.Int64Option + + delegate atomic.Value //instrument.Int64Histogram - delegate atomic.Value //metric.Int64Histogram + instrument.Synchronous } -var _ metric.Int64Histogram = (*siHistogram)(nil) +var _ instrument.Int64Histogram = (*siHistogram)(nil) func (i *siHistogram) setDelegate(m metric.Meter) { ctr, err := m.Int64Histogram(i.name, i.opts...) @@ -353,8 +348,8 @@ func (i *siHistogram) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *siHistogram) Record(ctx context.Context, x int64, opts ...metric.RecordOption) { +func (i *siHistogram) Record(ctx context.Context, x int64, attrs ...attribute.KeyValue) { if ctr := i.delegate.Load(); ctr != nil { - ctr.(metric.Int64Histogram).Record(ctx, x, opts...) + ctr.(instrument.Int64Histogram).Record(ctx, x, attrs...) } } |