Spaces:
Configuration error
Configuration error
Download src/monitoring/metrics.js from UUUZCX/video-optimizer-bot: direct link, hf CLI and curl.
- Browser
- Download file 1.11 kB
-
https://huggingface.co/spaces/UUUZCX/video-optimizer-bot/resolve/main/src/monitoring/metrics.js
- Command line
-
hf download hf://spaces/UUUZCX/video-optimizer-bot/src/monitoring/metrics.js
-
curl -L -o metrics.js https://huggingface.co/spaces/UUUZCX/video-optimizer-bot/resolve/main/src/monitoring/metrics.js
1.11 kB
| const si = require("systeminformation"); | |
| const { directorySize } = require("../utils/fs"); | |
| const { paths } = require("../config/paths"); | |
| const { listJobs } = require("../queue/jobs"); | |
| async function snapshot() { | |
| const [cpu, mem, fsSize, tempSize, cacheSize] = await Promise.all([ | |
| si.currentLoad(), | |
| si.mem(), | |
| si.fsSize(), | |
| directorySize(paths.temp), | |
| directorySize(paths.cache) | |
| ]); | |
| const jobs = listJobs(200); | |
| return { | |
| time: new Date().toISOString(), | |
| cpu: { load: cpu.currentLoad }, | |
| memory: { total: mem.total, used: mem.used, free: mem.free }, | |
| disks: fsSize, | |
| storage: { tempSize, cacheSize }, | |
| jobs: { | |
| total: jobs.length, | |
| active: jobs.filter((job) => ["downloading", "validating", "probing", "planning", "splitting", "compressing", "uploading"].includes(job.status)).length, | |
| failed: jobs.filter((job) => job.status === "failed").length, | |
| completed: jobs.filter((job) => job.status === "completed").length, | |
| queued: jobs.filter((job) => ["queued", "retrying"].includes(job.status)).length | |
| } | |
| }; | |
| } | |
| module.exports = { snapshot }; | |