From 57351e9fc922c68ff15677a168f45f0c5f988b05 Mon Sep 17 00:00:00 2001 From: akvlad Date: Wed, 21 Aug 2024 18:43:56 +0300 Subject: [PATCH] fix timestamp bug --- pyroscope/render.js | 2 +- pyroscope/select_series.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyroscope/render.js b/pyroscope/render.js index e59837b7..b6fc29ca 100644 --- a/pyroscope/render.js +++ b/pyroscope/render.js @@ -223,7 +223,7 @@ const parseQuery = (query) => { let strLabels = (match[3] || '').trim() const labels = [] while (strLabels && strLabels !== '' && strLabels !== '}') { - const m = strLabels.match(/^([,{])\s*([A-Za-z0-9_]+)\s*(!=|!~|=~|=)\s*("([^"\\]|\\.)*")/) + const m = strLabels.match(/^(,)?\s*([A-Za-z0-9_]+)\s*(!=|!~|=~|=)\s*("([^"\\]|\\.)*")/) if (!m) { throw new Error('Invalid label selector') } diff --git a/pyroscope/select_series.js b/pyroscope/select_series.js index 0cdeaa0a..0f406654 100644 --- a/pyroscope/select_series.js +++ b/pyroscope/select_series.js @@ -97,8 +97,8 @@ const selectSeriesImpl = async (fromTimeSec, toTimeSec, payload) => { typeIdSelector, serviceNameSelector ) - ).groupBy('timestamp_ns', 'fingerprint') - .orderBy(['fingerprint', 'ASC'], ['timestamp_ns', 'ASC']) + ).groupBy('timestamp_ms', 'fingerprint') + .orderBy(['fingerprint', 'ASC'], ['timestamp_ms', 'ASC']) const strMainReq = mainReq.toString() const chRes = await clickhouse .rawRequest(strMainReq + ' FORMAT JSON', null, DATABASE_NAME())