mirror of
https://github.com/hyperdxio/hyperdx
synced 2026-04-21 13:37:15 +00:00
chore: bump clickhouse client to v0.2.7 (#159)
This commit is contained in:
parent
226a00d43f
commit
ce70319186
8 changed files with 41 additions and 25 deletions
5
.changeset/cuddly-cougars-burn.md
Normal file
5
.changeset/cuddly-cougars-burn.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@hyperdx/api': minor
|
||||
---
|
||||
|
||||
chore: bump clickhouse client to v0.2.7
|
||||
|
|
@ -129,7 +129,7 @@ services:
|
|||
environment:
|
||||
APP_TYPE: 'scheduled-task'
|
||||
CLICKHOUSE_HOST: http://ch-server:8123
|
||||
CLICKHOUSE_LOG_LEVEL: trace
|
||||
CLICKHOUSE_LOG_LEVEL: ${HYPERDX_LOG_LEVEL}
|
||||
CLICKHOUSE_PASSWORD: worker
|
||||
CLICKHOUSE_USER: worker
|
||||
FRONTEND_URL: 'http://localhost:8080' # need to be localhost (CORS)
|
||||
|
|
@ -166,7 +166,7 @@ services:
|
|||
AGGREGATOR_API_URL: 'http://aggregator:8001'
|
||||
APP_TYPE: 'api'
|
||||
CLICKHOUSE_HOST: http://ch-server:8123
|
||||
CLICKHOUSE_LOG_LEVEL: trace
|
||||
CLICKHOUSE_LOG_LEVEL: ${HYPERDX_LOG_LEVEL}
|
||||
CLICKHOUSE_PASSWORD: api
|
||||
CLICKHOUSE_USER: api
|
||||
EXPRESS_SESSION_SECRET: 'hyperdx is cool 👋'
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ services:
|
|||
environment:
|
||||
APP_TYPE: 'scheduled-task'
|
||||
CLICKHOUSE_HOST: http://ch-server:8123
|
||||
CLICKHOUSE_LOG_LEVEL: trace
|
||||
CLICKHOUSE_LOG_LEVEL: ${HYPERDX_LOG_LEVEL}
|
||||
CLICKHOUSE_PASSWORD: worker
|
||||
CLICKHOUSE_USER: worker
|
||||
FRONTEND_URL: ${HYPERDX_APP_URL}:${HYPERDX_APP_PORT} # need to be localhost (CORS)
|
||||
|
|
@ -137,7 +137,7 @@ services:
|
|||
AGGREGATOR_API_URL: 'http://aggregator:8001'
|
||||
APP_TYPE: 'api'
|
||||
CLICKHOUSE_HOST: http://ch-server:8123
|
||||
CLICKHOUSE_LOG_LEVEL: trace
|
||||
CLICKHOUSE_LOG_LEVEL: ${HYPERDX_LOG_LEVEL}
|
||||
CLICKHOUSE_PASSWORD: api
|
||||
CLICKHOUSE_USER: api
|
||||
EXPRESS_SESSION_SECRET: 'hyperdx is cool 👋'
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
"node": ">=18.12.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@clickhouse/client": "^0.1.1",
|
||||
"@clickhouse/client": "^0.2.7",
|
||||
"@hyperdx/lucene": "^3.1.1",
|
||||
"@hyperdx/node-logger": "^0.2.8",
|
||||
"@hyperdx/node-opentelemetry": "^0.3.0",
|
||||
|
|
|
|||
|
|
@ -1,19 +1,19 @@
|
|||
import type { ResponseJSON, ResultSet } from '@clickhouse/client';
|
||||
import {
|
||||
BaseResultSet,
|
||||
createClient,
|
||||
ErrorLogParams as _CHErrorLogParams,
|
||||
Logger as _CHLogger,
|
||||
LogParams as _CHLogParams,
|
||||
ResponseJSON,
|
||||
SettingsMap,
|
||||
} from '@clickhouse/client';
|
||||
import {
|
||||
ErrorLogParams as _CHErrorLogParams,
|
||||
LogParams as _CHLogParams,
|
||||
} from '@clickhouse/client/dist/logger';
|
||||
import opentelemetry from '@opentelemetry/api';
|
||||
import * as fns from 'date-fns';
|
||||
import _ from 'lodash';
|
||||
import ms from 'ms';
|
||||
import { serializeError } from 'serialize-error';
|
||||
import SqlString from 'sqlstring';
|
||||
import { Readable } from 'stream';
|
||||
|
||||
import * as config from '@/config';
|
||||
import { sleep } from '@/utils/common';
|
||||
|
|
@ -192,7 +192,16 @@ export const buildMetricStreamAdditionalFilters = (
|
|||
teamId: string,
|
||||
) => SettingsMap.from({});
|
||||
|
||||
export const healthCheck = () => client.ping();
|
||||
export const healthCheck = async () => {
|
||||
const result = await client.ping();
|
||||
if (!result.success) {
|
||||
logger.error({
|
||||
message: 'ClickHouse health check failed',
|
||||
error: result.error,
|
||||
});
|
||||
throw result.error;
|
||||
}
|
||||
};
|
||||
|
||||
export const connect = async () => {
|
||||
// FIXME: this is a hack to avoid CI failure
|
||||
|
|
@ -1838,7 +1847,7 @@ export const getRrwebEvents = async ({
|
|||
],
|
||||
);
|
||||
|
||||
let resultSet: ResultSet;
|
||||
let resultSet: BaseResultSet<Readable>;
|
||||
await tracer.startActiveSpan('clickhouse.getRrwebEvents', async span => {
|
||||
span.setAttribute('query', query);
|
||||
|
||||
|
|
@ -1897,7 +1906,7 @@ export const getLogStream = async ({
|
|||
limit,
|
||||
});
|
||||
|
||||
let resultSet: ResultSet;
|
||||
let resultSet: BaseResultSet<Readable>;
|
||||
await tracer.startActiveSpan('clickhouse.getLogStream', async span => {
|
||||
span.setAttribute('query', query);
|
||||
span.setAttribute('search', q);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import type { Row } from '@clickhouse/client';
|
||||
import opentelemetry, { SpanStatusCode } from '@opentelemetry/api';
|
||||
import express from 'express';
|
||||
import { isNumber, omit, parseInt } from 'lodash';
|
||||
|
|
@ -261,7 +262,7 @@ router.get('/stream', async (req, res, next) => {
|
|||
res.write('event: end\ndata:\n\n');
|
||||
res.end();
|
||||
} else {
|
||||
stream.on('data', (rows: any[]) => {
|
||||
stream.on('data', (rows: Row[]) => {
|
||||
resultCount += rows.length;
|
||||
logger.info(`Sending ${rows.length} rows`);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import type { Row } from '@clickhouse/client';
|
||||
import opentelemetry, { SpanStatusCode } from '@opentelemetry/api';
|
||||
import express from 'express';
|
||||
import { isNumber, parseInt } from 'lodash';
|
||||
|
|
@ -83,7 +84,7 @@ router.get('/:sessionId/rrweb', async (req, res, next) => {
|
|||
offset: offsetNum,
|
||||
});
|
||||
|
||||
stream.on('data', (rows: any[]) => {
|
||||
stream.on('data', (rows: Row[]) => {
|
||||
res.write(`${rows.map(row => `data: ${row.text}`).join('\n')}\n\n`);
|
||||
res.flush();
|
||||
});
|
||||
|
|
|
|||
20
yarn.lock
20
yarn.lock
|
|
@ -1272,12 +1272,17 @@
|
|||
human-id "^1.0.2"
|
||||
prettier "^2.7.1"
|
||||
|
||||
"@clickhouse/client@^0.1.1":
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/@clickhouse/client/-/client-0.1.1.tgz#1a848438baf5deefadf7dcee40ad441c8666c398"
|
||||
integrity sha512-oeALCAjNFEXHPxMHJgj0QERiLM2ZknOOavvHB1mxmztZLhTuj86HaQEfh9q8x7LgKnv3jep7lb/fhFgD71WTjA==
|
||||
"@clickhouse/client-common@0.2.7":
|
||||
version "0.2.7"
|
||||
resolved "https://registry.yarnpkg.com/@clickhouse/client-common/-/client-common-0.2.7.tgz#c238ef9f5386f7d7a18e09931bb765a4ad4d7ebb"
|
||||
integrity sha512-vgZm+8c5Cu1toIx1/xplF5dEHlCPw+7pJDOOEtLv2CIUVZ0Bl6nGVZ43EWxRdHeah9ivTfoRWhN1zI1PxjH0xQ==
|
||||
|
||||
"@clickhouse/client@^0.2.7":
|
||||
version "0.2.7"
|
||||
resolved "https://registry.yarnpkg.com/@clickhouse/client/-/client-0.2.7.tgz#f13103d7a4ab39d86307e6211504f46b8c71faae"
|
||||
integrity sha512-ZiyarrGngHc+f5AjZSA7mkQfvnE/71jgXk304B0ps8V+aBpE2CsFB6AQmE/Mk2YkP5j+8r/JfG+m0AZWmE27ig==
|
||||
dependencies:
|
||||
uuid "^9.0.0"
|
||||
"@clickhouse/client-common" "0.2.7"
|
||||
|
||||
"@cnakazawa/watch@^1.0.3":
|
||||
version "1.0.4"
|
||||
|
|
@ -16466,11 +16471,6 @@ uuid@^8.3.2:
|
|||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
|
||||
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
|
||||
|
||||
uuid@^9.0.0:
|
||||
version "9.0.0"
|
||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.0.tgz#592f550650024a38ceb0c562f2f6aa435761efb5"
|
||||
integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==
|
||||
|
||||
uvu@^0.5.0:
|
||||
version "0.5.6"
|
||||
resolved "https://registry.yarnpkg.com/uvu/-/uvu-0.5.6.tgz#2754ca20bcb0bb59b64e9985e84d2e81058502df"
|
||||
|
|
|
|||
Loading…
Reference in a new issue