Skip to content

Commit

Permalink
Move CollectNodeCount to original location
Browse files Browse the repository at this point in the history
  • Loading branch information
bjee19 committed Mar 13, 2024
1 parent 57efd63 commit aed8928
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions internal/mode/static/telemetry/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,16 @@ func (c DataCollectorImpl) Collect(ctx context.Context) (Data, error) {
return data, nil
}

// CollectNodeCount returns the number of nodes in the cluster.
func CollectNodeCount(ctx context.Context, k8sClient client.Reader) (int, error) {
var nodes v1.NodeList
if err := k8sClient.List(ctx, &nodes); err != nil {
return 0, fmt.Errorf("failed to get NodeList: %w", err)
}

return len(nodes.Items), nil
}

func collectGraphResourceCount(
graphGetter GraphGetter,
configurationGetter ConfigurationGetter,
Expand Down Expand Up @@ -264,16 +274,6 @@ func CollectClusterID(ctx context.Context, k8sClient client.Reader) (string, err
return string(kubeNamespace.GetUID()), nil
}

// CollectNodeCount returns the number of nodes in the cluster.
func CollectNodeCount(ctx context.Context, k8sClient client.Reader) (int, error) {
var nodes v1.NodeList
if err := k8sClient.List(ctx, &nodes); err != nil {
return 0, fmt.Errorf("failed to get NodeList: %w", err)
}

return len(nodes.Items), nil
}

type clusterInformation struct {
Platform string
Version string
Expand Down

0 comments on commit aed8928

Please sign in to comment.