Skip to content

Commit 3020e4b

Browse files
committed
[DEBUG]
1 parent 07cb796 commit 3020e4b

File tree

1 file changed

+55
-35
lines changed

1 file changed

+55
-35
lines changed

src/shared/hooks/useGetChartData.ts

Lines changed: 55 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -32,48 +32,68 @@ export const useGetChartData = async ({
3232
from,
3333
to,
3434
}: UseGetChartDataType) => {
35-
let aggregations = [];
35+
// let aggregations = [];
3636

37-
switch (groupBy) {
38-
case 'node':
39-
aggregations = [
40-
{ method: 'sum', groupBy: ['chart', 'node'] },
41-
{ method, groupBy: ['node'] },
42-
];
43-
break;
44-
case 'dimension':
45-
aggregations = [{ method, groupBy: ['dimension'] }];
46-
break;
47-
case 'instance':
48-
aggregations = [{ method: 'sum', groupBy: ['chart', 'node'] }];
49-
break;
50-
default:
51-
aggregations = [
52-
{ method: 'sum', groupBy: ['chart', `label=${groupBy}`] },
53-
{ method: 'avg', groupBy: [`label=${groupBy}`] },
54-
];
55-
break;
56-
}
37+
// switch (groupBy) {
38+
// case 'node':
39+
// aggregations = [
40+
// { method: 'sum', groupBy: ['chart', 'node'] },
41+
// { method, groupBy: ['node'] },
42+
// ];
43+
// break;
44+
// case 'dimension':
45+
// aggregations = [{ method, groupBy: ['dimension'] }];
46+
// break;
47+
// case 'instance':
48+
// aggregations = [{ method: 'sum', groupBy: ['chart', 'node'] }];
49+
// break;
50+
// default:
51+
// aggregations = [
52+
// { method: 'sum', groupBy: ['chart', `label=${groupBy}`] },
53+
// { method: 'avg', groupBy: [`label=${groupBy}`] },
54+
// ];
55+
// break;
56+
// }
5757

5858
return await Post({
5959
path: `/v3/spaces/${spaceId}/rooms/${roomId}/data`,
6060
baseUrl,
6161
data: {
62-
filter: {
63-
nodeIDs: nodes,
64-
context: contextId,
65-
dimensions,
66-
...(filterBy && filterValue ? { labels: { [filterBy]: [filterValue] } } : {}),
62+
format: 'json2',
63+
options: ['jsonwrap', 'nonzero', 'flip', 'ms', 'jw-anomaly-rates', 'minify'],
64+
scope: {
65+
contexts: ['mem.thp_details'],
66+
nodes: [
67+
'01702efd-af72-45b0-8e2f-33d806e5699f',
68+
'0a841ab0-bc12-41a0-894a-e41fd5440eb8',
69+
'ce0e8300-8270-4171-ae48-c452d3b91ba9',
70+
'e0d74612-cf5a-4030-959c-de5dee3d793a',
71+
'3ed8bb08-f2d3-4054-b423-67a8313fb130',
72+
'af4b47bb-d6be-4a46-b6b0-0a735dbc0a4c',
73+
'2626d41a-39f1-407f-8965-c08d146e8c4d',
74+
'e48415db-3d25-4521-982c-30e9f46c96d2',
75+
'382c7e2a-4b64-46ba-b8a5-f5f75eafa3e9',
76+
'8b9cc340-6d60-47d9-99d5-de43071de8ba',
77+
],
6778
},
68-
aggregations,
69-
agent_options: ['jsonwrap', 'flip', 'ms'],
70-
points: 335,
71-
format: 'json',
72-
group,
73-
gtime: 0,
74-
after: from,
75-
before: to,
76-
with_metadata: true,
79+
selectors: {
80+
contexts: ['*'],
81+
nodes: ['*'],
82+
instances: ['*'],
83+
dimensions: ['*'],
84+
labels: ['*'],
85+
},
86+
aggregations: {
87+
metrics: [
88+
{
89+
group_by: ['dimension'],
90+
group_by_label: [],
91+
aggregation: 'sum',
92+
},
93+
],
94+
time: { time_group: 'average', time_resampling: 0 },
95+
},
96+
window: { after: 1722412818, before: 1722413718, points: 269 },
7797
},
7898
});
7999
};

0 commit comments

Comments
 (0)