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) } }