Implement indexing into Apache Druid #1
12
core/bot.py
12
core/bot.py
|
@ -221,8 +221,8 @@ class IRCBot(IRCClient):
|
||||||
del main.TempChan[self.net]
|
del main.TempChan[self.net]
|
||||||
|
|
||||||
def event(self, **cast):
|
def event(self, **cast):
|
||||||
if not "time" in cast.keys():
|
if not "ts" in cast.keys():
|
||||||
cast["time"] = str(datetime.now().isoformat())
|
cast["ts"] = str(datetime.now().isoformat())
|
||||||
|
|
||||||
# remove odd stuff
|
# remove odd stuff
|
||||||
for i in list(cast.keys()): # Make a copy of the .keys() as Python 3 cannot handle iterating over
|
for i in list(cast.keys()): # Make a copy of the .keys() as Python 3 cannot handle iterating over
|
||||||
|
@ -699,7 +699,7 @@ class IRCBot(IRCClient):
|
||||||
"net": self.net,
|
"net": self.net,
|
||||||
"num": self.num,
|
"num": self.num,
|
||||||
"status": "signedon",
|
"status": "signedon",
|
||||||
"time": ctime,
|
"ts": ctime,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
if not self.authenticated:
|
if not self.authenticated:
|
||||||
|
@ -747,7 +747,7 @@ class IRCBot(IRCClient):
|
||||||
self.event(type="kick", muser=kicker, channel=channel, msg=message, user=kickee)
|
self.event(type="kick", muser=kicker, channel=channel, msg=message, user=kickee)
|
||||||
|
|
||||||
def chanlessEvent(self, cast):
|
def chanlessEvent(self, cast):
|
||||||
cast["time"] = str(datetime.now().isoformat())
|
cast["ts"] = str(datetime.now().isoformat())
|
||||||
cast["nick"], cast["ident"], cast["host"] = parsen(cast["muser"])
|
cast["nick"], cast["ident"], cast["host"] = parsen(cast["muser"])
|
||||||
if dedup(self.name, cast): # Needs to be kept self.name until the dedup
|
if dedup(self.name, cast): # Needs to be kept self.name until the dedup
|
||||||
# function is converted to the new net, num
|
# function is converted to the new net, num
|
||||||
|
@ -834,7 +834,7 @@ class IRCBotFactory(ReconnectingClientFactory):
|
||||||
"num": self.num,
|
"num": self.num,
|
||||||
"status": "lost",
|
"status": "lost",
|
||||||
"message": error,
|
"message": error,
|
||||||
"time": ctime,
|
"ts": ctime,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
self.retry(connector)
|
self.retry(connector)
|
||||||
|
@ -857,7 +857,7 @@ class IRCBotFactory(ReconnectingClientFactory):
|
||||||
"num": self.num,
|
"num": self.num,
|
||||||
"status": "failed",
|
"status": "failed",
|
||||||
"message": error,
|
"message": error,
|
||||||
"time": ctime,
|
"ts": ctime,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
self.retry(connector)
|
self.retry(connector)
|
||||||
|
|
|
@ -24,7 +24,7 @@ order = [
|
||||||
"realname",
|
"realname",
|
||||||
"server",
|
"server",
|
||||||
"status",
|
"status",
|
||||||
"time",
|
"ts",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,8 @@ from utils.logging.debug import debug
|
||||||
|
|
||||||
def dedup(numName, b):
|
def dedup(numName, b):
|
||||||
c = deepcopy(b)
|
c = deepcopy(b)
|
||||||
if "time" in c.keys():
|
if "ts" in c.keys():
|
||||||
del c["time"]
|
del c["ts"]
|
||||||
c["approxtime"] = str(datetime.utcnow().timestamp())[: main.config["Tweaks"]["DedupPrecision"]]
|
c["approxtime"] = str(datetime.utcnow().timestamp())[: main.config["Tweaks"]["DedupPrecision"]]
|
||||||
castHash = siphash24(main.hashKey, dumps(c, sort_keys=True).encode("utf-8"))
|
castHash = siphash24(main.hashKey, dumps(c, sort_keys=True).encode("utf-8"))
|
||||||
del c["approxtime"]
|
del c["approxtime"]
|
||||||
|
|
Loading…
Reference in New Issue