diff --git a/client/client.go b/client/client.go index 98faa36525b..fe55e04860c 100644 --- a/client/client.go +++ b/client/client.go @@ -2575,19 +2575,15 @@ func (c *Client) emitStats() { for { select { case <-next.C: - start := time.Now() err := c.hostStatsCollector.Collect() next.Reset(c.config.StatsCollectionInterval) - end := time.Now() - duration := end.Sub(start) if err != nil { - c.logger.Warn("error fetching host resource usage stats", "error", err, "collection_duration", duration) - continue - } - - // Publish Node metrics if operator has opted in - if c.config.PublishNodeMetrics { - c.emitHostStats() + c.logger.Warn("error fetching host resource usage stats", "error", err) + } else { + // Publish Node metrics if operator has opted in + if c.config.PublishNodeMetrics { + c.emitHostStats() + } } c.emitClientMetrics()