Skip to content

Commit

Permalink
Added a unit test for the global meter delegation
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse-Bonfire committed Sep 24, 2024
1 parent 7ff5cff commit e8e45fc
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions sdk/metric/meter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2427,3 +2427,16 @@ func TestDuplicateInstrumentCreation(t *testing.T) {
})
}
}

func TestMeterProviderDelegation(t *testing.T) {
meter := otel.Meter("go.opentelemetry.io/otel/metric/internal/global/meter_test")
for i := 0; i < 5; i++ {
m, _ := meter.Int64ObservableUpDownCounter("observable.int64.up.down.counter")
meter.RegisterCallback(func(ctx context.Context, o metric.Observer) error {
o.ObserveInt64(m, int64(10))
return nil
}, m)
}
provider := NewMeterProvider()
otel.SetMeterProvider(provider)
}

0 comments on commit e8e45fc

Please sign in to comment.