Skip to content

Commit

Permalink
Add opentime to last addRecord call
Browse files Browse the repository at this point in the history
  • Loading branch information
djw8605 committed Feb 1, 2021
1 parent 2d6dfd6 commit 77fe9ee
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Collectors/DetailedCollector.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def addRecord(self, sid, userID, fileClose, timestamp, addr, openTime):
rec['timestamp'] = int(timestamp*1000) # expected to be in MS since Unix epoch
rec['start_time'] = int(openTime*1000)
rec['end_time'] = int(timestamp*1000)
rec['operation_time'] = rec['end_time'] - rec['start_time']
rec['operation_time'] = int((rec['end_time'] - rec['start_time']) / 1000)

try:
rec['server_hostname'] = socket.gethostbyaddr(addr)[0]
Expand Down Expand Up @@ -328,12 +328,12 @@ def process(self, data, addr, port):
if transfer_key in self._transfers:
userId = self._transfers[transfer_key][1].userID
openTime = self._transfers[transfer_key][0][0]
rec = self.addRecord(sid, userId, hd, time_record.tEnd, addr, openTime)
rec = self.addRecord(sid, userId, hd, time_record.tBeg, addr, openTime)
self.logger.debug("Record to send: %s", str(rec))
del self._transfers[transfer_key]
self.logger.debug('%i %s', idx, hd)
else:
rec = self.addRecord(sid, 0, hd, time_record.tEnd, addr, time_record.tEnd)
rec = self.addRecord(sid, 0, hd, time_record.tBeg, addr, time_record.tBeg)
self.logger.error("file to close not found. fileID: %i, serverID: %s. close=%s",
hd.fileID, sid, str(hd))

Expand Down Expand Up @@ -491,7 +491,8 @@ def process(self, data, addr, port):
sid = key.rsplit(".", 1)[0]
userId = cur_value[1].userID
addr = cur_value[0][1]
rec = self.addRecord(sid, userId, cur_value[2], now_time, addr)
openTime = cur_value[0][0]
rec = self.addRecord(sid, userId, cur_value[2], now_time, addr, openTime)
del self._transfers[key]
self.logger.debug("Size of transfers map: %i", len(self._transfers))
self.metrics_q.put({'type': 'hash size', 'count': len(self._transfers), 'hash name': 'transfers'})
Expand Down

0 comments on commit 77fe9ee

Please sign in to comment.