Skip to content

Commit

Permalink
fix: only register otel during initialization
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Beemer <[email protected]>
  • Loading branch information
beeme1mr committed Oct 7, 2024
1 parent 34d95c9 commit 50c0c43
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/productcatalogservice/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,10 @@ func main() {
}
log.Println("Shutdown meter provider")
}()
err := openfeature.SetProvider(flagd.NewProvider())
if err != nil {
log.Fatal(err)
}
openfeature.SetProvider(flagd.NewProvider())
openfeature.AddHooks(otelhooks.NewTracesHook())

err = runtime.Start(runtime.WithMinimumReadMemStatsInterval(time.Second))
err := runtime.Start(runtime.WithMinimumReadMemStatsInterval(time.Second))
if err != nil {
log.Fatal(err)
}
Expand Down Expand Up @@ -300,7 +298,7 @@ func (p *productCatalog) checkProductFailure(ctx context.Context, id string) boo
if id != "OLJCESPC7Z" {
return false
}
openfeature.AddHooks(otelhooks.NewTracesHook())

client := openfeature.NewClient("productCatalog")
failureEnabled, _ := client.BooleanValue(
ctx, "productCatalogFailure", false, openfeature.EvaluationContext{},
Expand Down

0 comments on commit 50c0c43

Please sign in to comment.