From 026e3ba59852a4a9da4ae25ad98b4c0da698dd09 Mon Sep 17 00:00:00 2001 From: Michael Beemer Date: Mon, 14 Oct 2024 09:09:14 -0400 Subject: [PATCH] fix: only register otel during initialization (#1736) * fix: only register otel during initialization Signed-off-by: Michael Beemer * revert removal of fatal log --------- Signed-off-by: Michael Beemer Co-authored-by: Juliano Costa --- src/productcatalogservice/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/productcatalogservice/main.go b/src/productcatalogservice/main.go index 2330212d79..12cfd4b53f 100644 --- a/src/productcatalogservice/main.go +++ b/src/productcatalogservice/main.go @@ -128,6 +128,7 @@ func main() { } log.Println("Shutdown meter provider") }() + openfeature.AddHooks(otelhooks.NewTracesHook()) err := openfeature.SetProvider(flagd.NewProvider()) if err != nil { log.Fatal(err) @@ -300,7 +301,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{},