add missing gauge resets

This commit is contained in:
soffee 2025-04-08 01:58:46 +03:00
parent b0c91b2a34
commit 29d6c752ce
2 changed files with 3 additions and 1 deletions

View file

@ -1,7 +1,7 @@
{
"name": "mtproto_exporter",
"type": "module",
"version": "1.0.0",
"version": "1.0.1",
"packageManager": "pnpm@10.6.5",
"license": "MIT",
"scripts": {

View file

@ -26,6 +26,7 @@ function newStaticPeerInfoGauge(tg: TelegramClient) {
help: "Dialog information exposed as labels",
labelNames: ["peerId", "peerType", "displayName"],
collect: async () => {
gauge.reset();
for await (const d of tg.iterDialogs()) {
gauge.set({
peerId: d.peer.id,
@ -44,6 +45,7 @@ function newUnreadCountGauge(tg: TelegramClient) {
help: "Number of unread messages in dialogs",
labelNames: ["peerId"],
collect: async () => {
gauge.reset();
for await (const d of tg.iterDialogs()) {
gauge.set({
peerId: d.peer.id,