From 81e7a13a3bac87477c15c4014802c9e3bdea574a Mon Sep 17 00:00:00 2001 From: Jeremy Breiding Date: Mon, 6 Jun 2022 19:37:55 -0700 Subject: [PATCH] moving handler instantiation to allow noop reporter for autosetup (#2960) --- temporal/fx.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/temporal/fx.go b/temporal/fx.go index c8abd71ed45..c012db60e55 100644 --- a/temporal/fx.go +++ b/temporal/fx.go @@ -180,8 +180,6 @@ func ServerOptionsProvider(opts []ServerOption) (serverOptionsProvider, error) { clientFactoryProvider = client.NewFactoryProvider() } - handler := metrics.MetricHandlerFromConfig(logger, so.config.Global.Metrics) - // ServerReporter serverReporter := so.metricsReporter if serverReporter == nil { @@ -189,6 +187,7 @@ func ServerOptionsProvider(opts []ServerOption) (serverOptionsProvider, error) { logger.Warn("no metrics config provided, using noop reporter") serverReporter = metrics.NoopReporter } else { + handler := metrics.MetricHandlerFromConfig(logger, so.config.Global.Metrics) serverReporter = metrics.NewEventsReporter(handler) } }