mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-07-18 15:25:24 +00:00
feat: add trace log
This commit is contained in:
parent
6c90f535d2
commit
22126faef5
@ -35,7 +35,6 @@ limitations under the License. -->
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, watch } from "vue";
|
import { ref, watch } from "vue";
|
||||||
import type { PropType } from "vue";
|
import type { PropType } from "vue";
|
||||||
import { ElSelect, ElOption } from "element-plus";
|
|
||||||
|
|
||||||
interface Option {
|
interface Option {
|
||||||
label: string;
|
label: string;
|
||||||
|
65
src/graphql/fragments/log.ts
Normal file
65
src/graphql/fragments/log.ts
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
/**
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
* (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const QueryBrowserErrorLogs = {
|
||||||
|
variable: "$condition: BrowserErrorLogQueryCondition",
|
||||||
|
query: `
|
||||||
|
queryBrowserErrorLogs(condition: $condition) {
|
||||||
|
logs {
|
||||||
|
message
|
||||||
|
service
|
||||||
|
serviceVersion
|
||||||
|
time
|
||||||
|
pagePath
|
||||||
|
category
|
||||||
|
errorUrl
|
||||||
|
stack
|
||||||
|
grade
|
||||||
|
}
|
||||||
|
total
|
||||||
|
}`,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const QueryServiceLogs = {
|
||||||
|
variable: "$condition: LogQueryCondition",
|
||||||
|
query: `
|
||||||
|
queryLogs(condition: $condition) {
|
||||||
|
logs {
|
||||||
|
serviceName
|
||||||
|
serviceId
|
||||||
|
serviceInstanceName
|
||||||
|
serviceInstanceId
|
||||||
|
endpointName
|
||||||
|
endpointId
|
||||||
|
traceId
|
||||||
|
timestamp
|
||||||
|
contentType
|
||||||
|
content
|
||||||
|
tags {
|
||||||
|
key
|
||||||
|
value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
total
|
||||||
|
}`,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const QueryLogsByKeywords = {
|
||||||
|
variable: "",
|
||||||
|
query: `
|
||||||
|
support: supportQueryLogsByKeywords`,
|
||||||
|
};
|
@ -21,6 +21,7 @@ import * as selector from "./query/selector";
|
|||||||
import * as dashboard from "./query/dashboard";
|
import * as dashboard from "./query/dashboard";
|
||||||
import * as topology from "./query/topology";
|
import * as topology from "./query/topology";
|
||||||
import * as trace from "./query/trace";
|
import * as trace from "./query/trace";
|
||||||
|
import * as log from "./query/log";
|
||||||
|
|
||||||
const query: { [key: string]: string } = {
|
const query: { [key: string]: string } = {
|
||||||
...app,
|
...app,
|
||||||
@ -28,6 +29,7 @@ const query: { [key: string]: string } = {
|
|||||||
...dashboard,
|
...dashboard,
|
||||||
...topology,
|
...topology,
|
||||||
...trace,
|
...trace,
|
||||||
|
...log,
|
||||||
};
|
};
|
||||||
class Graphql {
|
class Graphql {
|
||||||
private queryData = "";
|
private queryData = "";
|
||||||
|
27
src/graphql/query/log.ts
Normal file
27
src/graphql/query/log.ts
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/**
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
* (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import {
|
||||||
|
QueryBrowserErrorLogs,
|
||||||
|
QueryServiceLogs,
|
||||||
|
QueryLogsByKeywords,
|
||||||
|
} from "../fragments/log";
|
||||||
|
|
||||||
|
export const queryBrowserErrorLogs = `query queryBrowserErrorLogs(${QueryBrowserErrorLogs.variable}) {
|
||||||
|
${QueryBrowserErrorLogs.query}}`;
|
||||||
|
export const queryServiceLogs = `query queryLogs(${QueryServiceLogs.variable}) {${QueryServiceLogs.query}}`;
|
||||||
|
export const queryLogsByKeywords = `query queryLogsByKeywords {${QueryLogsByKeywords.query}}`;
|
@ -32,8 +32,8 @@ interface TraceState {
|
|||||||
traceSpans: Span[];
|
traceSpans: Span[];
|
||||||
currentTrace: Trace | any;
|
currentTrace: Trace | any;
|
||||||
conditions: any;
|
conditions: any;
|
||||||
// traceSpanLogs: any[];
|
traceSpanLogs: any[];
|
||||||
// traceSpanLogsTotal: number;
|
traceSpanLogsTotal: number;
|
||||||
// traceListErrors: string;
|
// traceListErrors: string;
|
||||||
// traceSpanErrors: string;
|
// traceSpanErrors: string;
|
||||||
// traceSpanLogErrors: string;
|
// traceSpanLogErrors: string;
|
||||||
@ -56,6 +56,8 @@ export const traceStore = defineStore({
|
|||||||
queryOrder: "BY_START_TIME",
|
queryOrder: "BY_START_TIME",
|
||||||
paging: { pageNum: 1, pageSize: 15, needTotal: true },
|
paging: { pageNum: 1, pageSize: 15, needTotal: true },
|
||||||
},
|
},
|
||||||
|
traceSpanLogs: [],
|
||||||
|
traceSpanLogsTotal: 0,
|
||||||
durationTime: useAppStoreWithOut().durationTime,
|
durationTime: useAppStoreWithOut().durationTime,
|
||||||
selectorStore: useSelectorStore(),
|
selectorStore: useSelectorStore(),
|
||||||
}),
|
}),
|
||||||
@ -122,6 +124,19 @@ export const traceStore = defineStore({
|
|||||||
}
|
}
|
||||||
this.setTraceSpans(res.data.data.trace.spans || []);
|
this.setTraceSpans(res.data.data.trace.spans || []);
|
||||||
},
|
},
|
||||||
|
async getSpanLogs(params: any) {
|
||||||
|
const res: AxiosResponse = await graphql
|
||||||
|
.query("queryServiceLogs")
|
||||||
|
.params(params);
|
||||||
|
if (res.data.errors) {
|
||||||
|
this.traceSpanLogs = [];
|
||||||
|
this.traceSpanLogsTotal = 0;
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
this.traceSpanLogs = res.data.data.queryLogs.logs || [];
|
||||||
|
this.traceSpanLogsTotal = res.data.data.queryLogs.total;
|
||||||
|
return res.data;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
117
src/views/components/LogTable/Index.vue
Normal file
117
src/views/components/LogTable/Index.vue
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
<!-- Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
|
this work for additional information regarding copyright ownership.
|
||||||
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
(the "License"); you may not use this file except in compliance with
|
||||||
|
the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License. -->
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="log">
|
||||||
|
<div class="log-header">
|
||||||
|
<template v-for="(item, index) in columns">
|
||||||
|
<div
|
||||||
|
class="method"
|
||||||
|
:style="`width: ${item.method}px`"
|
||||||
|
v-if="item.drag"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
|
<span class="r cp" ref="dragger" :data-index="index">
|
||||||
|
<Icon iconName="settings_ethernet" size="sm" />
|
||||||
|
</span>
|
||||||
|
{{ t(item.value) }}
|
||||||
|
</div>
|
||||||
|
<div v-else :class="item.label" :key="`col${index}`">
|
||||||
|
{{ t(item.value) }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
<div v-if="type === 'browser'">
|
||||||
|
<LogBrowser
|
||||||
|
v-for="(item, index) in tableData"
|
||||||
|
:data="item"
|
||||||
|
:key="'browser' + index"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
<LogServiceItem
|
||||||
|
v-for="(item, index) in tableData"
|
||||||
|
:data="item"
|
||||||
|
:key="'service' + index"
|
||||||
|
:noLink="noLink"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<slot></slot>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref } from "vue";
|
||||||
|
import { useI18n } from "vue-i18n";
|
||||||
|
import { ServiceLogConstants, BrowserLogConstants } from "./data";
|
||||||
|
import LogBrowser from "./LogBrowser.vue";
|
||||||
|
import LogServiceItem from "./LogService.vue";
|
||||||
|
|
||||||
|
/*global defineProps, Nullable */
|
||||||
|
const props = defineProps({
|
||||||
|
type: { type: String, default: "service" },
|
||||||
|
tableData: { type: Array, default: () => [] },
|
||||||
|
noLink: { type: Boolean, default: true },
|
||||||
|
});
|
||||||
|
const { t } = useI18n();
|
||||||
|
const dragger = ref<Nullable<HTMLSpanElement>>(null);
|
||||||
|
// const method = ref<number>(380);
|
||||||
|
const columns: any[] =
|
||||||
|
props.type === "browser" ? BrowserLogConstants : ServiceLogConstants;
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.log {
|
||||||
|
font-size: 12px;
|
||||||
|
height: 100%;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.log-header {
|
||||||
|
/*display: flex;*/
|
||||||
|
white-space: nowrap;
|
||||||
|
user-select: none;
|
||||||
|
border-left: 0;
|
||||||
|
border-right: 0;
|
||||||
|
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
||||||
|
/*background-color: #f3f4f9;*/
|
||||||
|
.traceId {
|
||||||
|
width: 390px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content,
|
||||||
|
.tags {
|
||||||
|
width: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.serviceInstanceName,
|
||||||
|
.serviceName {
|
||||||
|
width: 200px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.log-header div {
|
||||||
|
/*min-width: 140px;*/
|
||||||
|
width: 140px;
|
||||||
|
/*flex-grow: 1;*/
|
||||||
|
display: inline-block;
|
||||||
|
padding: 0 4px;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-right: 1px dotted silver;
|
||||||
|
line-height: 30px;
|
||||||
|
background-color: #f3f4f9;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
</style>
|
107
src/views/components/LogTable/LogBrowser.vue
Normal file
107
src/views/components/LogTable/LogBrowser.vue
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
<!-- Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
|
this work for additional information regarding copyright ownership.
|
||||||
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
(the "License"); you may not use this file except in compliance with
|
||||||
|
the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License. -->
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div @click="showSelectSpan" :class="['log-item', 'clearfix']" ref="logItem">
|
||||||
|
<div
|
||||||
|
v-for="(item, index) in columns"
|
||||||
|
:key="index"
|
||||||
|
:class="[
|
||||||
|
'method',
|
||||||
|
['message', 'stack'].includes(item.label) ? 'autoHeight' : '',
|
||||||
|
]"
|
||||||
|
:style="{
|
||||||
|
lineHeight: 1.3,
|
||||||
|
width: `${item.drag ? item.method : ''}px`,
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<span v-if="item.label === 'time'">{{ dateFormat(data.time) }}</span>
|
||||||
|
<span v-else-if="item.label === 'errorUrl'">{{ data.pagePath }}</span>
|
||||||
|
<span v-else v-tooltip:bottom="data[item.label] || '-'">{{
|
||||||
|
data[item.label] || "-"
|
||||||
|
}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
import { BrowserLogConstants } from "./data";
|
||||||
|
|
||||||
|
/*global defineProps, defineEmits, NodeListOf */
|
||||||
|
const props = defineProps({
|
||||||
|
data: { type: Array as any, default: () => [] },
|
||||||
|
});
|
||||||
|
const columns = BrowserLogConstants;
|
||||||
|
const emit = defineEmits(["select"]);
|
||||||
|
|
||||||
|
const dateFormat = (date: number, pattern = "YYYY-MM-DD HH:mm:ss") =>
|
||||||
|
dayjs(date).format(pattern);
|
||||||
|
|
||||||
|
function showSelectSpan() {
|
||||||
|
const items: NodeListOf<any> = document.querySelectorAll(".log-item");
|
||||||
|
|
||||||
|
for (const item of items) {
|
||||||
|
item.style.background = "#fff";
|
||||||
|
}
|
||||||
|
const logItem: any = this.$refs.logItem;
|
||||||
|
|
||||||
|
logItem.style.background = "rgba(0, 0, 0, 0.1)";
|
||||||
|
emit("select", props.data);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.log-item {
|
||||||
|
white-space: nowrap;
|
||||||
|
position: relative;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.log-item.selected {
|
||||||
|
background: rgba(0, 0, 0, 0.04);
|
||||||
|
}
|
||||||
|
|
||||||
|
.log-item:not(.level0):hover {
|
||||||
|
background: rgba(0, 0, 0, 0.04);
|
||||||
|
}
|
||||||
|
|
||||||
|
.log-item:hover {
|
||||||
|
background: rgba(0, 0, 0, 0.04) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.log-item > div {
|
||||||
|
width: 140px;
|
||||||
|
padding: 0 5px;
|
||||||
|
display: inline-block;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-right: 1px dotted silver;
|
||||||
|
overflow: hidden;
|
||||||
|
line-height: 30px;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.log-item .text {
|
||||||
|
width: 100% !important;
|
||||||
|
display: inline-block;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.log-item > div.method {
|
||||||
|
padding: 7px 5px;
|
||||||
|
line-height: 30px;
|
||||||
|
}
|
||||||
|
</style>
|
115
src/views/components/LogTable/LogService.vue
Normal file
115
src/views/components/LogTable/LogService.vue
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
<!-- Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
|
this work for additional information regarding copyright ownership.
|
||||||
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
(the "License"); you may not use this file except in compliance with
|
||||||
|
the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License. -->
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div @click="showSelectSpan" class="log-item">
|
||||||
|
<div v-for="(item, index) in columns" :key="index" :class="item.label">
|
||||||
|
<span v-if="item.label === 'timestamp'">
|
||||||
|
{{ dateFormat(data.timestamp) }}
|
||||||
|
</span>
|
||||||
|
<span v-else-if="item.label === 'tags'">
|
||||||
|
{{ tags }}
|
||||||
|
</span>
|
||||||
|
<router-link
|
||||||
|
v-else-if="item.label === 'traceId' && !noLink"
|
||||||
|
:to="{ name: 'trace', query: { traceid: data[item.label] } }"
|
||||||
|
>
|
||||||
|
<span>{{ data[item.label] }}</span>
|
||||||
|
</router-link>
|
||||||
|
<span v-else>{{ data[item.label] }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { computed } from "vue";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
import { ServiceLogConstants } from "./data";
|
||||||
|
/*global defineProps, defineEmits */
|
||||||
|
const props = defineProps({
|
||||||
|
data: { type: Array as any, default: () => [] },
|
||||||
|
noLink: { type: Boolean, default: true },
|
||||||
|
});
|
||||||
|
const emit = defineEmits(["select"]);
|
||||||
|
const columns = ServiceLogConstants;
|
||||||
|
const tags = computed(() => {
|
||||||
|
if (!props.data.tags) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return String(props.data.tags.map((d: any) => `${d.key}=${d.value}`));
|
||||||
|
});
|
||||||
|
const dateFormat = (date: number, pattern = "YYYY-MM-DD HH:mm:ss") =>
|
||||||
|
dayjs(date).format(pattern);
|
||||||
|
function showSelectSpan() {
|
||||||
|
emit("select", props.data);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.log-item {
|
||||||
|
white-space: nowrap;
|
||||||
|
position: relative;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
.traceId {
|
||||||
|
width: 390px;
|
||||||
|
color: #448dfe;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
span {
|
||||||
|
display: inline-block;
|
||||||
|
width: 100%;
|
||||||
|
line-height: 30px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.content,
|
||||||
|
.tags {
|
||||||
|
width: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.serviceInstanceName,
|
||||||
|
.serviceName {
|
||||||
|
width: 200px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.log-item:hover {
|
||||||
|
background: rgba(0, 0, 0, 0.04);
|
||||||
|
}
|
||||||
|
|
||||||
|
.log-item > div {
|
||||||
|
width: 140px;
|
||||||
|
padding: 0 5px;
|
||||||
|
display: inline-block;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-right: 1px dotted silver;
|
||||||
|
overflow: hidden;
|
||||||
|
line-height: 30px;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.log-item .text {
|
||||||
|
width: 100%;
|
||||||
|
display: inline-block;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.log-item > div.method {
|
||||||
|
height: 100%;
|
||||||
|
padding: 3px 8px;
|
||||||
|
}
|
||||||
|
</style>
|
120
src/views/components/LogTable/data.ts
Normal file
120
src/views/components/LogTable/data.ts
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
/**
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
* (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const ServiceLogConstants = [
|
||||||
|
{
|
||||||
|
label: "serviceName",
|
||||||
|
value: "service",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "serviceInstanceName",
|
||||||
|
value: "instance",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "timestamp",
|
||||||
|
value: "time",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "contentType",
|
||||||
|
value: "contentType",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "tags",
|
||||||
|
value: "tags",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "content",
|
||||||
|
value: "content",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "traceId",
|
||||||
|
value: "traceID",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
export const ServiceLogDetail = [
|
||||||
|
{
|
||||||
|
label: "serviceName",
|
||||||
|
value: "currentService",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "serviceInstanceName",
|
||||||
|
value: "currentInstance",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "timestamp",
|
||||||
|
value: "time",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "contentType",
|
||||||
|
value: "contentType",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "traceId",
|
||||||
|
value: "traceID",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "tags",
|
||||||
|
value: "tags",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "content",
|
||||||
|
value: "content",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
// The order of columns should be time, service, error, stack, version, url, catalog, and grade.
|
||||||
|
export const BrowserLogConstants = [
|
||||||
|
{
|
||||||
|
label: "service",
|
||||||
|
value: "service",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "serviceVersion",
|
||||||
|
value: "serviceVersion",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "errorUrl",
|
||||||
|
value: "errorPage",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "time",
|
||||||
|
value: "time",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "message",
|
||||||
|
value: "message",
|
||||||
|
drag: true,
|
||||||
|
method: 350,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "stack",
|
||||||
|
value: "stack",
|
||||||
|
drag: true,
|
||||||
|
method: 350,
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// label: 'pagePath',
|
||||||
|
// value: 'Page Path',
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
label: "category",
|
||||||
|
value: "category",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "grade",
|
||||||
|
value: "grade",
|
||||||
|
},
|
||||||
|
];
|
@ -23,9 +23,36 @@ limitations under the License. -->
|
|||||||
class="red mr-5 sm"
|
class="red mr-5 sm"
|
||||||
/>
|
/>
|
||||||
<span class="vm">{{ traceStore.currentTrace.endpointNames[0] }}</span>
|
<span class="vm">{{ traceStore.currentTrace.endpointNames[0] }}</span>
|
||||||
<!-- <div class="trace-log-btn bg-blue r mr-10" @click="searchTraceLogs">
|
<div class="trace-log-btn">
|
||||||
{{ t("viewLogs") }}
|
<el-button class="mr-10" type="primary" @click="searchTraceLogs">
|
||||||
</div> -->
|
{{ t("viewLogs") }}
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
<el-dialog
|
||||||
|
v-model="showTraceLogs"
|
||||||
|
:destroy-on-close="true"
|
||||||
|
fullscreen
|
||||||
|
@closed="showTraceLogs = false"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<el-pagination
|
||||||
|
v-model:currentPage="traceStore.conditions.paging.pageNum"
|
||||||
|
v-model:page-size="pageSize"
|
||||||
|
:small="true"
|
||||||
|
:total="traceStore.traceSpanLogsTotal"
|
||||||
|
@current-change="turnLogsPage"
|
||||||
|
/>
|
||||||
|
<LogTable
|
||||||
|
:tableData="traceStore.traceSpanLogs || []"
|
||||||
|
:type="`service`"
|
||||||
|
:noLink="true"
|
||||||
|
>
|
||||||
|
<div class="log-tips" v-if="!traceStore.traceSpanLogs.length">
|
||||||
|
{{ t("noData") }}
|
||||||
|
</div>
|
||||||
|
</LogTable>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
</h5>
|
</h5>
|
||||||
<div class="mb-5 blue sm">
|
<div class="mb-5 blue sm">
|
||||||
<Selector
|
<Selector
|
||||||
@ -114,20 +141,27 @@ import { Option } from "@/types/app";
|
|||||||
import copy from "@/utils/copy";
|
import copy from "@/utils/copy";
|
||||||
import List from "./components/List.vue";
|
import List from "./components/List.vue";
|
||||||
import graphs from "./components/index";
|
import graphs from "./components/index";
|
||||||
|
import LogTable from "@/views/components/LogTable/Index.vue";
|
||||||
|
import { ElMessage } from "element-plus";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "TraceDetail",
|
name: "TraceDetail",
|
||||||
components: {
|
components: {
|
||||||
...graphs,
|
...graphs,
|
||||||
List,
|
List,
|
||||||
|
LogTable,
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const traceStore = useTraceStore();
|
const traceStore = useTraceStore();
|
||||||
const traceId = ref<string>("");
|
const traceId = ref<string>("");
|
||||||
const displayMode = ref<string>("List");
|
const displayMode = ref<string>("List");
|
||||||
|
const pageNum = ref<number>(1);
|
||||||
|
const pageSize = 10;
|
||||||
const dateFormat = (date: number, pattern = "YYYY-MM-DD HH:mm:ss") =>
|
const dateFormat = (date: number, pattern = "YYYY-MM-DD HH:mm:ss") =>
|
||||||
dayjs(date).format(pattern);
|
dayjs(date).format(pattern);
|
||||||
|
const showTraceLogs = ref<boolean>(false);
|
||||||
|
|
||||||
function handleClick(ids: string[]) {
|
function handleClick(ids: string[]) {
|
||||||
let copyValue = null;
|
let copyValue = null;
|
||||||
if (ids.length === 1) {
|
if (ids.length === 1) {
|
||||||
@ -138,22 +172,33 @@ export default defineComponent({
|
|||||||
copy(copyValue);
|
copy(copyValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeTraceId(opt: Option[]) {
|
async function changeTraceId(opt: Option[]) {
|
||||||
traceId.value = opt[0].value;
|
traceId.value = opt[0].value;
|
||||||
traceStore.getTraceSpans({ traceId: opt[0].value });
|
const res = await traceStore.getTraceSpans({ traceId: opt[0].value });
|
||||||
|
if (res.errors) {
|
||||||
|
ElMessage.error(res.errors);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// function searchTraceLogs() {
|
async function searchTraceLogs() {
|
||||||
// this.showTraceLogs = true;
|
showTraceLogs.value = true;
|
||||||
// this.GET_TRACE_SPAN_LOGS({
|
const res = await traceStore.getSpanLogs({
|
||||||
// condition: {
|
condition: {
|
||||||
// relatedTrace: {
|
relatedTrace: {
|
||||||
// traceId: this.traceId || traceStore.current.traceIds[0],
|
traceId: traceId.value || traceStore.currentTrace.traceIds[0],
|
||||||
// },
|
},
|
||||||
// paging: { pageNum: this.pageNum, pageSize: this.pageSize, needTotal: true },
|
paging: { pageNum: pageNum.value, pageSize, needTotal: true },
|
||||||
// },
|
},
|
||||||
// });
|
});
|
||||||
// }
|
if (res.errors) {
|
||||||
|
ElMessage.error(res.errors);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function turnLogsPage(page: number) {
|
||||||
|
pageNum.value = page;
|
||||||
|
searchTraceLogs();
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
traceStore,
|
traceStore,
|
||||||
displayMode,
|
displayMode,
|
||||||
@ -161,6 +206,10 @@ export default defineComponent({
|
|||||||
changeTraceId,
|
changeTraceId,
|
||||||
handleClick,
|
handleClick,
|
||||||
t,
|
t,
|
||||||
|
searchTraceLogs,
|
||||||
|
showTraceLogs,
|
||||||
|
turnLogsPage,
|
||||||
|
pageSize,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -205,16 +254,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
.trace-log-btn {
|
.trace-log-btn {
|
||||||
padding: 3px 9px;
|
float: right;
|
||||||
background-color: #484b55;
|
|
||||||
border-radius: 4px;
|
|
||||||
color: #eee;
|
|
||||||
font-weight: normal;
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
&.bg-blue {
|
|
||||||
background-color: #448dfe;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag {
|
.tag {
|
||||||
|
@ -96,7 +96,7 @@ function searchTrace() {
|
|||||||
|
|
||||||
function updatePage(p: number) {
|
function updatePage(p: number) {
|
||||||
traceStore.setCondition({
|
traceStore.setCondition({
|
||||||
paging: { pageNum: p, pageSize: 15, needTotal: true },
|
paging: { pageNum: p, pageSize: pageSize.value, needTotal: true },
|
||||||
});
|
});
|
||||||
searchTrace();
|
searchTrace();
|
||||||
}
|
}
|
||||||
@ -104,7 +104,7 @@ function updatePage(p: number) {
|
|||||||
function changeSort(opt: Option[]) {
|
function changeSort(opt: Option[]) {
|
||||||
traceStore.setCondition({
|
traceStore.setCondition({
|
||||||
queryOrder: opt[0].value,
|
queryOrder: opt[0].value,
|
||||||
paging: { pageNum: 1, pageSize: 15, needTotal: true },
|
paging: { pageNum: 1, pageSize: pageSize.value, needTotal: true },
|
||||||
});
|
});
|
||||||
searchTrace();
|
searchTrace();
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License. -->
|
limitations under the License. -->
|
||||||
<template>
|
<template>
|
||||||
<div class="trace-table">
|
<div class="trace-table">
|
||||||
<div class="rk-trace-t-loading" v-show="loading">
|
<div class="trace-t-loading" v-show="loading">
|
||||||
<Icon iconName="spinner" size="sm" />
|
<Icon iconName="spinner" size="sm" />
|
||||||
</div>
|
</div>
|
||||||
<TableContainer
|
<TableContainer
|
||||||
@ -29,7 +29,6 @@ limitations under the License. -->
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, watch, onMounted } from "vue";
|
import { ref, watch, onMounted } from "vue";
|
||||||
import type { PropType } from "vue";
|
import type { PropType } from "vue";
|
||||||
import copy from "@/utils/copy";
|
|
||||||
import TableContainer from "./TableContainer.vue";
|
import TableContainer from "./TableContainer.vue";
|
||||||
import traceTable from "../../utils/trace-table";
|
import traceTable from "../../utils/trace-table";
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ export default class TraceUtil {
|
|||||||
|
|
||||||
public static changeTree(data: Span[], cureentTraceId: string) {
|
public static changeTree(data: Span[], cureentTraceId: string) {
|
||||||
const segmentIdList: Span[] = [];
|
const segmentIdList: Span[] = [];
|
||||||
const traceTreeRef: any = this.changeTreeCore(data, cureentTraceId);
|
const traceTreeRef: any = this.changeTreeCore(data);
|
||||||
traceTreeRef.segmentIdGroup.forEach((segmentId: string) => {
|
traceTreeRef.segmentIdGroup.forEach((segmentId: string) => {
|
||||||
if (traceTreeRef.segmentMap.get(segmentId).refs) {
|
if (traceTreeRef.segmentMap.get(segmentId).refs) {
|
||||||
traceTreeRef.segmentMap.get(segmentId).refs.forEach((ref: Ref) => {
|
traceTreeRef.segmentMap.get(segmentId).refs.forEach((ref: Ref) => {
|
||||||
@ -58,13 +58,10 @@ export default class TraceUtil {
|
|||||||
return segmentIdList;
|
return segmentIdList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static changeStatisticsTree(
|
public static changeStatisticsTree(data: Span[]): Map<string, Span[]> {
|
||||||
data: Span[],
|
|
||||||
cureentTraceId: string
|
|
||||||
): Map<string, Span[]> {
|
|
||||||
const result = new Map<string, Span[]>();
|
const result = new Map<string, Span[]>();
|
||||||
const traceTreeRef = this.changeTreeCore(data, cureentTraceId);
|
const traceTreeRef = this.changeTreeCore(data);
|
||||||
traceTreeRef.segmentMap.forEach((span, segmentId) => {
|
traceTreeRef.segmentMap.forEach((span) => {
|
||||||
const groupRef = span.endpointName + ":" + span.type;
|
const groupRef = span.endpointName + ":" + span.type;
|
||||||
if (span.children && span.children.length > 0) {
|
if (span.children && span.children.length > 0) {
|
||||||
this.calculationChildren(span.children, result);
|
this.calculationChildren(span.children, result);
|
||||||
@ -80,10 +77,7 @@ export default class TraceUtil {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static changeTreeCore(
|
private static changeTreeCore(data: Span[]): TraceTreeRef {
|
||||||
data: Span[],
|
|
||||||
cureentTraceId: string
|
|
||||||
): TraceTreeRef {
|
|
||||||
// set a breakpoint at this line
|
// set a breakpoint at this line
|
||||||
if (data.length === 0) {
|
if (data.length === 0) {
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user