feat: add prometheus metrics

This commit is contained in:
2024-08-13 08:13:03 -07:00
parent 188480052b
commit 23fba3d95d
9 changed files with 78 additions and 0 deletions
+10
View File
@@ -6,6 +6,7 @@ import https from "https";
import { Octokit } from "@octokit/rest";
import { GuildTextBasedChannel } from "discord.js";
import express from "express";
import { register } from "prom-client";
import { IgnoredActors, ThankYou } from "../config/Github";
import { ExtendedClient } from "../interfaces/ExtendedClient";
@@ -47,6 +48,15 @@ export const serve = async (bot: ExtendedClient) => {
res.send("bot online!");
});
app.get("/metrics", async (_req, res) => {
try {
res.set("Content-Type", register.contentType);
res.end(await register.metrics());
} catch (err) {
res.status(500).end(err);
}
});
app.post("/kofi", async (req, res) => {
const payload = JSON.parse(req.body.data);
const {