diff --git a/npm/cmd/start.go b/npm/cmd/start.go index 0969720f94..900fb8fa8a 100644 --- a/npm/cmd/start.go +++ b/npm/cmd/start.go @@ -131,7 +131,11 @@ func start(config npmconfig.Config, flags npmconfig.Flags) error { }), ) } - k8sServerVersion := k8sServerVersion(clientset) + + err = metrics.CreateTelemetryHandle(config.NPMVersion(), version, npm.GetAIMetadata()) + if err != nil { + klog.Infof("CreateTelemetryHandle failed with error %v. AITelemetry is not initialized.", err) + } var dp dataplane.GenericDataplane stopChannel := wait.NeverStop @@ -197,11 +201,9 @@ func start(config npmconfig.Config, flags npmconfig.Flags) error { } dp.RunPeriodicTasks() } + + k8sServerVersion := k8sServerVersion(clientset) npMgr := npm.NewNetworkPolicyManager(config, factory, podFactory, dp, exec.New(), version, k8sServerVersion) - err = metrics.CreateTelemetryHandle(config.NPMVersion(), version, npm.GetAIMetadata()) - if err != nil { - klog.Infof("CreateTelemetryHandle failed with error %v. AITelemetry is not initialized.", err) - } go restserver.NPMRestServerListenAndServe(config, npMgr)