prom: reset task metrics

This commit is contained in:
undefined committed 2022-08-21 14:52:22 +08:00
1 parent 5bc336fc9c
commit b3e975cf38
2 files changed
+2 -1

No files matched your search

+1
View File
@@ -51,6 +51,7 @@ createMetric(Gauge, 'hydro_task', 'taskcount', {
const data = await taskColl.aggregate([
{ $group: { _id: '$type', count: { $sum: 1 } } },
]).toArray();
this.reset();
for (const line of data) {
this.set({ type: line._id as unknown as string }, line.count);
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@hydrooj/prom-client",
"version": "0.0.3",
"version": "0.0.4",
"dependencies": {
"prom-client": "^14.0.1"
}