Skip to content

Commit

Permalink
fix: add query id
Browse files Browse the repository at this point in the history
  • Loading branch information
krosy1337 committed Oct 23, 2023
1 parent d6e3d60 commit a7d92a6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"axios": "0.19.2",
"bem-cn-lite": "4.0.0",
"copy-to-clipboard": "^3.3.3",
"crc-32": "^1.2.2",
"history": "4.10.1",
"js-cookie": "2.2.1",
"lodash": "4.17.11",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import crc32 from 'crc-32';
import cn from 'bem-cn-lite';

import DataTable, {type Column} from '@gravity-ui/react-data-table';
Expand All @@ -22,6 +23,7 @@ const TOP_QUERIES_COLUMNS_IDS = {
ReadBytes: 'ReadBytes',
UserSID: 'UserSID',
TopQueriesQueryText: 'TopQueriesQueryText',
QueryId: 'QueryId',
};

const cpuTimeUsColumn: Column<KeyValueRow> = {
Expand Down Expand Up @@ -76,6 +78,13 @@ const topQueriesQueryTextColumn: Column<KeyValueRow> = {
sortable: false,
};

const queryIdColumn: Column<KeyValueRow> = {
name: TOP_QUERIES_COLUMNS_IDS.QueryId,
render: ({row}) => String(crc32.str(String(row.QueryText))),
width: 130,
sortable: false,
};

export const getTopQueriesColumns = (): Column<KeyValueRow>[] => {
return [
cpuTimeUsColumn,
Expand All @@ -88,5 +97,5 @@ export const getTopQueriesColumns = (): Column<KeyValueRow>[] => {
};

export const getTenantOverviewTopQueriesColumns = (): Column<KeyValueRow>[] => {
return [topQueriesQueryTextColumn, cpuTimeUsColumn];
return [queryIdColumn, topQueriesQueryTextColumn, cpuTimeUsColumn];
};

0 comments on commit a7d92a6

Please sign in to comment.