Report pipeline queue length on startup to statsd
So that graphs that use a pipeline gauge have some data to work with, even if it's 0. Change-Id: Ida46153d8ee27ab212949dc3d417bb4331512de6
This commit is contained in:
parent
7f4a19088f
commit
3cb1070883
|
@ -1070,6 +1070,14 @@ class TestScheduler(testtools.TestCase):
|
|||
self.assertReportedStat(
|
||||
'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):
|
||||
"Test that a change matching multiple pipelines works"
|
||||
|
||||
|
|
|
@ -470,6 +470,16 @@ class Scheduler(threading.Thread):
|
|||
self._setupMerger()
|
||||
for trigger in self.triggers.values():
|
||||
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_complete_event.set()
|
||||
finally:
|
||||
|
|
Loading…
Reference in New Issue