From dbb0dae4f34a469bf04a4df751892b237b4707a9 Mon Sep 17 00:00:00 2001 From: Dana Powers Date: Sun, 10 Jul 2016 21:41:23 -0700 Subject: Update Sensor time_ms docs; only calculate if needed --- kafka/metrics/stats/sensor.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'kafka/metrics/stats/sensor.py') 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 -- cgit v1.2.1