mirror of
https://github.com/kemko/nomad.git
synced 2026-01-04 17:35:43 +03:00
Enqueing metrics only if they are not nil
This commit is contained in:
@@ -1337,10 +1337,10 @@ func (c *Client) collectHostStats() {
|
||||
c.logger.Printf("[DEBUG] client: error fetching host resource usage stats: %v", err)
|
||||
continue
|
||||
}
|
||||
c.resourceUsageLock.RLock()
|
||||
c.resourceUsage.Enqueue(ru)
|
||||
c.resourceUsageLock.RUnlock()
|
||||
if ru != nil {
|
||||
c.resourceUsageLock.RLock()
|
||||
c.resourceUsage.Enqueue(ru)
|
||||
c.resourceUsageLock.RUnlock()
|
||||
c.emitStats(ru)
|
||||
}
|
||||
next.Reset(c.config.StatsCollectionInterval)
|
||||
|
||||
@@ -474,10 +474,10 @@ func (r *TaskRunner) collectResourceUsageStats() {
|
||||
if err != nil {
|
||||
r.logger.Printf("[DEBUG] client: error fetching stats of task %v: %v", r.task.Name, err)
|
||||
}
|
||||
r.resourceUsageLock.Lock()
|
||||
r.resourceUsage.Enqueue(ru)
|
||||
r.resourceUsageLock.Unlock()
|
||||
if ru != nil {
|
||||
r.resourceUsageLock.Lock()
|
||||
r.resourceUsage.Enqueue(ru)
|
||||
r.resourceUsageLock.Unlock()
|
||||
r.emitStats(ru)
|
||||
}
|
||||
next.Reset(r.config.StatsCollectionInterval)
|
||||
|
||||
Reference in New Issue
Block a user