rebase: bump google.golang.org/grpc from 1.69.4 to 1.70.0

Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.69.4 to 1.70.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.69.4...v1.70.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot]
2025-01-28 15:38:36 +00:00
committed by mergify[bot]
parent 15ffa48082
commit 72cfaaf3fc
36 changed files with 352 additions and 179 deletions

View File

@ -5,6 +5,7 @@ package global // import "go.opentelemetry.io/otel/internal/global"
import (
"container/list"
"context"
"reflect"
"sync"
@ -66,6 +67,7 @@ func (p *meterProvider) Meter(name string, opts ...metric.MeterOption) metric.Me
name: name,
version: c.InstrumentationVersion(),
schema: c.SchemaURL(),
attrs: c.InstrumentationAttributes(),
}
if p.meters == nil {
@ -472,8 +474,7 @@ func (m *meter) RegisterCallback(f metric.Callback, insts ...metric.Observable)
defer m.mtx.Unlock()
if m.delegate != nil {
insts = unwrapInstruments(insts)
return m.delegate.RegisterCallback(f, insts...)
return m.delegate.RegisterCallback(unwrapCallback(f), unwrapInstruments(insts)...)
}
reg := &registration{instruments: insts, function: f}
@ -487,15 +488,11 @@ func (m *meter) RegisterCallback(f metric.Callback, insts ...metric.Observable)
return reg, nil
}
type wrapped interface {
unwrap() metric.Observable
}
func unwrapInstruments(instruments []metric.Observable) []metric.Observable {
out := make([]metric.Observable, 0, len(instruments))
for _, inst := range instruments {
if in, ok := inst.(wrapped); ok {
if in, ok := inst.(unwrapper); ok {
out = append(out, in.unwrap())
} else {
out = append(out, inst)
@ -515,9 +512,61 @@ type registration struct {
unregMu sync.Mutex
}
func (c *registration) setDelegate(m metric.Meter) {
insts := unwrapInstruments(c.instruments)
type unwrapObs struct {
embedded.Observer
obs metric.Observer
}
// unwrapFloat64Observable returns an expected metric.Float64Observable after
// unwrapping the global object.
func unwrapFloat64Observable(inst metric.Float64Observable) metric.Float64Observable {
if unwrapped, ok := inst.(unwrapper); ok {
if floatObs, ok := unwrapped.unwrap().(metric.Float64Observable); ok {
// Note: if the unwrapped object does not
// unwrap as an observable for either of the
// predicates here, it means an internal bug in
// this package. We avoid logging an error in
// this case, because the SDK has to try its
// own type conversion on the object. The SDK
// will see this and be forced to respond with
// its own error.
//
// This code uses a double-nested if statement
// to avoid creating a branch that is
// impossible to cover.
inst = floatObs
}
}
return inst
}
// unwrapInt64Observable returns an expected metric.Int64Observable after
// unwrapping the global object.
func unwrapInt64Observable(inst metric.Int64Observable) metric.Int64Observable {
if unwrapped, ok := inst.(unwrapper); ok {
if unint, ok := unwrapped.unwrap().(metric.Int64Observable); ok {
// See the comment in unwrapFloat64Observable().
inst = unint
}
}
return inst
}
func (uo *unwrapObs) ObserveFloat64(inst metric.Float64Observable, value float64, opts ...metric.ObserveOption) {
uo.obs.ObserveFloat64(unwrapFloat64Observable(inst), value, opts...)
}
func (uo *unwrapObs) ObserveInt64(inst metric.Int64Observable, value int64, opts ...metric.ObserveOption) {
uo.obs.ObserveInt64(unwrapInt64Observable(inst), value, opts...)
}
func unwrapCallback(f metric.Callback) metric.Callback {
return func(ctx context.Context, obs metric.Observer) error {
return f(ctx, &unwrapObs{obs: obs})
}
}
func (c *registration) setDelegate(m metric.Meter) {
c.unregMu.Lock()
defer c.unregMu.Unlock()
@ -526,7 +575,7 @@ func (c *registration) setDelegate(m metric.Meter) {
return
}
reg, err := m.RegisterCallback(c.function, insts...)
reg, err := m.RegisterCallback(unwrapCallback(c.function), unwrapInstruments(c.instruments)...)
if err != nil {
GetErrorHandler().Handle(err)
return