| 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 logging | 5 import logging |
| 6 import os | 6 import os |
| 7 import socket | 7 import socket |
| 8 | 8 |
| 9 import infra_libs | 9 import infra_libs |
| 10 from infra_libs.event_mon.protos.chrome_infra_log_pb2 import ( | 10 from infra_libs.event_mon.protos.chrome_infra_log_pb2 import ( |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 help="Path to a json file containing a service account's" | 57 help="Path to a json file containing a service account's" |
| 58 "\ncredentials. This is relative to the path specified\n" | 58 "\ncredentials. This is relative to the path specified\n" |
| 59 "in --event-mon-service-accounts-creds-root\n" | 59 "in --event-mon-service-accounts-creds-root\n" |
| 60 "Defaults to '%(default)s'") | 60 "Defaults to '%(default)s'") |
| 61 group.add_argument('--event-mon-service-accounts-creds-root', | 61 group.add_argument('--event-mon-service-accounts-creds-root', |
| 62 metavar='DIR', | 62 metavar='DIR', |
| 63 default=infra_libs.SERVICE_ACCOUNTS_CREDS_ROOT, | 63 default=infra_libs.SERVICE_ACCOUNTS_CREDS_ROOT, |
| 64 help="Directory containing service accounts credentials.\n" | 64 help="Directory containing service accounts credentials.\n" |
| 65 "Defaults to %(default)s" | 65 "Defaults to %(default)s" |
| 66 ) | 66 ) |
| 67 group.add_argument('--event-mon-http-timeout', default=10, | 67 group.add_argument('--event-mon-http-timeout', default=10, type=int, |
| 68 help='Timeout in seconds for HTTP requests to send events') | 68 help='Timeout in seconds for HTTP requests to send events') |
| 69 group.add_argument('--event-mon-http-retry-backoff', default=2., | 69 group.add_argument('--event-mon-http-retry-backoff', default=2., type=float, |
| 70 help='Time in seconds before retrying POSTing to the HTTP ' | 70 help='Time in seconds before retrying POSTing to the HTTP ' |
| 71 'endpoint. Randomized exponential backoff is applied on ' | 71 'endpoint. Randomized exponential backoff is applied on ' |
| 72 'subsequent retries.') | 72 'subsequent retries.') |
| 73 | 73 |
| 74 | 74 |
| 75 def process_argparse_options(args): # pragma: no cover | 75 def process_argparse_options(args): # pragma: no cover |
| 76 """Initializes event monitoring based on provided arguments. | 76 """Initializes event monitoring based on provided arguments. |
| 77 | 77 |
| 78 Args: | 78 Args: |
| 79 args(argparse.Namespace): output of ArgumentParser.parse_args. | 79 args(argparse.Namespace): output of ArgumentParser.parse_args. |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 | 221 |
| 222 Call this right before exiting the program. | 222 Call this right before exiting the program. |
| 223 | 223 |
| 224 Returns: | 224 Returns: |
| 225 success (bool): False if an error occured | 225 success (bool): False if an error occured |
| 226 """ | 226 """ |
| 227 global _router, _cache | 227 global _router, _cache |
| 228 _router = None | 228 _router = None |
| 229 _cache = {} | 229 _cache = {} |
| 230 return True | 230 return True |
| OLD | NEW |