Merge "Simulator: collect error stats"
This commit is contained in:
commit
e728383c45
@ -316,6 +316,7 @@ class Client(object):
|
|||||||
# and a message transport
|
# and a message transport
|
||||||
self.position = random.randint(0, self.messages_count - 1)
|
self.position = random.randint(0, self.messages_count - 1)
|
||||||
self.sent_messages = MessageStatsCollector('client-%s' % client_id)
|
self.sent_messages = MessageStatsCollector('client-%s' % client_id)
|
||||||
|
self.errors = MessageStatsCollector('error-%s' % client_id)
|
||||||
|
|
||||||
if has_result:
|
if has_result:
|
||||||
self.round_trip_messages = MessageStatsCollector(
|
self.round_trip_messages = MessageStatsCollector(
|
||||||
@ -325,7 +326,14 @@ class Client(object):
|
|||||||
msg = make_message(self.seq, MESSAGES[self.position], time.time())
|
msg = make_message(self.seq, MESSAGES[self.position], time.time())
|
||||||
self.sent_messages.push(msg)
|
self.sent_messages.push(msg)
|
||||||
|
|
||||||
res = self.method(self.client, msg)
|
res = None
|
||||||
|
try:
|
||||||
|
res = self.method(self.client, msg)
|
||||||
|
except Exception:
|
||||||
|
self.errors.push(msg)
|
||||||
|
else:
|
||||||
|
LOG.debug("SENT: %s", msg)
|
||||||
|
|
||||||
if res:
|
if res:
|
||||||
return_ts = time.time()
|
return_ts = time.time()
|
||||||
res = update_message(res, return_ts=return_ts)
|
res = update_message(res, return_ts=return_ts)
|
||||||
@ -445,6 +453,7 @@ def _rpc_call(client, msg):
|
|||||||
res = client.call({}, 'info', message=msg)
|
res = client.call({}, 'info', message=msg)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception('Error %s on CALL for message %s', str(e), msg)
|
LOG.exception('Error %s on CALL for message %s', str(e), msg)
|
||||||
|
raise
|
||||||
else:
|
else:
|
||||||
LOG.debug("SENT: %s, RCV: %s", msg, res)
|
LOG.debug("SENT: %s, RCV: %s", msg, res)
|
||||||
return res
|
return res
|
||||||
@ -455,6 +464,7 @@ def _rpc_cast(client, msg):
|
|||||||
client.cast({}, 'info', message=msg)
|
client.cast({}, 'info', message=msg)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.exception('Error %s on CAST for message %s', str(e), msg)
|
LOG.exception('Error %s on CAST for message %s', str(e), msg)
|
||||||
|
raise
|
||||||
else:
|
else:
|
||||||
LOG.debug("SENT: %s", msg)
|
LOG.debug("SENT: %s", msg)
|
||||||
|
|
||||||
@ -482,6 +492,7 @@ def show_client_stats(clients, json_filename, has_reply=False):
|
|||||||
for cl in clients:
|
for cl in clients:
|
||||||
cl_id = cl.client_id
|
cl_id = cl.client_id
|
||||||
output['series']['client_%s' % cl_id] = cl.sent_messages.get_series()
|
output['series']['client_%s' % cl_id] = cl.sent_messages.get_series()
|
||||||
|
output['series']['error_%s' % cl_id] = cl.errors.get_series()
|
||||||
|
|
||||||
if has_reply:
|
if has_reply:
|
||||||
output['series']['round_trip_%s' % cl_id] = (
|
output['series']['round_trip_%s' % cl_id] = (
|
||||||
@ -491,6 +502,10 @@ def show_client_stats(clients, json_filename, has_reply=False):
|
|||||||
'client', *(cl.sent_messages for cl in clients))
|
'client', *(cl.sent_messages for cl in clients))
|
||||||
output['summary']['client'] = sent_stats
|
output['summary']['client'] = sent_stats
|
||||||
|
|
||||||
|
error_stats = MessageStatsCollector.calc_stats(
|
||||||
|
'error', *(cl.errors for cl in clients))
|
||||||
|
output['summary']['error'] = error_stats
|
||||||
|
|
||||||
if has_reply:
|
if has_reply:
|
||||||
round_trip_stats = MessageStatsCollector.calc_stats(
|
round_trip_stats = MessageStatsCollector.calc_stats(
|
||||||
'round-trip', *(cl.round_trip_messages for cl in clients))
|
'round-trip', *(cl.round_trip_messages for cl in clients))
|
||||||
|
Loading…
Reference in New Issue
Block a user