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