mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-12 15:52:57 +00:00
feat: chunk queries
This commit is contained in:
parent
4afd208177
commit
703d98998e
@ -24,7 +24,7 @@ import type { MetricConfigOpt } from "@/types/dashboard";
|
|||||||
import type { Instance, Endpoint, Service } from "@/types/selector";
|
import type { Instance, Endpoint, Service } from "@/types/selector";
|
||||||
import type { Node, Call } from "@/types/topology";
|
import type { Node, Call } from "@/types/topology";
|
||||||
|
|
||||||
export async function useDashboardQueryProcessor(configArr: Indexable[]) {
|
export async function useDashboardQueryProcessor(configList: Indexable[]) {
|
||||||
function expressionsGraphql(config: Indexable, idx: number) {
|
function expressionsGraphql(config: Indexable, idx: number) {
|
||||||
if (!(config.metrics && config.metrics[0])) {
|
if (!(config.metrics && config.metrics[0])) {
|
||||||
return;
|
return;
|
||||||
@ -135,6 +135,7 @@ export async function useDashboardQueryProcessor(configArr: Indexable[]) {
|
|||||||
|
|
||||||
return { source, tips, typesOfMQE };
|
return { source, tips, typesOfMQE };
|
||||||
}
|
}
|
||||||
|
async function fetchMetrics(configArr: any) {
|
||||||
const appStore = useAppStoreWithOut();
|
const appStore = useAppStoreWithOut();
|
||||||
const variables: string[] = [`$duration: Duration!`];
|
const variables: string[] = [`$duration: Duration!`];
|
||||||
let fragments = "";
|
let fragments = "";
|
||||||
@ -180,6 +181,27 @@ export async function useDashboardQueryProcessor(configArr: Indexable[]) {
|
|||||||
return { 0: { source: {}, tips: [], typesOfMQE: [] } };
|
return { 0: { source: {}, tips: [], typesOfMQE: [] } };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function chunkArray(array: any[], chunkSize: number) {
|
||||||
|
const result = [];
|
||||||
|
for (let i = 0; i < array.length; i += chunkSize) {
|
||||||
|
result.push(array.slice(i, i + chunkSize));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
const partArr = chunkArray(configList, 6);
|
||||||
|
const promiseArr = partArr.map((d: Array<Indexable>) => fetchMetrics(d));
|
||||||
|
const responseList = await Promise.all(promiseArr);
|
||||||
|
let resp = {};
|
||||||
|
for (const item of responseList) {
|
||||||
|
resp = {
|
||||||
|
...resp,
|
||||||
|
...item,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
|
||||||
export async function useExpressionsQueryPodsMetrics(
|
export async function useExpressionsQueryPodsMetrics(
|
||||||
allPods: Array<(Instance | Endpoint | Service) & Indexable>,
|
allPods: Array<(Instance | Endpoint | Service) & Indexable>,
|
||||||
|
Loading…
Reference in New Issue
Block a user