open-feature / go-sdk-contrib

Community maintained OpenFeature Providers and Hooks for Go
https://openfeature.dev
Apache License 2.0
42 stars 38 forks source link

Otel metrics hooks constructor should accept MeterProvider from api, not SDK #527

Closed morigs closed 2 months ago

morigs commented 2 months ago

NewMetricsHookForProvider expects go.opentelemetry.io/otel/sdk/metric.MeterProvider as a parameter. So as a user you have to have an access to the specific provider implementation, which is not always the case.

I suggest replacing the type of the first parameter to the go.opentelemetry.io/otel/metric.MeterProvider interface. It's not a breaking change because the current type implements this interface.

Also, we can provider a second constructor which will create a hook using otel global meter provider.