mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-10-14 20:01:28 +00:00
fix: set different scope for topN metrics (#40)
This commit is contained in:
@@ -22,6 +22,7 @@ import { useSelectorStore } from "@/store/modules/selectors";
|
||||
import { useAppStoreWithOut } from "@/store/modules/app";
|
||||
import { Instance, Endpoint, Service } from "@/types/selector";
|
||||
import { MetricConfigOpt } from "@/types/dashboard";
|
||||
import { MetricCatalog } from "@/views/dashboard/data";
|
||||
|
||||
export function useQueryProcessor(config: any) {
|
||||
if (!(config.metrics && config.metrics[0])) {
|
||||
@@ -61,8 +62,10 @@ export function useQueryProcessor(config: any) {
|
||||
parentService: ["All"].includes(dashboardStore.entity)
|
||||
? null
|
||||
: selectorStore.currentService.value,
|
||||
normal: selectorStore.currentService.normal,
|
||||
scope: dashboardStore.entity,
|
||||
normal: selectorStore.currentService
|
||||
? selectorStore.currentService.normal
|
||||
: true,
|
||||
scope: config.catalog || dashboardStore.entity,
|
||||
topN: 10,
|
||||
order: c.sortOrder || "DES",
|
||||
};
|
||||
@@ -340,3 +343,27 @@ export function aggregation(val: number, config: any): number | string {
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
export async function useGetMetricEntity(metric: string, metricType: any) {
|
||||
if (!metric || !metricType) {
|
||||
return;
|
||||
}
|
||||
let catalog = "";
|
||||
const dashboardStore = useDashboardStore();
|
||||
if (
|
||||
[
|
||||
MetricQueryTypes.ReadSampledRecords,
|
||||
MetricQueryTypes.SortMetrics,
|
||||
].includes(metricType)
|
||||
) {
|
||||
const res = await dashboardStore.fetchMetricList(metric);
|
||||
if (res.errors) {
|
||||
ElMessage.error(res.errors);
|
||||
return;
|
||||
}
|
||||
const c: string = res.data.metrics[0].catalog;
|
||||
catalog = (MetricCatalog as any)[c];
|
||||
}
|
||||
|
||||
return catalog;
|
||||
}
|
||||
|
Reference in New Issue
Block a user