Merge "Fix label name in reported label stats"

This commit is contained in:
Zuul 2018-09-10 17:43:56 +00:00 committed by Gerrit Code Review
commit 9ae18f602e
2 changed files with 11 additions and 6 deletions

View File

@ -110,12 +110,15 @@ class StatsReporter(object):
states[key] += 1
# nodepool.label.LABEL.nodes.STATE
key = 'nodepool.label.%s.nodes.%s' % (node.type, node.state)
# It's possible we could see node types that aren't in our config
if key in states:
states[key] += 1
else:
states[key] = 1
# nodes can have several labels
for label in node.type:
key = 'nodepool.label.%s.nodes.%s' % (label, node.state)
# It's possible we could see node types that aren't in our
# config
if key in states:
states[key] += 1
else:
states[key] = 1
# nodepool.provider.PROVIDER.nodes.STATE
key = 'nodepool.provider.%s.nodes.%s' % (node.provider, node.state)

View File

@ -81,6 +81,8 @@ class TestLauncher(tests.DBTestCase):
self.waitForNodeRequestLockDeletion(req.id)
self.assertReportedStat('nodepool.nodes.ready', value='1', kind='g')
self.assertReportedStat('nodepool.nodes.building', value='0', kind='g')
self.assertReportedStat('nodepool.label.fake-label.nodes.ready',
value='1', kind='g')
def test_node_assignment_order(self):
"""Test that nodes are assigned in the order requested"""