| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Common twistd configuration for buildbot. | 5 """Common twistd configuration for buildbot. |
| 6 | 6 |
| 7 Use this with: | 7 Use this with: |
| 8 twistd -y buildbot.tac -d path/to/master | 8 twistd -y buildbot.tac -d path/to/master |
| 9 """ | 9 """ |
| 10 | 10 |
| 11 import argparse | |
| 12 import logging | |
| 13 import os | 11 import os |
| 14 | 12 |
| 13 from twisted.application import service |
| 15 from buildbot.master import BuildMaster | 14 from buildbot.master import BuildMaster |
| 16 from infra_libs import ts_mon | |
| 17 from twisted.application import service | |
| 18 | |
| 19 | |
| 20 def setup_timeseries_monitoring(): | |
| 21 logging.basicConfig(level=logging.INFO) | |
| 22 | |
| 23 parser = argparse.ArgumentParser() | |
| 24 ts_mon.add_argparse_options(parser) | |
| 25 parser.set_defaults( | |
| 26 ts_mon_target_type='task', | |
| 27 ts_mon_task_service_name='buildmaster', | |
| 28 ts_mon_task_job_name=os.path.basename(os.getcwd()), | |
| 29 # Flushing is done by MonitoringStatusReceiver. Using 'auto' here doesn't | |
| 30 # work because the thread doesn't get forked along with the rest of the | |
| 31 # process by twistd. | |
| 32 ts_mon_flush='manual', | |
| 33 ) | |
| 34 args = parser.parse_args([]) | |
| 35 ts_mon.process_argparse_options(args) | |
| 36 | |
| 37 | 15 |
| 38 application = service.Application('buildmaster') | 16 application = service.Application('buildmaster') |
| 39 BuildMaster(os.getcwd(), 'master.cfg').setServiceParent(application) | 17 BuildMaster(os.getcwd(), 'master.cfg').setServiceParent(application) |
| 40 setup_timeseries_monitoring() | |
| OLD | NEW |