mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-02 14:34:46 +00:00
process spans
This commit is contained in:
parent
0d2bedf529
commit
aca68e1a4e
@ -77,11 +77,18 @@ limitations under the License. -->
|
|||||||
d3.selectAll(".d3-tip").remove();
|
d3.selectAll(".d3-tip").remove();
|
||||||
if (props.type === "List") {
|
if (props.type === "List") {
|
||||||
tree.value = new ListGraph(traceGraph.value, handleSelectSpan);
|
tree.value = new ListGraph(traceGraph.value, handleSelectSpan);
|
||||||
tree.value.init({ label: "TRACE_ROOT", children: segmentId.value }, props.data, fixSpansSize.value);
|
tree.value.init(
|
||||||
|
{ label: "TRACE_ROOT", children: segmentId.value },
|
||||||
|
getRefsAllNodes({ label: "TRACE_ROOT", children: segmentId.value }),
|
||||||
|
fixSpansSize.value,
|
||||||
|
);
|
||||||
tree.value.draw();
|
tree.value.draw();
|
||||||
} else {
|
} else {
|
||||||
tree.value = new TreeGraph(traceGraph.value, handleSelectSpan);
|
tree.value = new TreeGraph(traceGraph.value, handleSelectSpan);
|
||||||
tree.value.init({ label: `${props.traceId}`, children: segmentId.value }, props.data);
|
tree.value.init(
|
||||||
|
{ label: `${props.traceId}`, children: segmentId.value },
|
||||||
|
getRefsAllNodes({ label: "TRACE_ROOT", children: segmentId.value }),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function handleSelectSpan(i: Recordable) {
|
function handleSelectSpan(i: Recordable) {
|
||||||
@ -272,24 +279,23 @@ limitations under the License. -->
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const i in segmentGroup) {
|
for (const i in segmentGroup) {
|
||||||
if (segmentGroup[i].refs.length) {
|
for (const ref of segmentGroup[i].refs) {
|
||||||
let exit = null;
|
if (segmentGroup[ref.parentSegmentId]) {
|
||||||
for (const ref of segmentGroup[i].refs) {
|
segmentGroup[ref.parentSegmentId].children.push(segmentGroup[i]);
|
||||||
const e = props.data.find(
|
|
||||||
(i: Recordable) =>
|
|
||||||
ref.traceId === i.traceId && ref.parentSegmentId === i.segmentId && ref.parentSpanId === i.spanId,
|
|
||||||
);
|
|
||||||
if (e) {
|
|
||||||
exit = e;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (exit) {
|
}
|
||||||
|
}
|
||||||
|
for (const i in segmentGroup) {
|
||||||
|
for (const ref of segmentGroup[i].refs) {
|
||||||
|
if (!segmentGroup[ref.parentSegmentId]) {
|
||||||
segmentId.value.push(segmentGroup[i]);
|
segmentId.value.push(segmentGroup[i]);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
if (!segmentGroup[i].refs.length && segmentGroup[i].parentSpanId === -1) {
|
||||||
segmentId.value.push(segmentGroup[i]);
|
segmentId.value.push(segmentGroup[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log(segmentId.value);
|
||||||
for (const i of segmentId.value) {
|
for (const i of segmentId.value) {
|
||||||
collapse(i);
|
collapse(i);
|
||||||
}
|
}
|
||||||
@ -310,6 +316,23 @@ limitations under the License. -->
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function getRefsAllNodes(tree: Recordable) {
|
||||||
|
let nodes = [];
|
||||||
|
let stack = [tree];
|
||||||
|
|
||||||
|
while (stack.length > 0) {
|
||||||
|
const node = stack.pop();
|
||||||
|
nodes.push(node);
|
||||||
|
|
||||||
|
if (node?.children && node.children.length > 0) {
|
||||||
|
for (let i = node.children.length - 1; i >= 0; i--) {
|
||||||
|
stack.push(node.children[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nodes;
|
||||||
|
}
|
||||||
function compare(p: string) {
|
function compare(p: string) {
|
||||||
return (m: Recordable, n: Recordable) => {
|
return (m: Recordable, n: Recordable) => {
|
||||||
const a = m[p];
|
const a = m[p];
|
||||||
|
@ -47,7 +47,7 @@ export default class ListGraph {
|
|||||||
this.el = el;
|
this.el = el;
|
||||||
this.width = el.getBoundingClientRect().width - 10;
|
this.width = el.getBoundingClientRect().width - 10;
|
||||||
this.height = el.getBoundingClientRect().height - 10;
|
this.height = el.getBoundingClientRect().height - 10;
|
||||||
d3.select(".trace-list-dowanload").remove();
|
d3.select(`.${this.el?.className} .trace-list-dowanload`).remove();
|
||||||
this.svg = d3
|
this.svg = d3
|
||||||
.select(this.el)
|
.select(this.el)
|
||||||
.append("svg")
|
.append("svg")
|
||||||
@ -85,7 +85,7 @@ export default class ListGraph {
|
|||||||
L${d.target.y} ${d.target.x - 5}`;
|
L${d.target.y} ${d.target.x - 5}`;
|
||||||
}
|
}
|
||||||
init(data: Recordable, row: Recordable[], fixSpansSize: number) {
|
init(data: Recordable, row: Recordable[], fixSpansSize: number) {
|
||||||
d3.select(".trace-xaxis").remove();
|
d3.select(`.${this.el?.className} .trace-xaxis`).remove();
|
||||||
this.row = row;
|
this.row = row;
|
||||||
this.data = data;
|
this.data = data;
|
||||||
this.min = d3.min(this.row.map((i) => i.startTime));
|
this.min = d3.min(this.row.map((i) => i.startTime));
|
||||||
|
@ -55,7 +55,7 @@ export default class TraceMap {
|
|||||||
this.topChild = [];
|
this.topChild = [];
|
||||||
this.width = el.clientWidth - 20;
|
this.width = el.clientWidth - 20;
|
||||||
this.height = el.clientHeight - 30;
|
this.height = el.clientHeight - 30;
|
||||||
d3.select(".d3-trace-tree").remove();
|
d3.select(`.${this.el?.className} .d3-trace-tree`).remove();
|
||||||
this.body = d3
|
this.body = d3
|
||||||
.select(this.el)
|
.select(this.el)
|
||||||
.append("svg")
|
.append("svg")
|
||||||
|
Loading…
Reference in New Issue
Block a user