mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-13 08:17:33 +00:00
add errorInstances
This commit is contained in:
parent
c5a82baca6
commit
ae71c43a3f
@ -171,7 +171,7 @@ export const GetAsyncTaskList = {
|
|||||||
export const GetAsyncProfileTaskProcess = {
|
export const GetAsyncProfileTaskProcess = {
|
||||||
variable: "$taskID: String",
|
variable: "$taskID: String",
|
||||||
query: `
|
query: `
|
||||||
taskLogs: queryAsyncProfilerTaskProgress(taskID: $taskID) {
|
taskProgress: queryAsyncProfilerTaskProgress(taskID: $taskID) {
|
||||||
logs {
|
logs {
|
||||||
id
|
id
|
||||||
instanceId
|
instanceId
|
||||||
|
@ -19,13 +19,17 @@ import type { Option } from "@/types/app";
|
|||||||
import type { AsyncProfilingTaskList } from "@/types/async-profiling";
|
import type { AsyncProfilingTaskList } from "@/types/async-profiling";
|
||||||
import { store } from "@/store";
|
import { store } from "@/store";
|
||||||
import graphql from "@/graphql";
|
import graphql from "@/graphql";
|
||||||
|
import { useAppStoreWithOut } from "@/store/modules/app";
|
||||||
import type { AxiosResponse } from "axios";
|
import type { AxiosResponse } from "axios";
|
||||||
|
import type { Instance } from "@/types/selector";
|
||||||
|
|
||||||
interface AsyncProfilingState {
|
interface AsyncProfilingState {
|
||||||
taskList: Array<Recordable<AsyncProfilingTaskList>>;
|
taskList: Array<Recordable<AsyncProfilingTaskList>>;
|
||||||
labels: Option[];
|
labels: Option[];
|
||||||
asyncProfilingTips: string;
|
asyncProfilingTips: string;
|
||||||
selectedTask: Recordable<AsyncProfilingTaskList>;
|
selectedTask: Recordable<AsyncProfilingTaskList>;
|
||||||
|
taskProgress: Recordable<any>;
|
||||||
|
instances: Instance[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const asyncProfilingStore = defineStore({
|
export const asyncProfilingStore = defineStore({
|
||||||
@ -35,6 +39,8 @@ export const asyncProfilingStore = defineStore({
|
|||||||
labels: [{ value: "", label: "" }],
|
labels: [{ value: "", label: "" }],
|
||||||
asyncProfilingTips: "",
|
asyncProfilingTips: "",
|
||||||
selectedTask: {},
|
selectedTask: {},
|
||||||
|
taskProgress: {},
|
||||||
|
instances: [],
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
setSelectedTask(task: Recordable<AsyncProfilingTaskList>) {
|
setSelectedTask(task: Recordable<AsyncProfilingTaskList>) {
|
||||||
@ -64,7 +70,21 @@ export const asyncProfilingStore = defineStore({
|
|||||||
if (res.data.errors) {
|
if (res.data.errors) {
|
||||||
return res.data;
|
return res.data;
|
||||||
}
|
}
|
||||||
this.taskLogs = res.data.data.taskLogs;
|
this.taskProgress = res.data.data.taskProgress;
|
||||||
|
return res.data;
|
||||||
|
},
|
||||||
|
async getServiceInstances(param?: { serviceId: string; isRelation: boolean }): Promise<Nullable<AxiosResponse>> {
|
||||||
|
const serviceId = param ? param.serviceId : this.currentService?.id;
|
||||||
|
if (!serviceId) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const res: AxiosResponse = await graphql.query("queryInstances").params({
|
||||||
|
serviceId,
|
||||||
|
duration: useAppStoreWithOut().durationTime,
|
||||||
|
});
|
||||||
|
if (!res.data.errors) {
|
||||||
|
this.instances = res.data.data.pods || [];
|
||||||
|
}
|
||||||
return res.data;
|
return res.data;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
2
src/types/profile.d.ts
vendored
2
src/types/profile.d.ts
vendored
@ -41,6 +41,8 @@ export interface TaskListItem {
|
|||||||
dumpPeriod: number;
|
dumpPeriod: number;
|
||||||
maxSamplingCount: number;
|
maxSamplingCount: number;
|
||||||
logs: TaskLog[];
|
logs: TaskLog[];
|
||||||
|
errorInstanceIds: string[];
|
||||||
|
successInstanceIds: string[];
|
||||||
}
|
}
|
||||||
export interface SegmentSpan {
|
export interface SegmentSpan {
|
||||||
spanId: string;
|
spanId: string;
|
||||||
|
@ -19,9 +19,21 @@ limitations under the License. -->
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import { onMounted } from "vue";
|
||||||
import type { PropType } from "vue";
|
import type { PropType } from "vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
|
import { ElMessage } from "element-plus";
|
||||||
|
|
||||||
|
import { useAsyncProfilingStore } from "@/store/modules/async-profiling";
|
||||||
|
|
||||||
|
const asyncProfilingStore = useAsyncProfilingStore();
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
const resp = await asyncProfilingStore.getServiceInstances();
|
||||||
|
if (resp.errors) {
|
||||||
|
ElMessage.error(resp.errors);
|
||||||
|
}
|
||||||
|
});
|
||||||
/* global defineProps */
|
/* global defineProps */
|
||||||
defineProps({
|
defineProps({
|
||||||
config: {
|
config: {
|
||||||
|
@ -102,6 +102,19 @@ limitations under the License. -->
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<h5 class="mb-10 mt-10" v-show="errorInstances.length"> {{ t("errorInstanceIds") }}. </h5>
|
||||||
|
<div class="log-item" v-for="(instance, index) in errorInstances" :key="instance.value || index">
|
||||||
|
<div class="mb-10 sm">
|
||||||
|
<span class="mr-10 grey">{{ t("instance") }}:</span>
|
||||||
|
<span>{{ instance.label }}</span>
|
||||||
|
</div>
|
||||||
|
<div v-for="(d, index) in instance.attributes" :key="d.value + index">
|
||||||
|
<span class="mr-10 grey">{{ d.name }}:</span>
|
||||||
|
<span class="mr-20">{{ d.value }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
@ -113,6 +126,7 @@ limitations under the License. -->
|
|||||||
import type { TaskLog, TaskListItem } from "@/types/profile";
|
import type { TaskLog, TaskListItem } from "@/types/profile";
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
import { dateFormat } from "@/utils/dateFormat";
|
import { dateFormat } from "@/utils/dateFormat";
|
||||||
|
import type { Instance } from "@/types/selector";
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const asyncProfilingStore = useAsyncProfilingStore();
|
const asyncProfilingStore = useAsyncProfilingStore();
|
||||||
@ -121,6 +135,8 @@ limitations under the License. -->
|
|||||||
const service = ref<string>("");
|
const service = ref<string>("");
|
||||||
const selectedTask = ref<TaskListItem | Record<string, never>>({});
|
const selectedTask = ref<TaskListItem | Record<string, never>>({});
|
||||||
const instanceLogs = ref<TaskLog | any>({});
|
const instanceLogs = ref<TaskLog | any>({});
|
||||||
|
const errorInstances = ref<Instance[]>([]);
|
||||||
|
const successInstances = ref<Instance[]>([]);
|
||||||
|
|
||||||
async function changeTask(item: TaskListItem) {
|
async function changeTask(item: TaskListItem) {
|
||||||
asyncProfilingStore.setCurrentSegment({});
|
asyncProfilingStore.setCurrentSegment({});
|
||||||
@ -138,7 +154,16 @@ limitations under the License. -->
|
|||||||
ElMessage.error(res.errors);
|
ElMessage.error(res.errors);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
item.logs = asyncProfilingStore.taskLogs;
|
item = {
|
||||||
|
...item,
|
||||||
|
...asyncProfilingStore.taskProgress,
|
||||||
|
};
|
||||||
|
errorInstances.value = asyncProfilingStore.instances.filter(
|
||||||
|
(d: Instance) => d.id && item.errorInstanceIds.includes(d.id),
|
||||||
|
);
|
||||||
|
successInstances.value = asyncProfilingStore.instances.filter(
|
||||||
|
(d: Instance) => d.id && item.successInstanceIds.includes(d.id),
|
||||||
|
);
|
||||||
instanceLogs.value = {};
|
instanceLogs.value = {};
|
||||||
for (const d of item.logs) {
|
for (const d of item.logs) {
|
||||||
if (instanceLogs.value[d.instanceName]) {
|
if (instanceLogs.value[d.instanceName]) {
|
||||||
|
Loading…
Reference in New Issue
Block a user