Remove unsupported Influx/Grafana analytics code

This commit is contained in:
Ske
2018-10-11 11:23:20 +02:00
parent c15eddcfa1
commit 2f728e09aa
5 changed files with 3 additions and 133 deletions

View File

@@ -9,7 +9,6 @@ import discord
from pluralkit import db
from pluralkit.bot import channel_logger, utils, embeds
from pluralkit.stats import StatCollector
logger = logging.getLogger("pluralkit.bot.proxy")
@@ -87,13 +86,12 @@ class DeletionPermissionError(Exception):
class Proxy:
def __init__(self, client: discord.Client, token: str, logger: channel_logger.ChannelLogger, stats: StatCollector):
def __init__(self, client: discord.Client, token: str, logger: channel_logger.ChannelLogger):
self.logger = logging.getLogger("pluralkit.bot.proxy")
self.session = aiohttp.ClientSession()
self.client = client
self.token = token
self.channel_logger = logger
self.stats = stats
async def save_channel_webhook(self, conn, channel: discord.Channel, id: str, token: str) -> (str, str):
await db.add_webhook(conn, channel.id, id, token)
@@ -172,9 +170,6 @@ class Proxy:
if resp.status == 200:
message = await resp.json()
# Report webhook stats to Influx
await self.stats.report_webhook(time.perf_counter() - time_before, True)
await db.add_message(conn, message["id"], message["channel_id"], member.id, original_message.author.id)
try:
@@ -212,9 +207,6 @@ class Proxy:
message["timestamp"]),
message_id=message["id"])
elif resp.status == 404 and not has_already_retried:
# Report webhook stats to Influx
await self.stats.report_webhook(time.perf_counter() - time_before, False)
# Webhook doesn't exist. Delete it from the DB, create, and add a new one
self.logger.warning("Webhook registered in DB doesn't exist, deleting hook from DB, re-adding, and trying again (channel={}, hook={})".format(original_message.channel.id, hook_id))
await db.delete_webhook(conn, original_message.channel.id)
@@ -223,9 +215,6 @@ class Proxy:
# Then try again all over, making sure to not retry again and go in a loop should it continually fail
return await self.do_proxy_message(conn, member, original_message, text, attachment_url, has_already_retried=True)
else:
# Report webhook stats to Influx
await self.stats.report_webhook(time.perf_counter() - time_before, False)
raise discord.HTTPException(resp, await resp.text())
async def try_proxy_message(self, conn, message: discord.Message):