From b1388f0c12715cbff17406aec465142af6065a7f Mon Sep 17 00:00:00 2001 From: Logan Hanks Date: Thu, 29 Dec 2011 11:01:35 -0800 Subject: [PATCH] Report mean cassandra response times per request, not total. --- r2/r2/lib/stats.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/r2/r2/lib/stats.py b/r2/r2/lib/stats.py index e318c8eec..f533953d2 100644 --- a/r2/r2/lib/stats.py +++ b/r2/r2/lib/stats.py @@ -126,7 +126,9 @@ class Stats: for key, (total_time, count) in events: data['cassandra.' + key] = str(count) + '|c' if key.endswith('.ok'): - data['cassandra.' + key[:-3]] = str(total_time) + '|ms' + divisor = count or 1 + mean = total_time / divisor + data['cassandra.' + key[:-3]] = str(mean) + '|ms' self.connection.send(data) class CacheStats: