generated from nhcarrigan/template
feat: add prometheus metrics
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user