Skip to content

Commit

Permalink
Fix return order
Browse files Browse the repository at this point in the history
  • Loading branch information
jt-dd committed Sep 6, 2024
1 parent 685f5f7 commit 312393b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pkg/collector/k8s_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ func NewK8sAPICollector(ctx context.Context, cfg *config.KubehoundConfig) (Colle
}

func (c *k8sAPICollector) ComputeMetadata(ctx context.Context, ingestor MetadataIngestor) error {

err, metrics := c.computeMetrics(ctx)
metrics, err := c.computeMetrics(ctx)
if err != nil {
return fmt.Errorf("error computing metrics: %w", err)
}
Expand Down Expand Up @@ -205,7 +204,7 @@ func (c *k8sAPICollector) ClusterInfo(ctx context.Context) (*config.ClusterInfo,
}

// Generate metrics for k8sAPI collector
func (c *k8sAPICollector) computeMetrics(_ context.Context) (error, Metrics) {
func (c *k8sAPICollector) computeMetrics(_ context.Context) (Metrics, error) {
var errMetric error
var runTotalWaitTime time.Duration
for _, wait := range c.waitTime {
Expand Down Expand Up @@ -240,7 +239,7 @@ func (c *k8sAPICollector) computeMetrics(_ context.Context) (error, Metrics) {
ThrottlingPercentage: runThrottlingPercentage,
}

return errMetric, metadata
return metadata, errMetric
}

func (c *k8sAPICollector) Close(ctx context.Context) error {
Expand Down

0 comments on commit 312393b

Please sign in to comment.