Skip to content

Commit 9e57672

Browse files
committed
fix(TopShards): substring tenant name out of shards path
1 parent dd585b1 commit 9e57672

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

src/containers/Tenant/Diagnostics/TopShards/TopShards.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,11 @@ function TopShards({
137137
// eslint-disable-next-line
138138
render: ({value}) => {
139139
return (
140-
<span onClick={onSchemaClick(value)} className={bLink({view: 'normal'})}>
140+
<span
141+
// tenant name is substringed out in sql query but is needed here
142+
onClick={onSchemaClick(path + value)}
143+
className={bLink({view: 'normal'})}
144+
>
141145
{value}
142146
</span>
143147
);

src/store/reducers/shardsWorkload.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,20 @@ function formatSortOrder({columnId, order}) {
1313
return `${columnId} ${order}`;
1414
}
1515

16-
function createShardQuery(path, sortOrder) {
16+
function createShardQuery(path, sortOrder, tenantName) {
1717
const orderBy = Array.isArray(sortOrder) ?
1818
`ORDER BY ${sortOrder.map(formatSortOrder).join(', ')}` :
1919
'';
2020

21-
return `SELECT Path, TabletId, CPUCores, DataSize
21+
const pathSelect = tenantName ?
22+
`CAST(SUBSTRING(CAST(Path AS String), ${tenantName.length}) AS Utf8) AS Path` :
23+
'Path';
24+
25+
return `SELECT
26+
${pathSelect},
27+
TabletId,
28+
CPUCores,
29+
DataSize
2230
FROM \`.sys/partition_stats\`
2331
WHERE
2432
Path='${path}'
@@ -68,7 +76,7 @@ const shardsWorkload = (state = initialState, action) => {
6876
export const sendShardQuery = ({database, path = '', sortOrder}) => {
6977
return createApiRequest({
7078
request: window.api.sendQuery({
71-
query: createShardQuery(path, sortOrder),
79+
query: createShardQuery(path, sortOrder, database),
7280
database,
7381
action: queryAction,
7482
}, {

0 commit comments

Comments
 (0)