Add available RAM to statsd

If the executor is using it to decide whether to accept jobs, we
should graph it.

Change-Id: If34e81f953df4ed0a2c2c287e7d00d4977267fef
This commit is contained in:
James E. Blair 2018-01-31 14:22:07 -08:00
parent 1754b2caf0
commit 40ca3791fb
2 changed files with 9 additions and 0 deletions

View File

@ -146,6 +146,12 @@ These metrics are emitted by the Zuul :ref:`scheduler`:
The one-minute load average of this executor, multiplied by 100. The one-minute load average of this executor, multiplied by 100.
.. stat:: pct_available_ram
:type: gauge
The available RAM (including buffers and cache) on this
executor, as a percentage multiplied by 100.
.. stat:: zuul.nodepool .. stat:: zuul.nodepool
Holds metrics related to Zuul requests from Nodepool. Holds metrics related to Zuul requests from Nodepool.

View File

@ -1795,6 +1795,7 @@ class ExecutorServer(object):
if self.statsd: if self.statsd:
base_key = 'zuul.executor.%s' % self.hostname base_key = 'zuul.executor.%s' % self.hostname
self.statsd.gauge(base_key + '.load_average', 0) self.statsd.gauge(base_key + '.load_average', 0)
self.statsd.gauge(base_key + '.pct_available_ram', 0)
self.statsd.gauge(base_key + '.running_builds', 0) self.statsd.gauge(base_key + '.running_builds', 0)
self.log.debug("Stopped") self.log.debug("Stopped")
@ -1976,6 +1977,8 @@ class ExecutorServer(object):
base_key = 'zuul.executor.%s' % self.hostname base_key = 'zuul.executor.%s' % self.hostname
self.statsd.gauge(base_key + '.load_average', self.statsd.gauge(base_key + '.load_average',
int(load_avg * 100)) int(load_avg * 100))
self.statsd.gauge(base_key + '.pct_available_ram',
int(avail_mem_pct * 100))
self.statsd.gauge(base_key + '.running_builds', self.statsd.gauge(base_key + '.running_builds',
len(self.job_workers)) len(self.job_workers))