Skip to content

Commit

Permalink
refactor(metrics_collector): replace abbreviations
Browse files Browse the repository at this point in the history
Signed-off-by: Chin-Ya Huang <[email protected]>
  • Loading branch information
c3y1huang authored and David Ko committed Dec 16, 2023
1 parent c48d060 commit 51524e0
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions metrics_collector/metrics_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Expand All @@ -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")
}
}
Expand Down

0 comments on commit 51524e0

Please sign in to comment.