27
30
def _send_metric(name, value):
28
31
base_metric_path = 'test'
29
32
metric_path = '%s.%s' % (base_metric_path, name)
30
send_to_carbon(CARBON_SERVER, CARBON_PORT, metric_path, value)
33
sender.send_to_carbon(CARBON_SERVER, CARBON_PORT, metric_path, value)
33
36
def run_single_trans(metric, transaction):
34
elapsed_time = transaction.run(SSO_HOST, SSO_EMAIL, SSO_PASSWORD)
37
elapsed_time = transaction_func(SSO_HOST, SSO_EMAIL, SSO_PASSWORD)
35
38
metric_path = _send_metric(metric, elapsed_time)
36
39
print 'time: %.0f ms\n%r sent to carbon' % (elapsed_time, metric_path)
39
'sso_web_login_time': transactions.sso_web_login,
40
'sso_api_auth_time': transactions.sso_api_auth,
42
'sso_web_login_time': sso_web_login.run,
43
'sso_api_auth_time': sso_api_auth.run,
45
for metric_name, transaction_module in trans.items():
46
run_single_trans(metric_name, transaction_module)
48
for metric_name, transaction_func in transactions.items():
49
run_single_trans(metric_name, transaction_func)
53
if __name__ == '__main__':