diff --git a/lib/db/clickhouse.js b/lib/db/clickhouse.js index e112d829..a704fe5f 100644 --- a/lib/db/clickhouse.js +++ b/lib/db/clickhouse.js @@ -826,7 +826,13 @@ const outputTempoSearch = async (dataStream, res) => { */ const preprocessStream = (rawStream, processors) => { let dStream = StringStream.from(rawStream.data).lines().endWith(JSON.stringify({ EOF: true })) - .map(chunk => chunk ? JSON.parse(chunk) : ({}), DataStream) + .map(chunk => { + try { + return chunk ? JSON.parse(chunk) : ({}) + } catch (e) { + return {} + } + }, DataStream) .map(chunk => { try { if (!chunk || !chunk.labels) { diff --git a/lib/handlers/prom_query_range.js b/lib/handlers/prom_query_range.js index 9452224c..df37c1ab 100644 --- a/lib/handlers/prom_query_range.js +++ b/lib/handlers/prom_query_range.js @@ -19,7 +19,6 @@ async function handler (req, res) { const query = req.query.query try { const result = await rangeQuery(query, startMs, endMs, stepMs) - console.log(JSON.stringify(result)) return res.code(200).send(result) } catch (err) { return res.code(500).send(JSON.stringify({ status: 'error', error: err.message })) diff --git a/lib/handlers/push.js b/lib/handlers/push.js index daef55c7..8f1fd5b8 100644 --- a/lib/handlers/push.js +++ b/lib/handlers/push.js @@ -105,7 +105,7 @@ async function handler (req, res) { req.log.debug('POST /loki/api/v1/push') if (!req.body) { await processRawPush(req, DATABASE.cache.labels, bulk_labels, bulk, - toJSON, fingerPrint) + toJson, fingerPrint) return res.code(200).send() } if (readonly) {