| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 import json | 5 import json |
| 6 import logging | 6 import logging |
| 7 import os | 7 import os |
| 8 import socket | 8 import socket |
| 9 import sys | 9 import sys |
| 10 import urlparse | 10 import urlparse |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 | 236 |
| 237 if endpoint.startswith('file://'): | 237 if endpoint.startswith('file://'): |
| 238 interface.state.global_monitor = monitors.DebugMonitor( | 238 interface.state.global_monitor = monitors.DebugMonitor( |
| 239 endpoint[len('file://'):]) | 239 endpoint[len('file://'):]) |
| 240 elif endpoint.startswith('pubsub://'): | 240 elif endpoint.startswith('pubsub://'): |
| 241 if credentials: | 241 if credentials: |
| 242 url = urlparse.urlparse(endpoint) | 242 url = urlparse.urlparse(endpoint) |
| 243 project = url.netloc | 243 project = url.netloc |
| 244 topic = url.path.strip('/') | 244 topic = url.path.strip('/') |
| 245 interface.state.global_monitor = monitors.PubSubMonitor( | 245 interface.state.global_monitor = monitors.PubSubMonitor( |
| 246 credentials, project, topic, use_instrumented_http=True, | 246 monitors.CredentialFactory.from_string(credentials), project, topic, |
| 247 ca_certs=args.ts_mon_ca_certs) | 247 use_instrumented_http=True, ca_certs=args.ts_mon_ca_certs) |
| 248 else: | 248 else: |
| 249 logging.error('ts_mon monitoring is disabled because credentials are not ' | 249 logging.error('ts_mon monitoring is disabled because credentials are not ' |
| 250 'available') | 250 'available') |
| 251 elif endpoint.startswith('https://'): | 251 elif endpoint.startswith('https://'): |
| 252 interface.state.global_monitor = monitors.HttpsMonitor( | 252 interface.state.global_monitor = monitors.HttpsMonitor( |
| 253 endpoint, credentials, ca_certs=args.ts_mon_ca_certs) | 253 endpoint, monitors.CredentialFactory.from_string(credentials), |
| 254 ca_certs=args.ts_mon_ca_certs) |
| 254 elif endpoint.lower() == 'none': | 255 elif endpoint.lower() == 'none': |
| 255 logging.info('ts_mon monitoring has been explicitly disabled') | 256 logging.info('ts_mon monitoring has been explicitly disabled') |
| 256 else: | 257 else: |
| 257 logging.error('ts_mon monitoring is disabled because the endpoint provided' | 258 logging.error('ts_mon monitoring is disabled because the endpoint provided' |
| 258 ' is invalid or not supported: %s', endpoint) | 259 ' is invalid or not supported: %s', endpoint) |
| 259 | 260 |
| 260 interface.state.flush_mode = args.ts_mon_flush | 261 interface.state.flush_mode = args.ts_mon_flush |
| 261 interface.state.use_new_proto = use_new_proto | 262 interface.state.use_new_proto = use_new_proto |
| 262 | 263 |
| 263 if args.ts_mon_flush == 'auto': | 264 if args.ts_mon_flush == 'auto': |
| 264 interface.state.flush_thread = interface._FlushThread( | 265 interface.state.flush_thread = interface._FlushThread( |
| 265 args.ts_mon_flush_interval_secs) | 266 args.ts_mon_flush_interval_secs) |
| 266 interface.state.flush_thread.start() | 267 interface.state.flush_thread.start() |
| 267 | 268 |
| 268 standard_metrics.init() | 269 standard_metrics.init() |
| 269 | 270 |
| OLD | NEW |