From 0dabed853108440ae0e3c4b2715c9c31eab526e4 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Tue, 14 Oct 2014 02:32:52 +0200 Subject: now also list of clients gets reported starttime vs. endtime --- src/daq/accesslog/sfive-accesslog.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/daq/accesslog/sfive-accesslog.py') diff --git a/src/daq/accesslog/sfive-accesslog.py b/src/daq/accesslog/sfive-accesslog.py index a98cee1..7e74090 100755 --- a/src/daq/accesslog/sfive-accesslog.py +++ b/src/daq/accesslog/sfive-accesslog.py @@ -113,6 +113,9 @@ class ClientList: return sum + def values(self): + return self._clients.itervalues() + def update(self, linedata): if linedata['status'] != 200 and linedata['status'] != 206: return @@ -260,8 +263,8 @@ class AccessLog(): clients.clear() clients.update(linedata) else: - while linedata['ts'] > nextts: - self._sendDataset(nextts, self._duration, clients) + while linedata['ts'] >= nextts: + self._sendDataset(lastts, self._duration, clients) cnt += 1 lastts = nextts nextts = lastts + datetime.timedelta(seconds=self._duration) @@ -271,7 +274,7 @@ class AccessLog(): # send remaining data if nextts: - self._sendDataset(nextts, self._duration, clients) + self._sendDataset(lastts, self._duration, clients) cnt += 1 except re.error as e: @@ -283,6 +286,7 @@ class AccessLog(): data = { "start-time": timestamp.isoformat('T'), "duration-ms": duration * 1000, "data": { + "clients": list(clients.values()), "client-count": clients.getCnt(), "bytes-sent": clients.getBytesSent() } -- cgit v1.2.3