From 053dcdf23629849d6c6d1334bc58edcd493af281 Mon Sep 17 00:00:00 2001 From: Lio Young Date: Mon, 12 Jul 2021 18:45:27 +0200 Subject: [PATCH] fuck docker, I'm just running thal in the vm itself --- src/handler/client/Client.ts | 8 +-- src/modules/info/stats.ts | 4 +- src/utils/init.prometheus.ts | 6 +- src/utils/prometheus.ts | 124 +++++++++++++++++------------------ 4 files changed, 71 insertions(+), 71 deletions(-) diff --git a/src/handler/client/Client.ts b/src/handler/client/Client.ts index be843ee..dea3b6d 100644 --- a/src/handler/client/Client.ts +++ b/src/handler/client/Client.ts @@ -3,7 +3,7 @@ import { readdirSync as read } from "fs"; import path from "path"; import { Command } from "../../utils/types"; import Logger from "../../utils/logger"; -import { Prom } from "../../utils/prometheus"; +// import { Prom } from "../../utils/prometheus"; // const server = require('../../website/server'); export default class Thaldrin extends Client { @@ -26,9 +26,9 @@ export default class Thaldrin extends Client { this.lastEval = null; // @ts-ignore - this.on("raw", packet => { - Prom.events.labels(packet.t).inc() - }) + // this.on("raw", packet => { + // Prom.events.labels(packet.t).inc() + // }) this.login(config.token); this.load(); diff --git a/src/modules/info/stats.ts b/src/modules/info/stats.ts index 254ad1a..2d370a6 100644 --- a/src/modules/info/stats.ts +++ b/src/modules/info/stats.ts @@ -1,6 +1,6 @@ import Command from '../../handler/structures/Command'; import { Context, Usage } from '../../utils/types'; -import lingua from '../../utils/lingua'; +// import lingua from '../../utils/lingua'; import { MessageEmbed } from 'discord.js'; import CommandUsage from '../../utils/command.usage'; import { commitHash } from "../../utils/git" @@ -42,7 +42,7 @@ export = class Stats extends Command { let embed = new MessageEmbed().setColor(ctx.config.variables.color).setFooter(`${ctx.config.variables.name} v${ctx.config.pkg.version} [${commitHash}]`, ctx.config.variables.avatar) .setTitle(`Statistics`) - .setDescription(`Visit [our System Dashboard](https://system.thaldr.in) for more in-depth stats`) + // .setDescription(`Visit [our System Dashboard](https://system.thaldr.in) for more in-depth stats`) .addField(`Misc`, MiscValues.map((value) => `${value}`)) diff --git a/src/utils/init.prometheus.ts b/src/utils/init.prometheus.ts index 070f1fc..07fcc8a 100644 --- a/src/utils/init.prometheus.ts +++ b/src/utils/init.prometheus.ts @@ -1,5 +1,5 @@ -import { Prom } from "./prometheus"; +// import { Prom } from "./prometheus"; -Prom.load() +// Prom.load() -export default Prom \ No newline at end of file +// export default Prom \ No newline at end of file diff --git a/src/utils/prometheus.ts b/src/utils/prometheus.ts index bf020a8..f878de6 100644 --- a/src/utils/prometheus.ts +++ b/src/utils/prometheus.ts @@ -1,67 +1,67 @@ -//! Code taken from NinoDiscord/Nino -import prom from "prom-client" -import { createServer, IncomingMessage, ServerResponse } from 'http' -import vars from "../../variables" -import Logger from "./logger" +// //! Code taken from NinoDiscord/Nino +// import prom from "prom-client" +// import { createServer, IncomingMessage, ServerResponse } from 'http' +// import vars from "../../variables" +// import Logger from "./logger" -export default class Prometheus { - public commandsExecuted!: prom.Counter - public messagesSeen!: prom.Counter - public guildCount!: prom.Gauge - public totalGuilds!: prom.Gauge - public uptime!: prom.Gauge - public events!: prom.Counter - #server!: ReturnType +// export default class Prometheus { +// public commandsExecuted!: prom.Counter +// public messagesSeen!: prom.Counter +// public guildCount!: prom.Gauge +// public totalGuilds!: prom.Gauge +// public uptime!: prom.Gauge +// public events!: prom.Counter +// #server!: ReturnType - load() { - prom.collectDefaultMetrics() - this.commandsExecuted = new prom.Counter({ - labelNames: ['command'], - name: "thaldrin_commands_executed", - help: "How many commands Thaldrin has executed successfully" - }) - this.messagesSeen = new prom.Counter({ - name: "thaldrin_messages_seen", - help: "How many Messages Thaldrin has seen throughout the process lifespan" - }) - this.guildCount = new prom.Gauge({ - name: "thaldrin_guild_count", - help: "Number of Guilds Thaldrin joined this Lifecycle" - }) - this.totalGuilds = new prom.Gauge({ - name: "thaldrin_guilds_total", - help: "Total Number of Guilds Thaldrin is in" - }) - this.events = new prom.Counter({ - labelNames: ['event'], - name: "thaldrin_discord_events", - help: "Received WebSocket events from Discord" - }) - this.uptime = new prom.Gauge({ - name: "thaldrin_uptime", - help: "Thaldrin's Uptime" - }) +// load() { +// prom.collectDefaultMetrics() +// this.commandsExecuted = new prom.Counter({ +// labelNames: ['command'], +// name: "thaldrin_commands_executed", +// help: "How many commands Thaldrin has executed successfully" +// }) +// this.messagesSeen = new prom.Counter({ +// name: "thaldrin_messages_seen", +// help: "How many Messages Thaldrin has seen throughout the process lifespan" +// }) +// this.guildCount = new prom.Gauge({ +// name: "thaldrin_guild_count", +// help: "Number of Guilds Thaldrin joined this Lifecycle" +// }) +// this.totalGuilds = new prom.Gauge({ +// name: "thaldrin_guilds_total", +// help: "Total Number of Guilds Thaldrin is in" +// }) +// this.events = new prom.Counter({ +// labelNames: ['event'], +// name: "thaldrin_discord_events", +// help: "Received WebSocket events from Discord" +// }) +// this.uptime = new prom.Gauge({ +// name: "thaldrin_uptime", +// help: "Thaldrin's Uptime" +// }) - this.#server = createServer(this.onRequest.bind(this)); - this.#server.once('listening', () => Logger.info({ type: 'event:prometheusStart', message: `Prometheus: Listening at http://localhost:${vars.prometheus.port}` })); - this.#server.on('error', error => console.error(error)); - this.#server.listen(vars.prometheus.port); - } - private async onRequest(req: IncomingMessage, res: ServerResponse) { - this.uptime.set(process.uptime()) - if (req.url! === '/metrics') { - res.writeHead(200, { 'Content-Type': prom.register.contentType }); - res.write(await prom.register.metrics()); - } else if (req.url! === '/favicon.ico') { - res.writeHead(404, { 'Content-Type': 'application/json' }); - res.write('{"fuck":"you uwu"}'); - } else { - res.writeHead(400, { 'Content-Type': 'application/json' }); - res.write('{"uwu":"owo"}'); - } +// this.#server = createServer(this.onRequest.bind(this)); +// this.#server.once('listening', () => Logger.info({ type: 'event:prometheusStart', message: `Prometheus: Listening at http://localhost:${vars.prometheus.port}` })); +// this.#server.on('error', error => console.error(error)); +// this.#server.listen(vars.prometheus.port); +// } +// private async onRequest(req: IncomingMessage, res: ServerResponse) { +// this.uptime.set(process.uptime()) +// if (req.url! === '/metrics') { +// res.writeHead(200, { 'Content-Type': prom.register.contentType }); +// res.write(await prom.register.metrics()); +// } else if (req.url! === '/favicon.ico') { +// res.writeHead(404, { 'Content-Type': 'application/json' }); +// res.write('{"fuck":"you uwu"}'); +// } else { +// res.writeHead(400, { 'Content-Type': 'application/json' }); +// res.write('{"uwu":"owo"}'); +// } - res.end(); - } -} +// res.end(); +// } +// } -export const Prom = new Prometheus() +// export const Prom = new Prometheus()