summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Powers <dana.powers@gmail.com>2016-07-10 21:41:23 -0700
committerDana Powers <dana.powers@gmail.com>2016-07-16 14:05:50 -0700
commitdbb0dae4f34a469bf04a4df751892b237b4707a9 (patch)
tree868fa6c002a4c0b3820bd51e2bd7964226e20fc5
parent9b5c5acd9a8ba044c90ce3583c6c5231369627d6 (diff)
downloadkafka-python-dbb0dae4f34a469bf04a4df751892b237b4707a9.tar.gz
Update Sensor time_ms docs; only calculate if needed
-rw-r--r--kafka/metrics/stats/sensor.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/kafka/metrics/stats/sensor.py b/kafka/metrics/stats/sensor.py
index b0bf4db..72bacfc 100644
--- a/kafka/metrics/stats/sensor.py
+++ b/kafka/metrics/stats/sensor.py
@@ -55,15 +55,15 @@ class Sensor(object):
Record a value at a known time.
Arguments:
value (double): The value we are recording
- time_ms (int): The current POSIX time in milliseconds
+ time_ms (int): A POSIX timestamp in milliseconds.
+ Default: The time when record() is evaluated (now)
Raises:
QuotaViolationException: if recording this value moves a
metric beyond its configured maximum or minimum bound
"""
- now = time.time() * 1000
if time_ms is None:
- time_ms = now
+ time_ms = time.time() * 1000
self._last_record_time = time_ms
with self._lock: # XXX high volume, might be performance issue
# increment all the stats