From 1ba932ac78b3df050e2a37e236298d9c94bcd746 Mon Sep 17 00:00:00 2001 From: akvlad Date: Tue, 2 Jan 2024 14:32:38 +0200 Subject: [PATCH] filter nan values on ingestion --- lib/handlers/influx_write.js | 5 ++++- lib/handlers/prom_push.js | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/handlers/influx_write.js b/lib/handlers/influx_write.js index 42a93103..dd3e33f5 100644 --- a/lib/handlers/influx_write.js +++ b/lib/handlers/influx_write.js @@ -108,6 +108,9 @@ async function handler (req, res) { asyncLogError('no bulkable data', req.log) return res.code(204).send('') } + if (typeof value === 'number' && isNaN(value)) { + return + } const values = [ finger, BigInt(pad('0000000000000000000', timestamp, true)), @@ -116,7 +119,7 @@ async function handler (req, res) { ] bulk.add([values]) } - /* logs or syslog */ + /* logs or syslog */ } else if (stream.measurement === 'syslog' || JSONFields.message) { // Send fields as a JSON object for qryn to parse // const message = JSON.stringify(JSONFields) diff --git a/lib/handlers/prom_push.js b/lib/handlers/prom_push.js index b841b2fe..e2712053 100644 --- a/lib/handlers/prom_push.js +++ b/lib/handlers/prom_push.js @@ -59,6 +59,9 @@ async function handler (req, res) { asyncLogError({ entry }, req.log) return } + if (isNaN(entry.value)) { + return + } const ts = BigInt(entry.timestamp) const values = [ finger,