mirror of
https://github.com/graphql-hive/console
synced 2026-05-23 09:08:34 +00:00
Fix ClickHouse stats reporting (#4067)
This commit is contained in:
parent
5dce106eeb
commit
fa0ce58e9c
5 changed files with 12 additions and 6 deletions
|
|
@ -18,7 +18,7 @@ function hashQuery(query: SqlStatement): string {
|
|||
export interface QueryResponse<T> {
|
||||
data: readonly T[];
|
||||
rows: number;
|
||||
statistics: {
|
||||
statistics?: {
|
||||
elapsed: number;
|
||||
};
|
||||
}
|
||||
|
|
@ -167,7 +167,7 @@ export class ClickHouse {
|
|||
|
||||
this.config.onReadEnd?.(queryId, {
|
||||
totalSeconds: endedAt,
|
||||
elapsedSeconds: response.statistics.elapsed,
|
||||
elapsedSeconds: response.statistics?.elapsed,
|
||||
});
|
||||
|
||||
return response;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ export interface ClickHouseConfig {
|
|||
label: string,
|
||||
timings: {
|
||||
totalSeconds: number;
|
||||
elapsedSeconds: number;
|
||||
elapsedSeconds?: number;
|
||||
},
|
||||
) => void;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -270,7 +270,10 @@ export async function main() {
|
|||
requestTimeout: env.clickhouse.requestTimeout,
|
||||
onReadEnd(query, timings) {
|
||||
clickHouseReadDuration.labels({ query }).observe(timings.totalSeconds);
|
||||
clickHouseElapsedDuration.labels({ query }).observe(timings.elapsedSeconds);
|
||||
|
||||
if (timings.elapsedSeconds !== undefined) {
|
||||
clickHouseElapsedDuration.labels({ query }).observe(timings.elapsedSeconds);
|
||||
}
|
||||
},
|
||||
},
|
||||
cdn: env.cdn,
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ export function createEstimator(config: {
|
|||
label: string,
|
||||
timings: {
|
||||
totalSeconds: number;
|
||||
elapsedSeconds: number;
|
||||
elapsedSeconds?: number;
|
||||
},
|
||||
) => void;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -46,7 +46,10 @@ async function main() {
|
|||
password: env.clickhouse.password,
|
||||
onReadEnd(query, timings) {
|
||||
clickHouseReadDuration.labels({ query }).observe(timings.totalSeconds);
|
||||
clickHouseElapsedDuration.labels({ query }).observe(timings.elapsedSeconds);
|
||||
|
||||
if (timings.elapsedSeconds !== undefined) {
|
||||
clickHouseElapsedDuration.labels({ query }).observe(timings.elapsedSeconds);
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue