Spaces:
Configuration error
Configuration error
File size: 461 Bytes
03b405b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 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 };
|