Merge "Report pipeline queue length on startup to statsd"
This commit is contained in:
commit
0f5efced1d
|
@ -1081,6 +1081,14 @@ class TestScheduler(testtools.TestCase):
|
||||||
self.assertReportedStat(
|
self.assertReportedStat(
|
||||||
'zuul.pipeline.gate.org.project.total_changes', value='1|c')
|
'zuul.pipeline.gate.org.project.total_changes', value='1|c')
|
||||||
|
|
||||||
|
def test_initial_pipeline_gauges(self):
|
||||||
|
"Test that each pipeline reported its length on start"
|
||||||
|
pipeline_names = self.sched.layout.pipelines.keys()
|
||||||
|
self.assertNotEqual(len(pipeline_names), 0)
|
||||||
|
for name in pipeline_names:
|
||||||
|
self.assertReportedStat('zuul.pipeline.%s.current_changes' % name,
|
||||||
|
value='0|g')
|
||||||
|
|
||||||
def test_duplicate_pipelines(self):
|
def test_duplicate_pipelines(self):
|
||||||
"Test that a change matching multiple pipelines works"
|
"Test that a change matching multiple pipelines works"
|
||||||
|
|
||||||
|
|
|
@ -469,6 +469,16 @@ class Scheduler(threading.Thread):
|
||||||
self._setupMerger()
|
self._setupMerger()
|
||||||
for trigger in self.triggers.values():
|
for trigger in self.triggers.values():
|
||||||
trigger.postConfig()
|
trigger.postConfig()
|
||||||
|
if statsd:
|
||||||
|
try:
|
||||||
|
for pipeline in self.layout.pipelines.values():
|
||||||
|
items = len(pipeline.getAllItems())
|
||||||
|
# stats.gauges.zuul.pipeline.NAME.current_changes
|
||||||
|
key = 'zuul.pipeline.%s' % pipeline.name
|
||||||
|
statsd.gauge(key + '.current_changes', items)
|
||||||
|
except Exception:
|
||||||
|
self.log.exception("Exception reporting initial "
|
||||||
|
"pipeline stats:")
|
||||||
self._reconfigure = False
|
self._reconfigure = False
|
||||||
self.reconfigure_complete_event.set()
|
self.reconfigure_complete_event.set()
|
||||||
finally:
|
finally:
|
||||||
|
|
Loading…
Reference in New Issue