mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-01 07:42:52 +00:00
build: remove lodash
library (#454)
This commit is contained in:
parent
012ae1db6c
commit
1fe58f5f6c
6
package-lock.json
generated
6
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "skywalking-booster-ui",
|
"name": "skywalking-booster-ui",
|
||||||
"version": "9.4.0",
|
"version": "10.2.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "skywalking-booster-ui",
|
"name": "skywalking-booster-ui",
|
||||||
"version": "9.4.0",
|
"version": "10.2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.7.5",
|
"axios": "^1.7.5",
|
||||||
"d3": "^7.3.0",
|
"d3": "^7.3.0",
|
||||||
@ -14,7 +14,6 @@
|
|||||||
"d3-tip": "^0.9.1",
|
"d3-tip": "^0.9.1",
|
||||||
"echarts": "^5.2.2",
|
"echarts": "^5.2.2",
|
||||||
"element-plus": "^2.9.4",
|
"element-plus": "^2.9.4",
|
||||||
"lodash": "^4.17.21",
|
|
||||||
"monaco-editor": "^0.34.1",
|
"monaco-editor": "^0.34.1",
|
||||||
"pinia": "^2.0.28",
|
"pinia": "^2.0.28",
|
||||||
"vis-timeline": "^7.5.1",
|
"vis-timeline": "^7.5.1",
|
||||||
@ -32,7 +31,6 @@
|
|||||||
"@types/d3-tip": "^3.5.5",
|
"@types/d3-tip": "^3.5.5",
|
||||||
"@types/echarts": "^4.9.12",
|
"@types/echarts": "^4.9.12",
|
||||||
"@types/jsdom": "^20.0.1",
|
"@types/jsdom": "^20.0.1",
|
||||||
"@types/lodash": "^4.14.179",
|
|
||||||
"@types/node": "^18.11.12",
|
"@types/node": "^18.11.12",
|
||||||
"@types/three": "^0.131.0",
|
"@types/three": "^0.131.0",
|
||||||
"@vitejs/plugin-vue": "^5.2.1",
|
"@vitejs/plugin-vue": "^5.2.1",
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
"d3-tip": "^0.9.1",
|
"d3-tip": "^0.9.1",
|
||||||
"echarts": "^5.2.2",
|
"echarts": "^5.2.2",
|
||||||
"element-plus": "^2.9.4",
|
"element-plus": "^2.9.4",
|
||||||
"lodash": "^4.17.21",
|
|
||||||
"monaco-editor": "^0.34.1",
|
"monaco-editor": "^0.34.1",
|
||||||
"pinia": "^2.0.28",
|
"pinia": "^2.0.28",
|
||||||
"vis-timeline": "^7.5.1",
|
"vis-timeline": "^7.5.1",
|
||||||
@ -42,7 +41,6 @@
|
|||||||
"@types/d3-tip": "^3.5.5",
|
"@types/d3-tip": "^3.5.5",
|
||||||
"@types/echarts": "^4.9.12",
|
"@types/echarts": "^4.9.12",
|
||||||
"@types/jsdom": "^20.0.1",
|
"@types/jsdom": "^20.0.1",
|
||||||
"@types/lodash": "^4.14.179",
|
|
||||||
"@types/node": "^18.11.12",
|
"@types/node": "^18.11.12",
|
||||||
"@types/three": "^0.131.0",
|
"@types/three": "^0.131.0",
|
||||||
"@vitejs/plugin-vue": "^5.2.1",
|
"@vitejs/plugin-vue": "^5.2.1",
|
||||||
|
@ -22,7 +22,6 @@ limitations under the License. -->
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, watch, onBeforeUnmount, onMounted } from "vue";
|
import { ref, watch, onBeforeUnmount, onMounted } from "vue";
|
||||||
import type { PropType } from "vue";
|
import type { PropType } from "vue";
|
||||||
import _ from "lodash";
|
|
||||||
import * as d3 from "d3";
|
import * as d3 from "d3";
|
||||||
import ListGraph from "../../utils/d3-trace-list";
|
import ListGraph from "../../utils/d3-trace-list";
|
||||||
import TreeGraph from "../../utils/d3-trace-tree";
|
import TreeGraph from "../../utils/d3-trace-tree";
|
||||||
@ -120,15 +119,19 @@ limitations under the License. -->
|
|||||||
const item = props.data.find(
|
const item = props.data.find(
|
||||||
(i: Span) => i.traceId === span.traceId && i.segmentId === span.segmentId && i.spanId === span.spanId - 1,
|
(i: Span) => i.traceId === span.traceId && i.segmentId === span.segmentId && i.spanId === span.spanId - 1,
|
||||||
);
|
);
|
||||||
const fixSpanKeyContent = {
|
const content = fixSpans.find(
|
||||||
traceId: span.traceId,
|
(i: Span) =>
|
||||||
segmentId: span.segmentId,
|
i.traceId === span.traceId &&
|
||||||
spanId: span.spanId - 1,
|
i.segmentId === span.segmentId &&
|
||||||
parentSpanId: span.spanId - 2,
|
i.spanId === span.spanId - 1 &&
|
||||||
};
|
i.parentSpanId === span.spanId - 2,
|
||||||
if (!item && !_.find(fixSpans, fixSpanKeyContent)) {
|
);
|
||||||
|
if (!item && !content) {
|
||||||
fixSpans.push({
|
fixSpans.push({
|
||||||
...fixSpanKeyContent,
|
traceId: span.traceId,
|
||||||
|
segmentId: span.segmentId,
|
||||||
|
spanId: span.spanId - 1,
|
||||||
|
parentSpanId: span.spanId - 2,
|
||||||
refs: [],
|
refs: [],
|
||||||
endpointName: `VNode: ${span.segmentId}`,
|
endpointName: `VNode: ${span.segmentId}`,
|
||||||
serviceCode: "VirtualNode",
|
serviceCode: "VirtualNode",
|
||||||
@ -161,22 +164,26 @@ limitations under the License. -->
|
|||||||
if (!exit) {
|
if (!exit) {
|
||||||
const ref = span.refs[0];
|
const ref = span.refs[0];
|
||||||
// create a known broken node.
|
// create a known broken node.
|
||||||
const i = ref.parentSpanId;
|
const parentSpanId = ref.parentSpanId > -1 ? 0 : -1;
|
||||||
const fixSpanKeyContent = {
|
const content = fixSpans.find(
|
||||||
traceId: ref.traceId,
|
(i: Span) =>
|
||||||
segmentId: ref.parentSegmentId,
|
i.traceId === ref.traceId &&
|
||||||
spanId: i,
|
i.segmentId === ref.parentSegmentId &&
|
||||||
parentSpanId: i > -1 ? 0 : -1,
|
i.spanId === ref.parentSpanId &&
|
||||||
};
|
i.parentSpanId === parentSpanId,
|
||||||
if (!_.find(fixSpans, fixSpanKeyContent)) {
|
);
|
||||||
|
if (!content) {
|
||||||
fixSpans.push({
|
fixSpans.push({
|
||||||
...fixSpanKeyContent,
|
traceId: ref.traceId,
|
||||||
|
segmentId: ref.parentSegmentId,
|
||||||
|
spanId: ref.parentSpanId,
|
||||||
|
parentSpanId,
|
||||||
refs: [],
|
refs: [],
|
||||||
endpointName: `VNode: ${ref.parentSegmentId}`,
|
endpointName: `VNode: ${ref.parentSegmentId}`,
|
||||||
serviceCode: "VirtualNode",
|
serviceCode: "VirtualNode",
|
||||||
type: `[Broken] ${ref.type}`,
|
type: `[Broken] ${ref.type}`,
|
||||||
peer: "",
|
peer: "",
|
||||||
component: `VirtualNode: #${i}`,
|
component: `VirtualNode: #${ref.parentSpanId}`,
|
||||||
isError: true,
|
isError: true,
|
||||||
isBroken: true,
|
isBroken: true,
|
||||||
layer: "Broken",
|
layer: "Broken",
|
||||||
@ -187,16 +194,20 @@ limitations under the License. -->
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
// if root broken node is not exist, create a root broken node.
|
// if root broken node is not exist, create a root broken node.
|
||||||
if (fixSpanKeyContent.parentSpanId > -1) {
|
if (parentSpanId > -1) {
|
||||||
const fixRootSpanKeyContent = {
|
const content = fixSpans.find(
|
||||||
traceId: ref.traceId,
|
(i: Span) =>
|
||||||
segmentId: ref.parentSegmentId,
|
i.traceId === ref.traceId &&
|
||||||
spanId: 0,
|
i.segmentId === ref.parentSegmentId &&
|
||||||
parentSpanId: -1,
|
i.spanId === 0 &&
|
||||||
};
|
i.parentSpanId === -1,
|
||||||
if (!_.find(fixSpans, fixRootSpanKeyContent)) {
|
);
|
||||||
|
if (!content) {
|
||||||
fixSpans.push({
|
fixSpans.push({
|
||||||
...fixRootSpanKeyContent,
|
traceId: ref.traceId,
|
||||||
|
segmentId: ref.parentSegmentId,
|
||||||
|
spanId: 0,
|
||||||
|
parentSpanId: -1,
|
||||||
refs: [],
|
refs: [],
|
||||||
endpointName: `VNode: ${ref.parentSegmentId}`,
|
endpointName: `VNode: ${ref.parentSegmentId}`,
|
||||||
serviceCode: "VirtualNode",
|
serviceCode: "VirtualNode",
|
||||||
@ -241,14 +252,12 @@ limitations under the License. -->
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (s.isBroken) {
|
if (s.isBroken) {
|
||||||
const children = _.filter(props.data, (span: Span) => {
|
const children = props.data.filter((span: Span) =>
|
||||||
return _.find(span.refs, {
|
span.refs.find(
|
||||||
traceId: s.traceId,
|
(d) => d.traceId === s.traceId && d.parentSegmentId === s.segmentId && d.parentSpanId === s.spanId,
|
||||||
parentSegmentId: s.segmentId,
|
),
|
||||||
parentSpanId: s.spanId,
|
);
|
||||||
});
|
if (children.length) {
|
||||||
});
|
|
||||||
if (children.length > 0) {
|
|
||||||
s.children.push(...children);
|
s.children.push(...children);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import type { Ref, Span, StatisticsSpan, StatisticsGroupRef, TraceTreeRef } from "@/types/trace";
|
import type { Ref, Span, StatisticsSpan, StatisticsGroupRef, TraceTreeRef } from "@/types/trace";
|
||||||
import lodash from "lodash";
|
|
||||||
|
|
||||||
export default class TraceUtil {
|
export default class TraceUtil {
|
||||||
public static buildTraceDataList(data: Span[]): string[] {
|
public static buildTraceDataList(data: Span[]): string[] {
|
||||||
@ -91,15 +90,19 @@ export default class TraceUtil {
|
|||||||
const index = data.findIndex((patchSpan: Span) => {
|
const index = data.findIndex((patchSpan: Span) => {
|
||||||
return patchSpan.segmentId === span.segmentId && patchSpan.spanId === span.spanId - 1;
|
return patchSpan.segmentId === span.segmentId && patchSpan.spanId === span.spanId - 1;
|
||||||
});
|
});
|
||||||
const fixSpanKeyContent = {
|
const content = fixSpans.find(
|
||||||
traceId: span.traceId,
|
(i: Span) =>
|
||||||
segmentId: span.segmentId,
|
i.traceId === span.traceId &&
|
||||||
spanId: span.spanId - 1,
|
i.segmentId === span.segmentId &&
|
||||||
parentSpanId: span.spanId - 2,
|
i.spanId === span.spanId - 1 &&
|
||||||
};
|
i.parentSpanId === span.spanId - 2,
|
||||||
if (index === -1 && !lodash.find(fixSpans, fixSpanKeyContent)) {
|
);
|
||||||
|
if (index === -1 && !content) {
|
||||||
fixSpans.push({
|
fixSpans.push({
|
||||||
...fixSpanKeyContent,
|
traceId: span.traceId,
|
||||||
|
segmentId: span.segmentId,
|
||||||
|
spanId: span.spanId - 1,
|
||||||
|
parentSpanId: span.spanId - 2,
|
||||||
refs: [],
|
refs: [],
|
||||||
endpointName: `VNode: ${span.segmentId}`,
|
endpointName: `VNode: ${span.segmentId}`,
|
||||||
serviceCode: "VirtualNode",
|
serviceCode: "VirtualNode",
|
||||||
@ -125,16 +128,20 @@ export default class TraceUtil {
|
|||||||
});
|
});
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
// create a known broken node.
|
// create a known broken node.
|
||||||
const parentSpanId: number = ref.parentSpanId;
|
const parentSpanId = ref.parentSpanId > -1 ? 0 : -1;
|
||||||
const fixSpanKeyContent = {
|
const item = fixSpans.find(
|
||||||
traceId: ref.traceId,
|
(i: Span) =>
|
||||||
segmentId: ref.parentSegmentId,
|
i.traceId === ref.traceId &&
|
||||||
spanId: parentSpanId,
|
i.segmentId === ref.parentSegmentId &&
|
||||||
parentSpanId: parentSpanId > -1 ? 0 : -1,
|
i.spanId === ref.parentSpanId &&
|
||||||
};
|
i.parentSpanId === parentSpanId,
|
||||||
if (!lodash.find(fixSpans, fixSpanKeyContent)) {
|
);
|
||||||
|
if (!item) {
|
||||||
fixSpans.push({
|
fixSpans.push({
|
||||||
...fixSpanKeyContent,
|
traceId: ref.traceId,
|
||||||
|
segmentId: ref.parentSegmentId,
|
||||||
|
spanId: ref.parentSpanId,
|
||||||
|
parentSpanId: parentSpanId,
|
||||||
refs: [],
|
refs: [],
|
||||||
endpointName: `VNode: ${ref.parentSegmentId}`,
|
endpointName: `VNode: ${ref.parentSegmentId}`,
|
||||||
serviceCode: "VirtualNode",
|
serviceCode: "VirtualNode",
|
||||||
@ -151,16 +158,20 @@ export default class TraceUtil {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
// if root broken node is not exist, create a root broken node.
|
// if root broken node is not exist, create a root broken node.
|
||||||
if (fixSpanKeyContent.parentSpanId > -1) {
|
if (parentSpanId > -1) {
|
||||||
const fixRootSpanKeyContent = {
|
const item = fixSpans.find(
|
||||||
traceId: ref.traceId,
|
(i: Span) =>
|
||||||
segmentId: ref.parentSegmentId,
|
i.traceId === ref.traceId &&
|
||||||
spanId: 0,
|
i.segmentId === ref.parentSegmentId &&
|
||||||
parentSpanId: -1,
|
i.spanId === 0 &&
|
||||||
};
|
i.parentSpanId === -1,
|
||||||
if (!lodash.find(fixSpans, fixRootSpanKeyContent)) {
|
);
|
||||||
|
if (!item) {
|
||||||
fixSpans.push({
|
fixSpans.push({
|
||||||
...fixRootSpanKeyContent,
|
traceId: ref.traceId,
|
||||||
|
segmentId: ref.parentSegmentId,
|
||||||
|
spanId: 0,
|
||||||
|
parentSpanId: -1,
|
||||||
refs: [],
|
refs: [],
|
||||||
endpointName: `VNode: ${ref.parentSegmentId}`,
|
endpointName: `VNode: ${ref.parentSegmentId}`,
|
||||||
serviceCode: "VirtualNode",
|
serviceCode: "VirtualNode",
|
||||||
@ -210,13 +221,14 @@ export default class TraceUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (curSegment.isBroken) {
|
if (curSegment.isBroken) {
|
||||||
const children = lodash.filter(data, (span: Span) => {
|
const children = data.filter((span: Span) =>
|
||||||
return lodash.find(span.refs, {
|
span.refs.find(
|
||||||
traceId: curSegment.traceId,
|
(d) =>
|
||||||
parentSegmentId: curSegment.segmentId,
|
d.traceId === curSegment.traceId &&
|
||||||
parentSpanId: curSegment.spanId,
|
d.parentSegmentId === curSegment.segmentId &&
|
||||||
});
|
d.parentSpanId === curSegment.spanId,
|
||||||
}) as Span[];
|
),
|
||||||
|
);
|
||||||
if (children.length) {
|
if (children.length) {
|
||||||
curSegment.children = curSegment.children || [];
|
curSegment.children = curSegment.children || [];
|
||||||
curSegment.children.push(...children);
|
curSegment.children.push(...children);
|
||||||
|
@ -90,9 +90,6 @@ export default ({ mode }: ConfigEnv): UserConfig => {
|
|||||||
assetFileNames: "static/[ext]/[name]-[hash].[ext]",
|
assetFileNames: "static/[ext]/[name]-[hash].[ext]",
|
||||||
manualChunks(id) {
|
manualChunks(id) {
|
||||||
if (id.includes("node_modules")) {
|
if (id.includes("node_modules")) {
|
||||||
if (id.includes("lodash")) {
|
|
||||||
return "lodash";
|
|
||||||
}
|
|
||||||
if (id.includes("echarts")) {
|
if (id.includes("echarts")) {
|
||||||
return "echarts";
|
return "echarts";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user