Skip to content

Commit

Permalink
internal/global/meter.go: Use the proper unwrap method
Browse files Browse the repository at this point in the history
  • Loading branch information
jmacd committed Oct 10, 2024
1 parent a7d5c1a commit 76bbad8
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions internal/global/meter.go
Original file line number Diff line number Diff line change
Expand Up @@ -487,16 +487,12 @@ 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 {
out = append(out, in.unwrap())
if in, ok := inst.(unwrapper); ok {
out = append(out, in.Unwrap())
} else {
out = append(out, inst)
}
Expand Down

0 comments on commit 76bbad8

Please sign in to comment.