[chore] Update a bunch of database dependencies (#1772)

* [chore] Update a bunch of database dependencies

* fix lil thing
This commit is contained in:
tobi 2023-05-12 14:33:40 +02:00 committed by GitHub
commit ec325fee14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
402 changed files with 35068 additions and 35401 deletions

View file

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

View file

@ -21,7 +21,7 @@ import (
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/metric"
"go.opentelemetry.io/otel/metric/instrument"
"go.opentelemetry.io/otel/metric/embedded"
)
// meterProvider is a placeholder for a configured SDK MeterProvider.
@ -29,6 +29,8 @@ import (
// All MeterProvider functionality is forwarded to a delegate once
// configured.
type meterProvider struct {
embedded.MeterProvider
mtx sync.Mutex
meters map[il]*meter
@ -100,6 +102,8 @@ func (p *meterProvider) Meter(name string, opts ...metric.MeterOption) metric.Me
// All Meter functionality is forwarded to a delegate once configured.
// Otherwise, all functionality is forwarded to a NoopMeter.
type meter struct {
embedded.Meter
name string
opts []metric.MeterOption
@ -142,7 +146,7 @@ func (m *meter) setDelegate(provider metric.MeterProvider) {
m.registry.Init()
}
func (m *meter) Int64Counter(name string, options ...instrument.Int64Option) (instrument.Int64Counter, error) {
func (m *meter) Int64Counter(name string, options ...metric.Int64CounterOption) (metric.Int64Counter, error) {
if del, ok := m.delegate.Load().(metric.Meter); ok {
return del.Int64Counter(name, options...)
}
@ -153,7 +157,7 @@ func (m *meter) Int64Counter(name string, options ...instrument.Int64Option) (in
return i, nil
}
func (m *meter) Int64UpDownCounter(name string, options ...instrument.Int64Option) (instrument.Int64UpDownCounter, error) {
func (m *meter) Int64UpDownCounter(name string, options ...metric.Int64UpDownCounterOption) (metric.Int64UpDownCounter, error) {
if del, ok := m.delegate.Load().(metric.Meter); ok {
return del.Int64UpDownCounter(name, options...)
}
@ -164,7 +168,7 @@ func (m *meter) Int64UpDownCounter(name string, options ...instrument.Int64Optio
return i, nil
}
func (m *meter) Int64Histogram(name string, options ...instrument.Int64Option) (instrument.Int64Histogram, error) {
func (m *meter) Int64Histogram(name string, options ...metric.Int64HistogramOption) (metric.Int64Histogram, error) {
if del, ok := m.delegate.Load().(metric.Meter); ok {
return del.Int64Histogram(name, options...)
}
@ -175,7 +179,7 @@ func (m *meter) Int64Histogram(name string, options ...instrument.Int64Option) (
return i, nil
}
func (m *meter) Int64ObservableCounter(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableCounter, error) {
func (m *meter) Int64ObservableCounter(name string, options ...metric.Int64ObservableCounterOption) (metric.Int64ObservableCounter, error) {
if del, ok := m.delegate.Load().(metric.Meter); ok {
return del.Int64ObservableCounter(name, options...)
}
@ -186,7 +190,7 @@ func (m *meter) Int64ObservableCounter(name string, options ...instrument.Int64O
return i, nil
}
func (m *meter) Int64ObservableUpDownCounter(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableUpDownCounter, error) {
func (m *meter) Int64ObservableUpDownCounter(name string, options ...metric.Int64ObservableUpDownCounterOption) (metric.Int64ObservableUpDownCounter, error) {
if del, ok := m.delegate.Load().(metric.Meter); ok {
return del.Int64ObservableUpDownCounter(name, options...)
}
@ -197,7 +201,7 @@ func (m *meter) Int64ObservableUpDownCounter(name string, options ...instrument.
return i, nil
}
func (m *meter) Int64ObservableGauge(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableGauge, error) {
func (m *meter) Int64ObservableGauge(name string, options ...metric.Int64ObservableGaugeOption) (metric.Int64ObservableGauge, error) {
if del, ok := m.delegate.Load().(metric.Meter); ok {
return del.Int64ObservableGauge(name, options...)
}
@ -208,7 +212,7 @@ func (m *meter) Int64ObservableGauge(name string, options ...instrument.Int64Obs
return i, nil
}
func (m *meter) Float64Counter(name string, options ...instrument.Float64Option) (instrument.Float64Counter, error) {
func (m *meter) Float64Counter(name string, options ...metric.Float64CounterOption) (metric.Float64Counter, error) {
if del, ok := m.delegate.Load().(metric.Meter); ok {
return del.Float64Counter(name, options...)
}
@ -219,7 +223,7 @@ func (m *meter) Float64Counter(name string, options ...instrument.Float64Option)
return i, nil
}
func (m *meter) Float64UpDownCounter(name string, options ...instrument.Float64Option) (instrument.Float64UpDownCounter, error) {
func (m *meter) Float64UpDownCounter(name string, options ...metric.Float64UpDownCounterOption) (metric.Float64UpDownCounter, error) {
if del, ok := m.delegate.Load().(metric.Meter); ok {
return del.Float64UpDownCounter(name, options...)
}
@ -230,7 +234,7 @@ func (m *meter) Float64UpDownCounter(name string, options ...instrument.Float64O
return i, nil
}
func (m *meter) Float64Histogram(name string, options ...instrument.Float64Option) (instrument.Float64Histogram, error) {
func (m *meter) Float64Histogram(name string, options ...metric.Float64HistogramOption) (metric.Float64Histogram, error) {
if del, ok := m.delegate.Load().(metric.Meter); ok {
return del.Float64Histogram(name, options...)
}
@ -241,7 +245,7 @@ func (m *meter) Float64Histogram(name string, options ...instrument.Float64Optio
return i, nil
}
func (m *meter) Float64ObservableCounter(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableCounter, error) {
func (m *meter) Float64ObservableCounter(name string, options ...metric.Float64ObservableCounterOption) (metric.Float64ObservableCounter, error) {
if del, ok := m.delegate.Load().(metric.Meter); ok {
return del.Float64ObservableCounter(name, options...)
}
@ -252,7 +256,7 @@ func (m *meter) Float64ObservableCounter(name string, options ...instrument.Floa
return i, nil
}
func (m *meter) Float64ObservableUpDownCounter(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableUpDownCounter, error) {
func (m *meter) Float64ObservableUpDownCounter(name string, options ...metric.Float64ObservableUpDownCounterOption) (metric.Float64ObservableUpDownCounter, error) {
if del, ok := m.delegate.Load().(metric.Meter); ok {
return del.Float64ObservableUpDownCounter(name, options...)
}
@ -263,7 +267,7 @@ func (m *meter) Float64ObservableUpDownCounter(name string, options ...instrumen
return i, nil
}
func (m *meter) Float64ObservableGauge(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableGauge, error) {
func (m *meter) Float64ObservableGauge(name string, options ...metric.Float64ObservableGaugeOption) (metric.Float64ObservableGauge, error) {
if del, ok := m.delegate.Load().(metric.Meter); ok {
return del.Float64ObservableGauge(name, options...)
}
@ -275,7 +279,7 @@ func (m *meter) Float64ObservableGauge(name string, options ...instrument.Float6
}
// RegisterCallback captures the function that will be called during Collect.
func (m *meter) RegisterCallback(f metric.Callback, insts ...instrument.Asynchronous) (metric.Registration, error) {
func (m *meter) RegisterCallback(f metric.Callback, insts ...metric.Observable) (metric.Registration, error) {
if del, ok := m.delegate.Load().(metric.Meter); ok {
insts = unwrapInstruments(insts)
return del.RegisterCallback(f, insts...)
@ -296,11 +300,11 @@ func (m *meter) RegisterCallback(f metric.Callback, insts ...instrument.Asynchro
}
type wrapped interface {
unwrap() instrument.Asynchronous
unwrap() metric.Observable
}
func unwrapInstruments(instruments []instrument.Asynchronous) []instrument.Asynchronous {
out := make([]instrument.Asynchronous, 0, len(instruments))
func unwrapInstruments(instruments []metric.Observable) []metric.Observable {
out := make([]metric.Observable, 0, len(instruments))
for _, inst := range instruments {
if in, ok := inst.(wrapped); ok {
@ -314,7 +318,9 @@ func unwrapInstruments(instruments []instrument.Asynchronous) []instrument.Async
}
type registration struct {
instruments []instrument.Asynchronous
embedded.Registration
instruments []metric.Observable
function metric.Callback
unreg func() error