adonisjs-server-stats 1.8.0 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/core/index.js +24 -22
  2. package/dist/core/log-utils.d.ts +14 -0
  3. package/dist/core/split-pane.d.ts +18 -0
  4. package/dist/core/trace-utils.d.ts +5 -0
  5. package/dist/core/types.d.ts +1 -1
  6. package/dist/react/{CacheSection-D5J5moz7.js → CacheSection-UCMptWyn.js} +1 -1
  7. package/dist/react/{CacheTab-F1MkWSZl.js → CacheTab-CA8LB1J5.js} +1 -1
  8. package/dist/react/{ConfigSection-DerLBu4o.js → ConfigSection-DfFd-WRq.js} +1 -1
  9. package/dist/react/{ConfigTab-Bsj7v9JW.js → ConfigTab-Bdg8YMer.js} +1 -1
  10. package/dist/react/{CustomPaneTab-gzdtDEvz.js → CustomPaneTab-Bxtv_8Rw.js} +1 -1
  11. package/dist/react/{EmailsSection-ndH3cvJk.js → EmailsSection-CM7stSyh.js} +1 -1
  12. package/dist/react/{EmailsTab-DVPHRx0L.js → EmailsTab-BDhEiomM.js} +1 -1
  13. package/dist/react/{EventsSection-ClIByDSk.js → EventsSection-ByQ-9blq.js} +1 -1
  14. package/dist/react/{EventsTab-CCzWEKrk.js → EventsTab-CMfY98Rl.js} +1 -1
  15. package/dist/react/{JobsSection-CVMyAs7O.js → JobsSection-DF3qEv9O.js} +1 -1
  16. package/dist/react/{JobsTab-CATUyb9V.js → JobsTab-BbrBWIOb.js} +1 -1
  17. package/dist/react/LogsSection-DcFTZY7b.js +227 -0
  18. package/dist/react/LogsTab-CicucmVk.js +103 -0
  19. package/dist/react/{OverviewSection-ae5AO2RG.js → OverviewSection-C4T1ur51.js} +1 -1
  20. package/dist/react/{QueriesSection-DFFr9Tbb.js → QueriesSection-PswteoF9.js} +1 -1
  21. package/dist/react/{QueriesTab-GrHRAREt.js → QueriesTab-osLUWd4L.js} +1 -1
  22. package/dist/react/RelatedLogs-DFDOyUMr.js +40 -0
  23. package/dist/react/RequestsSection-Nag30rEA.js +341 -0
  24. package/dist/react/{RoutesSection-F7nANhF0.js → RoutesSection-BUSkM6PY.js} +1 -1
  25. package/dist/react/{RoutesTab-rugjhCPH.js → RoutesTab-DgVzd2PZ.js} +1 -1
  26. package/dist/react/TimelineTab-Covg5weo.js +220 -0
  27. package/dist/react/{index-DDzo1bZk.js → index-Cflz9Ebj.js} +390 -395
  28. package/dist/react/index.js +1 -1
  29. package/dist/react/react/components/shared/JsonViewer.d.ts +2 -1
  30. package/dist/react/react/components/shared/RelatedLogs.d.ts +7 -0
  31. package/dist/react/style.css +1 -1
  32. package/dist/src/controller/debug_controller.js +1 -1
  33. package/dist/src/dashboard/dashboard_controller.js +13 -0
  34. package/dist/src/dashboard/dashboard_store.d.ts +1 -0
  35. package/dist/src/dashboard/dashboard_store.js +88 -41
  36. package/dist/src/dashboard/migrator.js +6 -0
  37. package/dist/src/data/data_access.d.ts +7 -0
  38. package/dist/src/data/data_access.js +32 -1
  39. package/dist/src/debug/trace_collector.d.ts +1 -1
  40. package/dist/src/debug/trace_collector.js +2 -1
  41. package/dist/src/debug/types.d.ts +4 -0
  42. package/dist/src/edge/client/dashboard.js +2 -2
  43. package/dist/src/edge/client/debug-panel-deferred.js +1 -1
  44. package/dist/src/edge/client-vue/dashboard.js +4 -4
  45. package/dist/src/edge/client-vue/debug-panel-deferred.js +3 -3
  46. package/dist/src/middleware/request_tracking_middleware.d.ts +1 -0
  47. package/dist/src/middleware/request_tracking_middleware.js +3 -1
  48. package/dist/src/provider/server_stats_provider.d.ts +3 -3
  49. package/dist/src/provider/server_stats_provider.js +29 -15
  50. package/dist/src/routes/register_routes.js +7 -2
  51. package/dist/src/styles/components.css +162 -0
  52. package/dist/src/styles/debug-panel.css +9 -0
  53. package/dist/src/types.d.ts +1 -1
  54. package/dist/vue/{CacheSection-DDvJ7bs2.js → CacheSection-oFAJL3mo.js} +2 -2
  55. package/dist/vue/{ConfigSection-GTCrvsPr.js → ConfigSection-BhfJ4KqL.js} +1 -1
  56. package/dist/vue/{EmailsSection-Ct5vsLCc.js → EmailsSection-BcNyhyHs.js} +1 -1
  57. package/dist/vue/{EventsSection-CRVhtagq.js → EventsSection-r60Q5Lmu.js} +2 -2
  58. package/dist/vue/{EventsTab-DQ4Nd6AK.js → EventsTab-BBM7olXF.js} +1 -1
  59. package/dist/vue/{JobsSection-B_wH2Co7.js → JobsSection-BHL-hkQw.js} +2 -2
  60. package/dist/vue/{JobsTab-BCvhOARO.js → JobsTab-WFnxPdN7.js} +1 -1
  61. package/dist/vue/{JsonViewer.vue_vue_type_script_setup_true_lang-Vsqar1zx.js → JsonViewer.vue_vue_type_script_setup_true_lang-Bid05zpm.js} +25 -23
  62. package/dist/vue/LogsSection-DRMGzJmg.js +252 -0
  63. package/dist/vue/LogsTab-Bg3o0Mm6.js +147 -0
  64. package/dist/vue/{OverviewSection-BqSwuMKH.js → OverviewSection-CXh6Ja1B.js} +1 -1
  65. package/dist/vue/{QueriesSection-D4Fs0YH6.js → QueriesSection-IodIsCJ-.js} +1 -1
  66. package/dist/vue/RelatedLogs.vue_vue_type_script_setup_true_lang-CB2_TzYW.js +84 -0
  67. package/dist/vue/RequestsSection-BPuMdmMc.js +401 -0
  68. package/dist/vue/{RoutesSection-Ys5dTzvF.js → RoutesSection-NKo3Rbq3.js} +1 -1
  69. package/dist/vue/TimelineTab-zj5Z5OdT.js +338 -0
  70. package/dist/vue/components/Dashboard/sections/RequestsSection.vue.d.ts +4 -0
  71. package/dist/vue/components/DebugPanel/tabs/TimelineTab.vue.d.ts +4 -0
  72. package/dist/vue/components/shared/JsonViewer.vue.d.ts +3 -0
  73. package/dist/vue/components/{Dashboard/sections/TimelineSection.vue.d.ts → shared/RelatedLogs.vue.d.ts} +5 -6
  74. package/dist/vue/index-Dtgysd26.js +1229 -0
  75. package/dist/vue/index.js +1 -1
  76. package/dist/vue/style.css +1 -1
  77. package/package.json +1 -1
  78. package/dist/react/LogsSection-hAsLaKOC.js +0 -212
  79. package/dist/react/LogsTab-QouH4NPQ.js +0 -88
  80. package/dist/react/RequestsSection-DtwnJOnM.js +0 -209
  81. package/dist/react/TimelineSection-F5ThmTdy.js +0 -158
  82. package/dist/react/TimelineTab-Dvpf-I5C.js +0 -193
  83. package/dist/react/WaterfallChart-Cj73WdfM.js +0 -100
  84. package/dist/react/react/components/Dashboard/sections/TimelineSection.d.ts +0 -8
  85. package/dist/vue/LogsSection-C4NRFOpA.js +0 -227
  86. package/dist/vue/LogsTab-DpEQ7euu.js +0 -122
  87. package/dist/vue/RequestsSection-B0A5SKcM.js +0 -243
  88. package/dist/vue/TimelineSection-D38iHB08.js +0 -186
  89. package/dist/vue/TimelineTab-Db6lKKsD.js +0 -250
  90. package/dist/vue/WaterfallChart.vue_vue_type_script_setup_true_lang-tZ13cNj1.js +0 -118
  91. package/dist/vue/index-Bj6pm5g3.js +0 -1235
@@ -1,186 +0,0 @@
1
- import { defineComponent as M, inject as v, ref as i, computed as U, openBlock as l, createElementBlock as o, Fragment as c, createElementVNode as s, normalizeClass as h, toDisplayString as n, unref as a, createVNode as C, createCommentVNode as x, renderList as z, createBlock as j } from "vue";
2
- import { parseTraceSpans as $, parseTraceWarnings as I, formatTime as K, timeAgo as W, durationSeverity as q } from "adonisjs-server-stats/core";
3
- import { u as G } from "./useApiClient-BQQ9CF-q.js";
4
- import { u as H } from "./index-Bj6pm5g3.js";
5
- import { u as J } from "./useResizableTable-BoivAevK.js";
6
- import { _ as O } from "./FilterBar.vue_vue_type_script_setup_true_lang-ClJ37hhT.js";
7
- import { _ as Q } from "./PaginationControls.vue_vue_type_script_setup_true_lang-CuN7g_8Z.js";
8
- import { _ as X } from "./WaterfallChart.vue_vue_type_script_setup_true_lang-tZ13cNj1.js";
9
- const Y = {
10
- key: 0,
11
- class: "ss-dash-empty"
12
- }, Z = { class: "ss-dash-tl-detail-header" }, ss = { style: { color: "var(--ss-text)" } }, ts = { class: "ss-dash-tl-meta" }, es = {
13
- key: 0,
14
- class: "ss-dash-empty"
15
- }, as = {
16
- key: 1,
17
- class: "ss-dash-empty"
18
- }, ls = { class: "ss-dash-table-wrap" }, os = ["onClick"], ns = { style: { color: "var(--ss-dim)" } }, rs = ["title"], ds = { style: { color: "var(--ss-muted)", "text-align": "center" } }, us = ["title"], is = {
19
- key: 1,
20
- class: "ss-dash-empty"
21
- }, ks = /* @__PURE__ */ M({
22
- __name: "TimelineSection",
23
- props: {
24
- tracingEnabled: { type: Boolean, default: !0 }
25
- },
26
- setup(D) {
27
- const T = D, S = v("ss-refresh-key", i(0)), f = v("ss-dashboard-endpoint", "/__stats/api"), g = v("ss-auth-token", void 0), k = v("ss-base-url", ""), { data: p, loading: B, error: L, pagination: u, goToPage: E, setSearch: F } = H(() => "traces", {
28
- baseUrl: k,
29
- dashboardEndpoint: f,
30
- authToken: g,
31
- refreshKey: S
32
- }), b = i(""), m = i(null), e = i(null), _ = i(!1), y = U(() => {
33
- if (!p.value) return [];
34
- const r = p.value;
35
- return r.data || r.traces || p.value || [];
36
- }), P = G(k, g);
37
- async function A(r) {
38
- m.value = r, _.value = !0, e.value = null;
39
- try {
40
- const d = f || "/__stats/api", t = await P().fetch(`${d}/traces/${r}`);
41
- e.value = t;
42
- } catch {
43
- } finally {
44
- _.value = !1;
45
- }
46
- }
47
- function w() {
48
- m.value = null, e.value = null;
49
- }
50
- function N(r) {
51
- b.value = r, F(r);
52
- }
53
- function R(r) {
54
- const d = q(r);
55
- return d === "very-slow" ? "ss-dash-very-slow" : d === "slow" ? "ss-dash-slow" : "";
56
- }
57
- const { tableRef: V } = J(() => y.value);
58
- return (r, d) => (l(), o("div", null, [
59
- T.tracingEnabled ? m.value && e.value ? (l(), o(c, { key: 1 }, [
60
- s("div", Z, [
61
- s("button", {
62
- type: "button",
63
- class: "ss-dash-btn",
64
- onClick: w
65
- }, "← Back"),
66
- s("span", {
67
- class: h(`ss-dash-method ss-dash-method-${(e.value.method || "").toLowerCase()}`)
68
- }, n(e.value.method), 3),
69
- s("span", ss, n(e.value.url), 1),
70
- s("span", {
71
- class: h(`ss-dash-status ss-dash-status-${Math.floor((e.value.status_code || e.value.statusCode || 0) / 100)}xx`)
72
- }, n(e.value.status_code || e.value.statusCode || 0), 3),
73
- s("span", ts, n((e.value.total_duration || e.value.totalDuration || 0).toFixed(1)) + "ms · " + n(e.value.spanCount ?? a($)(e.value.spans).length) + " spans ", 1)
74
- ]),
75
- C(X, {
76
- spans: a($)(e.value.spans),
77
- "total-duration": e.value.total_duration || e.value.totalDuration || 0,
78
- warnings: a(I)(e.value.warnings)
79
- }, null, 8, ["spans", "total-duration", "warnings"])
80
- ], 64)) : m.value && _.value ? (l(), o(c, { key: 2 }, [
81
- s("div", { class: "ss-dash-tl-detail-header" }, [
82
- s("button", {
83
- type: "button",
84
- class: "ss-dash-btn",
85
- onClick: w
86
- }, "← Back")
87
- ]),
88
- d[0] || (d[0] = s("div", { class: "ss-dash-empty" }, "Loading trace detail...", -1))
89
- ], 64)) : (l(), o(c, { key: 3 }, [
90
- C(O, {
91
- "model-value": b.value,
92
- placeholder: "Filter traces...",
93
- summary: `${a(u).total ?? 0} traces`,
94
- "onUpdate:modelValue": N
95
- }, null, 8, ["model-value", "summary"]),
96
- a(L) ? (l(), o("div", es, "Failed to load traces")) : x("", !0),
97
- a(B) && !a(p) ? (l(), o("div", as, "Loading traces...")) : (l(), o(c, { key: 2 }, [
98
- s("div", ls, [
99
- y.value.length > 0 ? (l(), o("table", {
100
- key: 0,
101
- ref_key: "tableRef",
102
- ref: V,
103
- class: "ss-dash-table"
104
- }, [
105
- d[1] || (d[1] = s("colgroup", null, [
106
- s("col", { style: { width: "40px" } }),
107
- s("col", { style: { width: "70px" } }),
108
- s("col"),
109
- s("col", { style: { width: "60px" } }),
110
- s("col", { style: { width: "80px" } }),
111
- s("col", { style: { width: "50px" } }),
112
- s("col", { style: { width: "80px" } })
113
- ], -1)),
114
- d[2] || (d[2] = s("thead", null, [
115
- s("tr", null, [
116
- s("th", null, "#"),
117
- s("th", null, "Method"),
118
- s("th", null, "URL"),
119
- s("th", null, "Status"),
120
- s("th", null, "Duration"),
121
- s("th", null, "Spans"),
122
- s("th", null, "Time")
123
- ])
124
- ], -1)),
125
- s("tbody", null, [
126
- (l(!0), o(c, null, z(y.value, (t) => (l(), o("tr", {
127
- key: t.id,
128
- class: "ss-dash-clickable",
129
- onClick: (cs) => A(t.id)
130
- }, [
131
- s("td", null, [
132
- s("span", ns, n(t.id), 1)
133
- ]),
134
- s("td", null, [
135
- s("span", {
136
- class: h(`ss-dash-method ss-dash-method-${(t.method || "").toLowerCase()}`)
137
- }, n(t.method), 3)
138
- ]),
139
- s("td", null, [
140
- s("span", {
141
- style: { color: "var(--ss-text)", overflow: "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" },
142
- title: t.url
143
- }, n(t.url), 9, rs)
144
- ]),
145
- s("td", null, [
146
- s("span", {
147
- class: h(`ss-dash-status ss-dash-status-${Math.floor((t.statusCode || t.status_code || 0) / 100)}xx`)
148
- }, n(t.statusCode || t.status_code || 0), 3)
149
- ]),
150
- s("td", null, [
151
- s("span", {
152
- class: h(`ss-dash-duration ${R(t.totalDuration || t.total_duration || 0)}`)
153
- }, n((t.totalDuration || t.total_duration || 0).toFixed(1)) + "ms ", 3)
154
- ]),
155
- s("td", null, [
156
- s("span", ds, n(t.spanCount || t.span_count || 0), 1)
157
- ]),
158
- s("td", null, [
159
- s("span", {
160
- class: "ss-dash-event-time",
161
- title: a(K)(
162
- t.createdAt || t.created_at || t.timestamp
163
- )
164
- }, n(a(W)(
165
- t.createdAt || t.created_at || t.timestamp
166
- )), 9, us)
167
- ])
168
- ], 8, os))), 128))
169
- ])
170
- ], 512)) : (l(), o("div", is, "No traces recorded"))
171
- ]),
172
- a(u).totalPages > 1 ? (l(), j(Q, {
173
- key: 0,
174
- page: a(u).page,
175
- "last-page": a(u).totalPages,
176
- total: a(u).total,
177
- onPageChange: a(E)
178
- }, null, 8, ["page", "last-page", "total", "onPageChange"])) : x("", !0)
179
- ], 64))
180
- ], 64)) : (l(), o("div", Y, " Tracing is not enabled. Enable tracing in your server-stats config to use the timeline. "))
181
- ]));
182
- }
183
- });
184
- export {
185
- ks as default
186
- };
@@ -1,250 +0,0 @@
1
- import { defineComponent as z, ref as h, computed as x, onBeforeUnmount as F, openBlock as s, createElementBlock as l, Fragment as i, createElementVNode as t, toDisplayString as n, normalizeClass as b, unref as u, renderList as _, normalizeStyle as B, createTextVNode as D, createCommentVNode as T, withDirectives as P, vModelText as G, withModifiers as H } from "vue";
2
- import { formatDuration as y, TAB_ICONS as A, formatTime as I, timeAgo as W, durationSeverity as Y } from "adonisjs-server-stats/core";
3
- import { u as j } from "./useApiClient-BQQ9CF-q.js";
4
- import { u as J } from "./useResizableTable-BoivAevK.js";
5
- const K = {
6
- key: 0,
7
- class: "ss-dbg-empty"
8
- }, Q = { class: "ss-dbg-empty" }, X = { class: "ss-dbg-tl-detail-header" }, Z = { class: "ss-dbg-tl-detail-url" }, ee = { class: "ss-dbg-tl-meta" }, te = { class: "ss-dbg-tl-legend" }, se = { id: "ss-dbg-tl-waterfall" }, le = {
9
- key: 0,
10
- class: "ss-dbg-empty"
11
- }, ae = ["title"], ne = { class: "ss-dbg-tl-track" }, oe = ["title"], de = { class: "ss-dbg-tl-dur" }, re = {
12
- key: 0,
13
- class: "ss-dbg-tl-warnings"
14
- }, ie = {
15
- key: 3,
16
- class: "ss-dbg-empty"
17
- }, ue = { class: "ss-dbg-search-bar" }, ce = { class: "ss-dbg-summary" }, be = {
18
- key: 0,
19
- class: "ss-dbg-empty"
20
- }, ge = ["onClick"], ve = {
21
- class: "ss-dbg-c-dim",
22
- style: { "white-space": "nowrap" }
23
- }, he = { class: "ss-dbg-c-text" }, me = ["href"], fe = ["viewBox", "innerHTML"], pe = {
24
- class: "ss-dbg-c-muted",
25
- style: { "text-align": "center" }
26
- }, _e = ["title"], xe = /* @__PURE__ */ z({
27
- __name: "TimelineTab",
28
- props: {
29
- data: {},
30
- dashboardPath: {},
31
- baseUrl: {},
32
- debugEndpoint: {},
33
- authToken: {}
34
- },
35
- setup(k) {
36
- const m = k, f = h(""), g = h(null), d = h(null), w = h(!1), c = h(null), S = j(m.baseUrl || "", m.authToken), p = x(() => {
37
- const o = m.data;
38
- if (!o) return [];
39
- const a = Array.isArray(o) ? o : o.traces || [];
40
- if (!f.value.trim()) return a;
41
- const e = f.value.toLowerCase();
42
- return a.filter(
43
- (r) => r.url.toLowerCase().includes(e) || r.method.toLowerCase().includes(e) || String(r.statusCode).includes(e)
44
- );
45
- }), C = {
46
- request: "#1e3a5f",
47
- middleware: "rgba(30, 58, 95, 0.7)",
48
- db: "#6d28d9",
49
- view: "#0e7490",
50
- mail: "#059669",
51
- event: "#b45309",
52
- custom: "#525252"
53
- }, M = {
54
- request: "Request",
55
- middleware: "Middleware",
56
- db: "Database",
57
- view: "View",
58
- mail: "Mail",
59
- event: "Event",
60
- custom: "Custom"
61
- };
62
- function R(o) {
63
- g.value === o.id ? (g.value = null, d.value = null, c.value = null) : (g.value = o.id, N(o.id));
64
- }
65
- function L() {
66
- g.value = null, d.value = null, c.value = null;
67
- }
68
- let v = null;
69
- async function N(o) {
70
- v && v.abort(), v = new AbortController(), w.value = !0, c.value = null, d.value = null;
71
- const a = m.debugEndpoint || "/admin/api/debug";
72
- try {
73
- const r = await S().get(`${a}/traces/${o}`);
74
- d.value = r;
75
- } catch (e) {
76
- if (e instanceof Error && e.name === "AbortError") return;
77
- c.value = e instanceof Error ? e.message : "Failed to load trace";
78
- } finally {
79
- w.value = !1;
80
- }
81
- }
82
- const $ = x(() => d.value?.spans || []), E = x(() => d.value?.warnings || []);
83
- function O(o, a) {
84
- const e = a || 1, r = e > 0 ? o.startOffset / e * 100 : 0, q = e > 0 ? Math.max(o.duration / e * 100, 0.5) : 0.5;
85
- return {
86
- left: `${r}%`,
87
- width: `${q}%`,
88
- background: C[o.category] || C.custom
89
- };
90
- }
91
- const { tableRef: U } = J(() => p.value);
92
- F(() => {
93
- v && v.abort();
94
- });
95
- function V(o) {
96
- const a = Y(o);
97
- return a === "very-slow" ? "ss-dbg-very-slow" : a === "slow" ? "ss-dbg-slow" : "";
98
- }
99
- return (o, a) => (s(), l("div", null, [
100
- g.value !== null ? (s(), l(i, { key: 0 }, [
101
- w.value ? (s(), l("div", K, "Loading trace detail...")) : c.value ? (s(), l(i, { key: 1 }, [
102
- t("div", { class: "ss-dbg-tl-detail-header" }, [
103
- t("button", {
104
- type: "button",
105
- class: "ss-dbg-btn-clear",
106
- onClick: L
107
- }, "← Back")
108
- ]),
109
- t("div", Q, "Error: " + n(c.value), 1)
110
- ], 64)) : d.value ? (s(), l(i, { key: 2 }, [
111
- t("div", X, [
112
- t("button", {
113
- type: "button",
114
- class: "ss-dbg-btn-clear",
115
- onClick: L
116
- }, "← Back"),
117
- t("span", {
118
- class: b(`ss-dbg-method ss-dbg-method-${d.value.method.toLowerCase()}`)
119
- }, n(d.value.method), 3),
120
- t("span", Z, n(d.value.url), 1),
121
- t("span", {
122
- class: b(`ss-dbg-status ss-dbg-status-${Math.floor(d.value.statusCode / 100)}xx`)
123
- }, n(d.value.statusCode), 3),
124
- t("span", ee, n(u(y)(d.value.totalDuration)) + " · " + n(d.value.spanCount) + " spans ", 1)
125
- ]),
126
- t("div", te, [
127
- (s(), l(i, null, _(C, (e, r) => t("span", {
128
- key: r,
129
- class: "ss-dbg-tl-legend-item"
130
- }, [
131
- t("span", {
132
- class: "ss-dbg-tl-legend-dot",
133
- style: B({ background: e })
134
- }, null, 4),
135
- D(" " + n(M[r] || r), 1)
136
- ])), 64))
137
- ]),
138
- t("div", se, [
139
- $.value.length === 0 ? (s(), l("div", le, " No spans captured for this request ")) : T("", !0),
140
- (s(!0), l(i, null, _($.value, (e) => (s(), l("div", {
141
- key: e.id,
142
- class: "ss-dbg-tl-row"
143
- }, [
144
- t("span", {
145
- class: "ss-dbg-tl-label",
146
- title: e.label
147
- }, n(e.label), 9, ae),
148
- t("span", ne, [
149
- t("span", {
150
- class: b(`ss-dbg-tl-bar ss-dbg-tl-bar-${e.category}`),
151
- style: B(O(e, d.value.totalDuration)),
152
- title: `${e.label}: ${u(y)(e.duration)}`
153
- }, null, 14, oe)
154
- ]),
155
- t("span", de, n(u(y)(e.duration)), 1)
156
- ]))), 128))
157
- ]),
158
- E.value.length > 0 ? (s(), l("div", re, [
159
- a[2] || (a[2] = t("div", { class: "ss-dbg-tl-warnings-title" }, "Warnings", -1)),
160
- (s(!0), l(i, null, _(E.value, (e, r) => (s(), l("div", {
161
- key: r,
162
- class: "ss-dbg-tl-warning"
163
- }, n(e), 1))), 128))
164
- ])) : T("", !0)
165
- ], 64)) : (s(), l("div", ie, "Loading trace detail..."))
166
- ], 64)) : (s(), l(i, { key: 1 }, [
167
- t("div", ue, [
168
- P(t("input", {
169
- "onUpdate:modelValue": a[0] || (a[0] = (e) => f.value = e),
170
- class: "ss-dbg-search",
171
- placeholder: "Filter traces...",
172
- type: "text"
173
- }, null, 512), [
174
- [G, f.value]
175
- ]),
176
- t("span", ce, n(p.value.length) + " traces", 1)
177
- ]),
178
- p.value.length === 0 ? (s(), l("div", be, "No traces captured")) : (s(), l("table", {
179
- key: 1,
180
- ref_key: "tableRef",
181
- ref: U,
182
- class: "ss-dbg-table"
183
- }, [
184
- a[3] || (a[3] = t("thead", null, [
185
- t("tr", null, [
186
- t("th", null, "#"),
187
- t("th", null, "Method"),
188
- t("th", null, "URL"),
189
- t("th", null, "Status"),
190
- t("th", null, "Duration"),
191
- t("th", null, "Spans"),
192
- t("th", null, "Time")
193
- ])
194
- ], -1)),
195
- t("tbody", null, [
196
- (s(!0), l(i, null, _(p.value, (e) => (s(), l("tr", {
197
- key: e.id,
198
- class: "ss-dbg-email-row",
199
- onClick: (r) => R(e)
200
- }, [
201
- t("td", ve, n(e.id), 1),
202
- t("td", null, [
203
- t("span", {
204
- class: b(`ss-dbg-method ss-dbg-method-${e.method.toLowerCase()}`)
205
- }, n(e.method), 3)
206
- ]),
207
- t("td", he, [
208
- D(n(e.url) + " ", 1),
209
- k.dashboardPath ? (s(), l("a", {
210
- key: 0,
211
- href: `${k.dashboardPath}#timeline?id=${e.id}`,
212
- target: "_blank",
213
- class: "ss-dbg-deeplink",
214
- onClick: a[1] || (a[1] = H(() => {
215
- }, ["stop"]))
216
- }, [
217
- (s(), l("svg", {
218
- viewBox: u(A)["open-external"].viewBox,
219
- width: "12",
220
- height: "12",
221
- fill: "none",
222
- stroke: "currentColor",
223
- "stroke-width": "2",
224
- innerHTML: u(A)["open-external"].elements.join("")
225
- }, null, 8, fe))
226
- ], 8, me)) : T("", !0)
227
- ]),
228
- t("td", null, [
229
- t("span", {
230
- class: b(`ss-dbg-status ss-dbg-status-${Math.floor(e.statusCode / 100)}xx`)
231
- }, n(e.statusCode), 3)
232
- ]),
233
- t("td", {
234
- class: b(["ss-dbg-duration", V(e.totalDuration)])
235
- }, n(u(y)(e.totalDuration)), 3),
236
- t("td", pe, n(e.spanCount), 1),
237
- t("td", {
238
- class: "ss-dbg-event-time",
239
- title: u(I)(e.timestamp)
240
- }, n(u(W)(e.timestamp)), 9, _e)
241
- ], 8, ge))), 128))
242
- ])
243
- ], 512))
244
- ], 64))
245
- ]));
246
- }
247
- });
248
- export {
249
- xe as default
250
- };
@@ -1,118 +0,0 @@
1
- import { defineComponent as B, computed as c, openBlock as n, createElementBlock as l, normalizeClass as u, createElementVNode as a, Fragment as m, renderList as h, normalizeStyle as g, toDisplayString as d, createTextVNode as L, createCommentVNode as O } from "vue";
2
- const S = {
3
- key: 0,
4
- class: "ss-dash-empty"
5
- }, D = { class: "ss-dash-tl-legend" }, E = ["title"], N = { class: "ss-dash-tl-track" }, F = ["title"], M = { class: "ss-dash-tl-dur" }, R = {
6
- key: 0,
7
- class: "ss-dash-tl-warnings"
8
- }, T = { class: "ss-dash-tl-warnings-title" }, q = /* @__PURE__ */ B({
9
- __name: "WaterfallChart",
10
- props: {
11
- spans: {},
12
- totalDuration: {},
13
- className: {},
14
- warnings: {}
15
- },
16
- setup(r) {
17
- const o = r, f = {
18
- request: "#1e3a5f",
19
- middleware: "rgba(30, 58, 95, 0.7)",
20
- db: "#6d28d9",
21
- view: "#0e7490",
22
- mail: "#059669",
23
- event: "#b45309",
24
- custom: "var(--ss-dim)"
25
- }, _ = {
26
- request: "Request",
27
- middleware: "Middleware",
28
- db: "DB",
29
- mail: "Mail",
30
- event: "Event",
31
- view: "View",
32
- custom: "Custom"
33
- }, v = c(() => o.spans || []), b = c(
34
- () => [...v.value].sort((t, s) => t.startOffset - s.startOffset)
35
- ), y = c(() => {
36
- const t = {};
37
- for (const s of b.value)
38
- t[s.id] = s.parentId ? (t[s.parentId] || 0) + 1 : 0;
39
- return t;
40
- });
41
- function $(t) {
42
- const s = o.totalDuration || 1;
43
- return `${t.startOffset / s * 100}%`;
44
- }
45
- function k(t) {
46
- const s = o.totalDuration || 1;
47
- return `${Math.max(t.duration / s * 100, 0.5)}%`;
48
- }
49
- function x(t) {
50
- return t.length > 50 ? t.slice(0, 50) + "..." : t;
51
- }
52
- function C(t) {
53
- return t === "db" ? "DB" : t;
54
- }
55
- function p(t) {
56
- return t === "db" ? "purple" : t === "mail" ? "green" : t === "event" ? "amber" : t === "view" ? "blue" : "muted";
57
- }
58
- function w(t) {
59
- const s = t.metadata ? Object.entries(t.metadata).filter(([, e]) => e != null).map(([e, i]) => `${e}=${i}`).join(", ") : "";
60
- return s ? `${t.label} (${t.duration.toFixed(2)}ms)
61
- ${s}` : `${t.label} (${t.duration.toFixed(2)}ms)`;
62
- }
63
- return (t, s) => v.value.length === 0 ? (n(), l("div", S, "No spans recorded")) : (n(), l("div", {
64
- key: 1,
65
- class: u(`ss-dash-tl-waterfall ${r.className || ""}`)
66
- }, [
67
- a("div", D, [
68
- (n(), l(m, null, h(_, (e, i) => a("div", {
69
- key: i,
70
- class: "ss-dash-tl-legend-item"
71
- }, [
72
- a("span", {
73
- class: "ss-dash-tl-legend-dot",
74
- style: g({ background: f[i] || f.custom })
75
- }, null, 4),
76
- a("span", null, d(e), 1)
77
- ])), 64))
78
- ]),
79
- (n(!0), l(m, null, h(b.value, (e) => (n(), l("div", {
80
- key: e.id,
81
- class: "ss-dash-tl-row"
82
- }, [
83
- a("div", {
84
- class: "ss-dash-tl-label",
85
- title: w(e),
86
- style: g({ paddingLeft: 8 + (y.value[e.id] || 0) * 16 + "px" })
87
- }, [
88
- a("span", {
89
- class: u(`ss-dash-badge ss-dash-badge-${p(e.category)}`),
90
- style: { "font-size": "9px", "margin-right": "4px" }
91
- }, d(C(e.category)), 3),
92
- L(" " + d(x(e.label)), 1)
93
- ], 12, E),
94
- a("div", N, [
95
- a("div", {
96
- class: u(`ss-dash-tl-bar ss-dash-tl-bar-${e.category || "custom"}`),
97
- style: g({
98
- left: $(e),
99
- width: k(e)
100
- }),
101
- title: w(e)
102
- }, null, 14, F)
103
- ]),
104
- a("span", M, d(e.duration.toFixed(2)) + "ms", 1)
105
- ]))), 128)),
106
- r.warnings && r.warnings.length > 0 ? (n(), l("div", R, [
107
- a("div", T, "Warnings (" + d(r.warnings.length) + ")", 1),
108
- (n(!0), l(m, null, h(r.warnings, (e, i) => (n(), l("div", {
109
- key: i,
110
- class: "ss-dash-tl-warning"
111
- }, d(e), 1))), 128))
112
- ])) : O("", !0)
113
- ], 2));
114
- }
115
- });
116
- export {
117
- q as _
118
- };