From de332f109b86fc5f7743a43e8f82e66ecc8f2b12 Mon Sep 17 00:00:00 2001 From: Sathyajith Bhat Date: Tue, 19 Dec 2023 18:59:58 +1100 Subject: [PATCH] change update frequency, move some logs to debug --- src/collectors.ts | 4 ++-- src/index.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/collectors.ts b/src/collectors.ts index 7ad4e03..0697b76 100644 --- a/src/collectors.ts +++ b/src/collectors.ts @@ -14,7 +14,7 @@ export class YNABCollector { help: "Account Cleared Balance amounts", labelNames: accountLabels, collect: async () => { - console.log(`Collecting Cleared Balance for ${this.accountBalances.length} accounts`); + console.debug(`Collecting Cleared Balance for ${this.accountBalances.length} accounts`); this.accountBalances.forEach(a => { accountClearedBalanceGauge.labels({account_name: a.name, type: a.type, closed: String(a.closed)}).set(a.cleared_balance / 1000); }); @@ -27,7 +27,7 @@ export class YNABCollector { registers: [register], labelNames: accountLabels, collect: async () => { - console.log(`Collecting Uncleared Balance for ${this.accountBalances.length} accounts`); + console.debug(`Collecting Uncleared Balance for ${this.accountBalances.length} accounts`); this.accountBalances.forEach(a => { accountUnClearedBalanceGauge.labels({account_name: a.name, type: a.type, closed: String(a.closed)}).set(a.uncleared_balance / 1000); }); diff --git a/src/index.ts b/src/index.ts index d3af5bd..c1d9417 100644 --- a/src/index.ts +++ b/src/index.ts @@ -19,7 +19,7 @@ async function main() { const ynabCollector = new YNABCollector(); new CronJob({ - cronTime: "0 * * * * ", + cronTime: "*/15 * * * *", onTick: async () => { ynabCollector.accountBalances = (await scheduledAccountBalanceUpdate(ynab)).accounts; console.log(`${ynabCollector.accountBalances.length} accounts refreshed`); @@ -35,7 +35,7 @@ async function main() { app.get('/metrics', async (req: Request, res: Response) => { res.setHeader('Content-Type', register.contentType); - console.log('getting metrics'); + console.debug('getting metrics'); const results = await register.metrics(); res.send(results); });