2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-14 03:37:49 +00:00

Amend connection count to avoid oversized count

Since the log analysis merely needs to know if a connect/disconnect is redundant,
only report 0, 1, or '2' connections to indicate 2 or greater.  log analysis
then would want to seek out a connect with eventdata of '1' and disconnect with
eventdata of '0' and mostly ignore the '2' info.  Desire for more data
could be done by actually counting the connects and disconnects, this is
just to provide a fast path to finding the 'first connection' and 'last disconnect'
signatures.
This commit is contained in:
Jarrod Johnson 2014-03-10 13:25:08 -04:00
parent bbbb88b2b2
commit 12d3f91d59

View File

@ -63,17 +63,24 @@ class _ConsoleHandler(object):
self.users[username] += 1
else:
self.users[username] = 1
edata = self.users[username]
if edata > 2: # for log purposes, only need to
# clearly indicate redundant connections
# not connection count
edata = 2
self.logger.log(
logdata=username, ltype=log.DataTypes.event,
event=log.Events.clientconnect,
eventdata=self.users[username])
event=log.Events.clientconnect, eventdata=edata)
def detachuser(self, username):
self.users[username] -= 1
if self.users[username] < 2:
edata = self.users[username]
else:
edata = 2
self.logger.log(
logdata=username, ltype=log.DataTypes.event,
event=log.Events.clientdisconnect,
eventdata=self.users[username])
event=log.Events.clientdisconnect, eventdata=edata)
def _handle_console_output(self, data):
if type(data) == int: