From 77cda4b5b09197befd99b34883bf5a39257c0f40 Mon Sep 17 00:00:00 2001 From: Daniel Rammer Date: Mon, 6 Nov 2023 09:25:36 -0600 Subject: [PATCH] registering tracerproviders for flyteadmin and datacatalog standalone Signed-off-by: Daniel Rammer --- datacatalog/cmd/entrypoints/serve.go | 9 +++++++++ flyteadmin/cmd/entrypoints/serve.go | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/datacatalog/cmd/entrypoints/serve.go b/datacatalog/cmd/entrypoints/serve.go index 1cd7e94a72..e6d1d07160 100644 --- a/datacatalog/cmd/entrypoints/serve.go +++ b/datacatalog/cmd/entrypoints/serve.go @@ -10,6 +10,7 @@ import ( "github.com/flyteorg/flyte/datacatalog/pkg/runtime" "github.com/flyteorg/flyte/flytestdlib/contextutils" "github.com/flyteorg/flyte/flytestdlib/logger" + "github.com/flyteorg/flyte/flytestdlib/otelutils" "github.com/flyteorg/flyte/flytestdlib/profutils" "github.com/flyteorg/flyte/flytestdlib/promutils/labeled" ) @@ -42,6 +43,14 @@ var serveCmd = &cobra.Command{ // Set Keys labeled.SetMetricKeys(contextutils.AppNameKey, contextutils.ProjectKey, contextutils.DomainKey) + // register otel tracer providers + for _, serviceName := range []string{otelutils.DataCatalogGormTracer, otelutils.DataCatalogServerTracer} { + if err := otelutils.RegisterTracerProvider(serviceName, otelutils.GetConfig()) ; err != nil { + logger.Errorf(ctx, "Failed to create otel tracer provider. %v", err) + return err + } + } + return datacatalogservice.ServeInsecure(ctx, cfg) }, } diff --git a/flyteadmin/cmd/entrypoints/serve.go b/flyteadmin/cmd/entrypoints/serve.go index 680795c28f..b3b575baba 100644 --- a/flyteadmin/cmd/entrypoints/serve.go +++ b/flyteadmin/cmd/entrypoints/serve.go @@ -10,6 +10,7 @@ import ( "github.com/flyteorg/flyte/flyteadmin/pkg/server" "github.com/flyteorg/flyte/flyteadmin/plugins" "github.com/flyteorg/flyte/flytestdlib/logger" + "github.com/flyteorg/flyte/flytestdlib/otelutils" "github.com/flyteorg/flyte/flytestdlib/profutils" ) @@ -32,6 +33,14 @@ var serveCmd = &cobra.Command{ }() server.SetMetricKeys(cfg.ApplicationConfiguration().GetTopLevelConfig()) + // register otel tracer providers + for _, serviceName := range []string{otelutils.AdminGormTracer, otelutils.AdminServerTracer} { + if err := otelutils.RegisterTracerProvider(serviceName, otelutils.GetConfig()) ; err != nil { + logger.Errorf(ctx, "Failed to create otel tracer provider. %v", err) + return err + } + } + return server.Serve(ctx, pluginRegistryStore.Load(), nil) }, }