##// END OF EJS Templates
feat(metric): added new metric calculation. Fixes: RCCE-5
ilin.s -
r5268:39887b2a default
parent child Browse files
Show More
@@ -18,6 +18,7 b''
18 18
19 19 import os
20 20 import sys
21 import time
21 22 import logging
22 23
23 24 import click
@@ -25,6 +26,7 b' import click'
25 26 from pyramid.paster import setup_logging
26 27
27 28 from rhodecode.lib.pyramid_utils import bootstrap
29 from rhodecode.lib.statsd_client import StatsdClient
28 30 from .backends import SshWrapper
29 31
30 32 log = logging.getLogger(__name__)
@@ -65,8 +67,9 b' def main(ini_path, mode, user, user_id, '
65 67 'Please make sure this is set and available during execution '
66 68 'of this script.')
67 69 connection_info = os.environ.get('SSH_CONNECTION', '')
68
70 time_start = time.time()
69 71 with bootstrap(ini_path, env={'RC_CMD_SSH_WRAPPER': '1'}) as env:
72 statsd = StatsdClient.statsd
70 73 try:
71 74 ssh_wrapper = SshWrapper(
72 75 command, connection_info, mode,
@@ -74,6 +77,10 b' def main(ini_path, mode, user, user_id, '
74 77 except Exception:
75 78 log.exception('Failed to execute SshWrapper')
76 79 sys.exit(-5)
77
78 80 return_code = ssh_wrapper.wrap()
81 operation_took = time.time() - time_start
82 if statsd:
83 operation_took_ms = round(1000.0 * operation_took)
84 statsd.timing("rhodecode_ssh_wrapper_timing.histogram", operation_took_ms,
85 use_decimals=False)
79 86 sys.exit(return_code)
General Comments 0
You need to be logged in to leave comments. Login now