diff --git a/src/components/DateCalendar.vue b/src/components/DateCalendar.vue index 7af98b76..1ef5cee0 100755 --- a/src/components/DateCalendar.vue +++ b/src/components/DateCalendar.vue @@ -632,11 +632,6 @@ onMounted(() => { right: 24px; } -.calendar-next-month-btn .middle, -.calendar-prev-month-btn .middle { - margin-top: 8px; -} - .calendar-body { position: relative; width: 196px; diff --git a/src/graphql/fragments/trace.ts b/src/graphql/fragments/trace.ts index e1e0af9b..d645042c 100644 --- a/src/graphql/fragments/trace.ts +++ b/src/graphql/fragments/trace.ts @@ -69,6 +69,25 @@ export const TraceSpans = { value } } + attachedEvents { + startTime { + seconds + nanos + } + event + endTime { + seconds + nanos + } + tags { + key + value + } + summary { + key + value + } + } } } `, diff --git a/src/layout/components/SideBar.vue b/src/layout/components/SideBar.vue index b9afcc48..403f56cb 100644 --- a/src/layout/components/SideBar.vue +++ b/src/layout/components/SideBar.vue @@ -107,7 +107,7 @@ if (/Android|webOS|iPhone|iPod|iPad|BlackBerry/i.test(navigator.userAgent)) { } else { appStore.setIsMobile(false); } -const isCollapse = ref(appStore.isMobile ? true : false); +const isCollapse = ref(true); const controlMenu = () => { isCollapse.value = !isCollapse.value; }; diff --git a/src/store/modules/trace.ts b/src/store/modules/trace.ts index e9654e83..640d10ad 100644 --- a/src/store/modules/trace.ts +++ b/src/store/modules/trace.ts @@ -175,7 +175,8 @@ export const traceStore = defineStore({ if (res.data.errors) { return res.data; } - this.setTraceSpans(res.data.data.trace.spans || []); + const data = res.data.data.trace.spans; + this.setTraceSpans(data || []); return res.data; }, async getSpanLogs(params: any) { diff --git a/src/styles/reset.scss b/src/styles/reset.scss index 41ef2836..b5de79f5 100644 --- a/src/styles/reset.scss +++ b/src/styles/reset.scss @@ -179,7 +179,7 @@ div.vis-tooltip { .vis-item { cursor: pointer; - height: 17px; + height: 20px; } .vis-item.Error { @@ -196,7 +196,7 @@ div.vis-tooltip { } .vis-item .vis-item-content { - padding: 0 5px !important; + padding: 0 3px !important; } .vis-item.vis-selected.Error, diff --git a/src/types/trace.d.ts b/src/types/trace.d.ts index 569e7173..9055e8a8 100644 --- a/src/types/trace.d.ts +++ b/src/types/trace.d.ts @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - export interface Trace { duration: number; isError: boolean; @@ -85,3 +84,19 @@ export class TraceTreeRef { segmentMap: Map; segmentIdGroup: string[]; } + +type Instant = { + seconds: number; + nanos: number; +}; +type KeyValue = { + key: string; + value: string | number; +}; +export interface SpanAttachedEvent { + startTime: Instant; + endTime: Instant; + event: string; + tags: KeyValue[]; + summary: KeyValue[]; +} diff --git a/src/views/dashboard/related/trace/components/D3Graph/SpanDetail.vue b/src/views/dashboard/related/trace/components/D3Graph/SpanDetail.vue index 061325f8..083fc39d 100644 --- a/src/views/dashboard/related/trace/components/D3Graph/SpanDetail.vue +++ b/src/views/dashboard/related/trace/components/D3Graph/SpanDetail.vue @@ -14,7 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. --> diff --git a/src/views/dashboard/related/trace/components/Statistics.vue b/src/views/dashboard/related/trace/components/Statistics.vue index 05bd63b9..5618e571 100644 --- a/src/views/dashboard/related/trace/components/Statistics.vue +++ b/src/views/dashboard/related/trace/components/Statistics.vue @@ -56,7 +56,7 @@ onMounted(() => { function calculationDataforStatistics(data: Span[]): StatisticsSpan[] { list.value = traceTable.buildTraceDataList(data); const result: StatisticsSpan[] = []; - const map = traceTable.changeStatisticsTree(data, props.traceId); + const map = traceTable.changeStatisticsTree(data); map.forEach((nodes, nodeKey) => { const nodeKeyData = nodeKey.split(":"); result.push( diff --git a/src/views/dashboard/related/trace/components/Table/TableItem.vue b/src/views/dashboard/related/trace/components/Table/TableItem.vue index a60598ee..38af3b43 100644 --- a/src/views/dashboard/related/trace/components/Table/TableItem.vue +++ b/src/views/dashboard/related/trace/components/Table/TableItem.vue @@ -112,6 +112,9 @@ limitations under the License. --> > {{ t("view") }} +
+ {{ data.attachedEvents && data.attachedEvents.length }} +
@import "./table.scss"; +.event-tag { + width: 12px; + height: 12px; + border-radius: 12px; + border: 1px solid #e66; + color: #e66; + display: inline-block; +} + .trace-item.level0 { color: #448dfe; diff --git a/src/views/dashboard/related/trace/components/Table/data.ts b/src/views/dashboard/related/trace/components/Table/data.ts index 6c7c0411..cc486536 100644 --- a/src/views/dashboard/related/trace/components/Table/data.ts +++ b/src/views/dashboard/related/trace/components/Table/data.ts @@ -79,6 +79,10 @@ export const TraceConstant = [ label: "application", value: "Service", }, + { + label: "application", + value: "Attached Events", + }, ]; export const StatisticsConstant = [ diff --git a/src/views/dashboard/related/trace/utils/d3-trace-list.ts b/src/views/dashboard/related/trace/utils/d3-trace-list.ts index 15190c7c..af301e71 100644 --- a/src/views/dashboard/related/trace/utils/d3-trace-list.ts +++ b/src/views/dashboard/related/trace/utils/d3-trace-list.ts @@ -175,13 +175,51 @@ export default class ListGraph { .attr("x", 35) .attr("y", -6) .attr("fill", "#333") - .text((d: any) => { + .html((d: any) => { if (d.data.label === "TRACE_ROOT") { return ""; } - return d.data.label.length > 40 - ? `${d.data.label.slice(0, 40)}...` - : `${d.data.label}`; + const label = + d.data.label.length > 30 + ? `${d.data.label.slice(0, 30)}...` + : `${d.data.label}`; + return label; + }); + nodeEnter + .append("circle") + .attr("r", 10) + .attr("cx", (d: any) => { + const events = d.data.attachedEvents; + if (events && events.length > 9) { + return 272; + } else { + return 270; + } + }) + .attr("cy", -5) + .attr("fill", "none") + .attr("stroke", "#e66") + .style("opacity", (d: any) => { + const events = d.data.attachedEvents; + if (events && events.length) { + return 0.5; + } else { + return 0; + } + }); + nodeEnter + .append("text") + .attr("x", 267) + .attr("y", -1) + .attr("fill", "#e66") + .style("font-size", "10px") + .text((d: any) => { + const events = d.data.attachedEvents; + if (events && events.length) { + return `${events.length}`; + } else { + return ""; + } }); nodeEnter .append("text") diff --git a/src/views/dashboard/related/trace/utils/d3-trace-tree.ts b/src/views/dashboard/related/trace/utils/d3-trace-tree.ts index fab33bf8..940665bc 100644 --- a/src/views/dashboard/related/trace/utils/d3-trace-tree.ts +++ b/src/views/dashboard/related/trace/utils/d3-trace-tree.ts @@ -188,7 +188,42 @@ export default class TraceMap { .on("click", function (event: any, d: any) { that.handleSelectSpan(d); }); - + nodeEnter + .append("circle") + .attr("r", 8) + .attr("cy", "-12") + .attr("cx", function (d: any) { + return d.children || d._children ? -15 : 110; + }) + .attr("fill", "none") + .attr("stroke", "#e66") + .style("opacity", (d: any) => { + const events = d.data.attachedEvents; + if (events && events.length) { + return 0.5; + } else { + return 0; + } + }); + nodeEnter + .append("text") + .attr("x", function (d: any) { + const events = d.data.attachedEvents || []; + let p = d.children || d._children ? -18 : 107; + p = events.length > 9 ? p - 2 : p; + return p; + }) + .attr("dy", "-0.8em") + .attr("fill", "#e66") + .style("font-size", "10px") + .text((d: any) => { + const events = d.data.attachedEvents; + if (events && events.length) { + return `${events.length}`; + } else { + return ""; + } + }); nodeEnter .append("circle") .attr("class", "node") @@ -208,14 +243,14 @@ export default class TraceMap { .attr("font-size", 11) .attr("dy", "-0.5em") .attr("x", function (d: any) { - return d.children || d._children ? -15 : 15; + return d.children || d._children ? -45 : 15; }) .attr("text-anchor", function (d: any) { return d.children || d._children ? "end" : "start"; }) .text((d: any) => d.data.label.length > 19 - ? (d.data.isError ? "◉ " : "") + d.data.label.slice(0, 19) + "..." + ? (d.data.isError ? "◉ " : "") + d.data.label.slice(0, 10) + "..." : (d.data.isError ? "◉ " : "") + d.data.label ) .style("fill", (d: any) => (!d.data.isError ? "#3d444f" : "#E54C17")); @@ -223,7 +258,7 @@ export default class TraceMap { .append("text") .attr("class", "node-text") .attr("x", function (d: any) { - return d.children || d._children ? -15 : 15; + return d.children || d._children ? -45 : 15; }) .attr("dy", "1em") .attr("fill", "#bbb")