Browse Source

Merge "Report pipeline queue length on startup to statsd"

changes/77/43977/1
Jenkins 9 years ago committed by Gerrit Code Review
parent
commit
0f5efced1d
  1. 8
      tests/test_scheduler.py
  2. 10
      zuul/scheduler.py

8
tests/test_scheduler.py

@ -1081,6 +1081,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"

10
zuul/scheduler.py

@ -469,6 +469,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…
Cancel
Save