| Index: infra/services/service_manager/__main__.py
|
| diff --git a/infra/services/service_manager/__main__.py b/infra/services/service_manager/__main__.py
|
| index d1f455c974563aea8c421f8f29c91a1424faa77e..198fad7d4e92ebed6e6b8f089fd5713b0aafcd15 100644
|
| --- a/infra/services/service_manager/__main__.py
|
| +++ b/infra/services/service_manager/__main__.py
|
| @@ -7,6 +7,7 @@ import signal
|
| import socket
|
| import sys
|
|
|
| +from infra_libs import experiments
|
| from infra.services.service_manager import config_watcher
|
| from infra.services.service_manager import root_setup
|
|
|
| @@ -24,10 +25,12 @@ class ServiceManager(infra_libs.BaseApplication):
|
| default_state_directory = 'C:\\chrome-infra\\service-state'
|
| default_config_directory = 'C:\\chrome-infra\\service-config'
|
| default_root_directory = 'C:\\infra-python'
|
| + default_cloudtail_path = 'C:\\infra-python\\go\\bin\\cloudtail.exe'
|
| else:
|
| default_state_directory = '/var/run/infra-services'
|
| default_config_directory = '/etc/infra-services'
|
| default_root_directory = '/opt/infra-python'
|
| + default_cloudtail_path = '/opt/infra-python/go/bin/cloudtail'
|
|
|
| parser.add_argument(
|
| '--state-directory',
|
| @@ -59,6 +62,16 @@ class ServiceManager(infra_libs.BaseApplication):
|
| 'configs in /etc and then exit immediately. Used on GCE bots to '
|
| 'bootstrap service_manager')
|
|
|
| + parser.add_argument(
|
| + '--cloudtail-experiment-percent',
|
| + type=int, default=0,
|
| + help='Probability of tailing log files of started services to cloud '
|
| + 'logging using cloudtail')
|
| + parser.add_argument(
|
| + '--cloudtail-path',
|
| + default=default_cloudtail_path,
|
| + help='Path to the cloudtail binary')
|
| +
|
| parser.set_defaults(
|
| ts_mon_target_type='task',
|
| ts_mon_task_service_name='service_manager',
|
| @@ -69,12 +82,16 @@ class ServiceManager(infra_libs.BaseApplication):
|
| if opts.root_setup:
|
| return root_setup.root_setup()
|
|
|
| + cloudtail_active = experiments.is_active_for_host(
|
| + 'cloudtail', opts.cloudtail_experiment_percent)
|
| +
|
| watcher = config_watcher.ConfigWatcher(
|
| opts.config_directory,
|
| opts.config_poll_interval,
|
| opts.service_poll_interval,
|
| opts.state_directory,
|
| - opts.root_directory)
|
| + opts.root_directory,
|
| + opts.cloudtail_path if cloudtail_active else None)
|
|
|
| def sigint_handler(_signal, _frame):
|
| watcher.stop()
|
|
|