From 51524e0ace25b472fd369a2f182b9b543586b5ae Mon Sep 17 00:00:00 2001 From: Chin-Ya Huang Date: Fri, 15 Dec 2023 11:58:04 +0800 Subject: [PATCH] refactor(metrics_collector): replace abbreviations Signed-off-by: Chin-Ya Huang --- metrics_collector/metrics_collector.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/metrics_collector/metrics_collector.go b/metrics_collector/metrics_collector.go index 55a04eaaee..8f5f35e167 100644 --- a/metrics_collector/metrics_collector.go +++ b/metrics_collector/metrics_collector.go @@ -23,19 +23,19 @@ import ( func InitMetricsCollectorSystem(logger logrus.FieldLogger, currentNodeID string, ds *datastore.DataStore, kubeconfigPath string, proxyConnCounter util.Counter) { logger.Info("Initializing metrics collector system") - vc := NewVolumeCollector(logger, currentNodeID, ds) - dc := NewDiskCollector(logger, currentNodeID, ds) - bc := NewBackupCollector(logger, currentNodeID, ds) + volumeCollector := NewVolumeCollector(logger, currentNodeID, ds) + diskCollector := NewDiskCollector(logger, currentNodeID, ds) + backupCollector := NewBackupCollector(logger, currentNodeID, ds) - if err := registry.Register(vc); err != nil { + if err := registry.Register(volumeCollector); err != nil { logger.WithField("collector", subsystemVolume).WithError(err).Warn("Failed to register collector") } - if err := registry.Register(dc); err != nil { + if err := registry.Register(diskCollector); err != nil { logger.WithField("collector", subsystemDisk).WithError(err).Warn("Failed to register collector") } - if err := registry.Register(bc); err != nil { + if err := registry.Register(backupCollector); err != nil { logger.WithField("collector", subsystemBackup).WithError(err).Warn("Failed to register collector") } @@ -49,17 +49,17 @@ func InitMetricsCollectorSystem(logger logrus.FieldLogger, currentNodeID string, if kubeMetricsClient, err := buildMetricClientFromConfigPath(kubeconfigPath); err != nil { logger.WithError(err).Warn("Skipped instantiating InstanceManagerCollector, ManagerCollector, and NodeCollector") } else { - imc := NewInstanceManagerCollector(logger, currentNodeID, ds, proxyConnCounter, kubeMetricsClient, namespace) - nc := NewNodeCollector(logger, currentNodeID, ds, kubeMetricsClient) - mc := NewManagerCollector(logger, currentNodeID, ds, kubeMetricsClient, namespace) + instanceManagerCollector := NewInstanceManagerCollector(logger, currentNodeID, ds, proxyConnCounter, kubeMetricsClient, namespace) + nodeCollector := NewNodeCollector(logger, currentNodeID, ds, kubeMetricsClient) + managerCollector := NewManagerCollector(logger, currentNodeID, ds, kubeMetricsClient, namespace) - if err := registry.Register(imc); err != nil { + if err := registry.Register(instanceManagerCollector); err != nil { logger.WithField("collector", subsystemInstanceManager).WithError(err).Warn("Failed to register collector") } - if err := registry.Register(nc); err != nil { + if err := registry.Register(nodeCollector); err != nil { logger.WithField("collector", subsystemNode).WithError(err).Warn("Failed to register collector") } - if err := registry.Register(mc); err != nil { + if err := registry.Register(managerCollector); err != nil { logger.WithField("collector", subsystemManager).WithError(err).Warn("Failed to register collector") } }