Hugging Face Deployer
Deploy bot to Hugging Face Spaces
03b405b
Raw History Blame Contribute Delete
461 Bytes
const { getDb } = require("../config/db");
const { nowIso } = require("../utils/time");
function metric(jobId, name, value, unit = null) {
getDb().prepare("INSERT INTO metrics (job_id, name, value, unit, created_at) VALUES (?, ?, ?, ?, ?)")
.run(jobId, name, value, unit, nowIso());
}
function listMetrics(limit = 200) {
return getDb().prepare("SELECT * FROM metrics ORDER BY id DESC LIMIT ?").all(limit);
}
module.exports = { metric, listMetrics };