mirror of
https://github.com/imputnet/cobalt.git
synced 2025-07-21 12:48:28 +00:00
added prometheus default metrics to /metrics
This commit is contained in:
parent
bf1dbe1ad8
commit
51fb110ce6
3
.gitignore
vendored
3
.gitignore
vendored
@ -24,3 +24,6 @@ docker-compose.yml
|
||||
|
||||
# cookie file
|
||||
cookies.json
|
||||
|
||||
# pnpm
|
||||
pnpm-lock.yaml
|
@ -30,12 +30,14 @@
|
||||
"dotenv": "^16.0.1",
|
||||
"esbuild": "^0.14.51",
|
||||
"express": "^4.18.1",
|
||||
"express-prometheus-middleware": "^1.2.0",
|
||||
"express-rate-limit": "^6.3.0",
|
||||
"ffmpeg-static": "^5.1.0",
|
||||
"hls-parser": "^0.10.7",
|
||||
"ipaddr.js": "2.1.0",
|
||||
"nanoid": "^4.0.2",
|
||||
"node-cache": "^5.1.2",
|
||||
"prom-client": "^15.1.2",
|
||||
"psl": "1.9.0",
|
||||
"set-cookie-parser": "2.6.0",
|
||||
"undici": "^6.7.0",
|
||||
|
@ -1,6 +1,7 @@
|
||||
import cors from "cors";
|
||||
import rateLimit from "express-rate-limit";
|
||||
import { randomBytes } from "crypto";
|
||||
import expressPrometheusMiddleware from "express-prometheus-middleware";
|
||||
|
||||
const ipSalt = randomBytes(64).toString('hex');
|
||||
|
||||
@ -65,6 +66,13 @@ export function runAPI(express, app, gitCommit, gitBranch, __dirname) {
|
||||
next();
|
||||
});
|
||||
|
||||
app.use(expressPrometheusMiddleware({
|
||||
metricsPath: "/metrics",
|
||||
collectDefaultMetrics: true,
|
||||
collectGCMetrics: true,
|
||||
metricsApp: app,
|
||||
}))
|
||||
|
||||
app.use('/api/json', express.json({
|
||||
verify: (req, res, buf) => {
|
||||
let acceptCon = String(req.header('Accept')) === "application/json";
|
||||
|
Loading…
Reference in New Issue
Block a user