From be689b2f949499c00d63fd2cfc52c0104e0d694f Mon Sep 17 00:00:00 2001 From: akvlad Date: Fri, 12 Apr 2024 13:15:00 +0300 Subject: [PATCH 1/9] fix: axios error --- lib/db/clickhouse.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/db/clickhouse.js b/lib/db/clickhouse.js index 369212f4..6e779d60 100644 --- a/lib/db/clickhouse.js +++ b/lib/db/clickhouse.js @@ -1368,7 +1368,12 @@ const rawRequest = async (query, data, database, config) => { (data ? `query=${encodeURIComponent(query)}` : null) ].filter(p => p) const url = `${getClickhouseUrl()}/${getParams.length ? `?${getParams.join('&')}` : ''}` - return await axios.post(url, data || query, config) + const config = { + method: 'post', + url: url, + data: data || query + } + return await axios(config) } catch (e) { logger.error('rawRequest error: ' + query) e.response?.data && logger.error(e.response.data.toString()) From 88bd91a5d1cd2e7d40b23ebd19b756d9f1f24135 Mon Sep 17 00:00:00 2001 From: akvlad Date: Thu, 18 Apr 2024 10:43:51 +0300 Subject: [PATCH 2/9] fix: axios error --- lib/db/clickhouse.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/db/clickhouse.js b/lib/db/clickhouse.js index 6e779d60..e55e4542 100644 --- a/lib/db/clickhouse.js +++ b/lib/db/clickhouse.js @@ -1363,6 +1363,12 @@ const samplesReadTable = { */ const rawRequest = async (query, data, database, config) => { try { + if (!(Buffer.isBuffer(data) || data instanceof Uint8Array || typeof data === 'string')) { + throw new Error('data must be Buffer, Uint8Array or String: currently the data is: ' + typeof data) + } + if (typeof query !== 'string') { + throw new Error('query must be String: currently the query is: ' + typeof query) + } const getParams = [ (database ? `database=${encodeURIComponent(database)}` : null), (data ? `query=${encodeURIComponent(query)}` : null) From df8bc6fd55a65639374340dccf165ccc9bd302f5 Mon Sep 17 00:00:00 2001 From: akvlad Date: Thu, 18 Apr 2024 10:48:09 +0300 Subject: [PATCH 3/9] fix: axios error --- lib/db/clickhouse.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/db/clickhouse.js b/lib/db/clickhouse.js index e55e4542..4a14c5fc 100644 --- a/lib/db/clickhouse.js +++ b/lib/db/clickhouse.js @@ -1363,7 +1363,7 @@ const samplesReadTable = { */ const rawRequest = async (query, data, database, config) => { try { - if (!(Buffer.isBuffer(data) || data instanceof Uint8Array || typeof data === 'string')) { + if (data && !(Buffer.isBuffer(data) || data instanceof Uint8Array || typeof data === 'string')) { throw new Error('data must be Buffer, Uint8Array or String: currently the data is: ' + typeof data) } if (typeof query !== 'string') { From e3f77139b20084716b329a95e1fc7471ba25cb33 Mon Sep 17 00:00:00 2001 From: akvlad Date: Thu, 18 Apr 2024 13:22:39 +0300 Subject: [PATCH 4/9] fix: axios error --- lib/db/clickhouse.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/db/clickhouse.js b/lib/db/clickhouse.js index 4a14c5fc..6f3a32a0 100644 --- a/lib/db/clickhouse.js +++ b/lib/db/clickhouse.js @@ -1374,7 +1374,8 @@ const rawRequest = async (query, data, database, config) => { (data ? `query=${encodeURIComponent(query)}` : null) ].filter(p => p) const url = `${getClickhouseUrl()}/${getParams.length ? `?${getParams.join('&')}` : ''}` - const config = { + config = { + ...(config || {}), method: 'post', url: url, data: data || query From df7ce07d2ac391e3fd9625d54a3292d225094b07 Mon Sep 17 00:00:00 2001 From: akvlad Date: Thu, 18 Apr 2024 15:23:19 +0300 Subject: [PATCH 5/9] fix: axios error. strings -> Buffer to avoid the merge --- lib/db/clickhouse.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/db/clickhouse.js b/lib/db/clickhouse.js index 6f3a32a0..f934708f 100644 --- a/lib/db/clickhouse.js +++ b/lib/db/clickhouse.js @@ -1366,6 +1366,9 @@ const rawRequest = async (query, data, database, config) => { if (data && !(Buffer.isBuffer(data) || data instanceof Uint8Array || typeof data === 'string')) { throw new Error('data must be Buffer, Uint8Array or String: currently the data is: ' + typeof data) } + if (typeof data === 'string') { + data = Buffer.from(data, 'utf8') + } if (typeof query !== 'string') { throw new Error('query must be String: currently the query is: ' + typeof query) } From 6840076884e8f950d638d79396ead844ae413e26 Mon Sep 17 00:00:00 2001 From: akvlad Date: Thu, 25 Apr 2024 13:55:14 +0300 Subject: [PATCH 6/9] fix: dash support --- test/e2e | 2 +- traceql/traceql.bnf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/e2e b/test/e2e index 85e344c8..8847ca00 160000 --- a/test/e2e +++ b/test/e2e @@ -1 +1 @@ -Subproject commit 85e344c83efb747b123758212e216f9f6a355da2 +Subproject commit 8847ca00a0deda194008bb2d8dccc02d879267d2 diff --git a/traceql/traceql.bnf b/traceql/traceql.bnf index d9f21c12..366698ce 100644 --- a/traceql/traceql.bnf +++ b/traceql/traceql.bnf @@ -13,7 +13,7 @@ cmp ::= "="|"!="|"<="|">="|"<"|">" cmp_val ::= [] measurement ::= "ns"|"us"|"ms"|"s"|"m"|"h"|"d" -label_name ::= ("." | | "_") *("." | | "_" | ) +label_name ::= ("." | | "-" | "_") *("." | | "_" | "-" | ) number ::= ["-"] ["." ] attr_selector ::= From c618b37fafccaf3c0320f97eae7b68c0c7ee480c Mon Sep 17 00:00:00 2001 From: akvlad Date: Thu, 25 Apr 2024 14:08:13 +0300 Subject: [PATCH 7/9] fix: axios update --- jest.config.js | 5 ++++- package.json | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/jest.config.js b/jest.config.js index 437c608e..85caef4e 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,4 +1,7 @@ const path = require('path') module.exports = { - setupFilesAfterEnv: [path.join(__dirname, '/test/jest.setup.js')] + setupFilesAfterEnv: [path.join(__dirname, '/test/jest.setup.js')], + moduleNameMapper: { + '^axios$': 'axios/dist/node/axios.cjs' + } } diff --git a/package.json b/package.json index b2fcc193..5fe5e2ce 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "@qxip/influx-line-protocol-parser": "^0.2.1", "@qxip/plugnplay": "^3.3.1", "@stricjs/router": "^5.0.6", - "axios": "^0.28.0", + "axios": "^1.6.8", "bnf": "^1.0.1", "csv-writer": "^1.6.0", "date-fns": "^2.27.0", From f48d607bce6f7da47adbfa135e8d242429295bdd Mon Sep 17 00:00:00 2001 From: akvlad Date: Thu, 25 Apr 2024 14:08:52 +0300 Subject: [PATCH 8/9] fix: axios update --- package-lock.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 71207d81..eb128abd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,7 @@ "@qxip/plugnplay": "^3.3.1", "@stricjs/router": "^5.0.6", "@stricjs/utils": "^1.6.1", - "axios": "^0.28.0", + "axios": "^1.6.8", "basic-auth": "^2.0.1", "bnf": "^1.0.1", "csv-writer": "^1.6.0", @@ -3574,11 +3574,11 @@ } }, "node_modules/axios": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.28.0.tgz", - "integrity": "sha512-Tu7NYoGY4Yoc7I+Npf9HhUMtEEpV7ZiLH9yndTCoNhcpBH0kwcvFbzYN9/u5QKI5A6uefjsNNWaz5olJVYS62Q==", + "version": "1.6.8", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.8.tgz", + "integrity": "sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==", "dependencies": { - "follow-redirects": "^1.15.0", + "follow-redirects": "^1.15.6", "form-data": "^4.0.0", "proxy-from-env": "^1.1.0" } From 52d9c5dc20b32285726983970b6aba85b5cfe2f8 Mon Sep 17 00:00:00 2001 From: Lorenzo Mangani Date: Mon, 6 May 2024 12:05:47 +0200 Subject: [PATCH 9/9] Update README.md Signed-off-by: Lorenzo Mangani --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ae80df03..480a0767 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ * **Secure**: Retain total control of data, using **ClickHouse**, **DuckDB** or **InfluxDB** IOx with **S3** object storage * **Indepentent**: Opensource, Community powered, Anti lock-in alternative to Vendor controlled stacks -![lgtm_vs_qryn](https://github.com/metrico/qryn/assets/1423657/2e9071ba-c578-49fc-be1d-d91944a5891e) +