adonisjs-server-stats 1.9.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 (80) hide show
  1. package/dist/core/index.js +24 -22
  2. package/dist/core/split-pane.d.ts +18 -0
  3. package/dist/core/trace-utils.d.ts +5 -0
  4. package/dist/core/types.d.ts +1 -1
  5. package/dist/react/{CacheSection-xH75hwXu.js → CacheSection-UCMptWyn.js} +1 -1
  6. package/dist/react/{CacheTab-DYmsZJJ1.js → CacheTab-CA8LB1J5.js} +1 -1
  7. package/dist/react/{ConfigSection-D8BO1Ry9.js → ConfigSection-DfFd-WRq.js} +1 -1
  8. package/dist/react/{ConfigTab-CcN-tfjv.js → ConfigTab-Bdg8YMer.js} +1 -1
  9. package/dist/react/{CustomPaneTab-D7_o3Ec6.js → CustomPaneTab-Bxtv_8Rw.js} +1 -1
  10. package/dist/react/{EmailsSection-BzlsTdPs.js → EmailsSection-CM7stSyh.js} +1 -1
  11. package/dist/react/{EmailsTab-Uh2CQY3o.js → EmailsTab-BDhEiomM.js} +1 -1
  12. package/dist/react/{EventsSection-CGQWiIdV.js → EventsSection-ByQ-9blq.js} +1 -1
  13. package/dist/react/{EventsTab-CC6DQzEm.js → EventsTab-CMfY98Rl.js} +1 -1
  14. package/dist/react/{JobsSection-D7AHQmZi.js → JobsSection-DF3qEv9O.js} +1 -1
  15. package/dist/react/{JobsTab-B3Lfdqed.js → JobsTab-BbrBWIOb.js} +1 -1
  16. package/dist/react/{LogsSection-Cly1dpvS.js → LogsSection-DcFTZY7b.js} +1 -1
  17. package/dist/react/{LogsTab-BbYK-iyh.js → LogsTab-CicucmVk.js} +2 -2
  18. package/dist/react/{OverviewSection-CkBGFEWq.js → OverviewSection-C4T1ur51.js} +1 -1
  19. package/dist/react/{QueriesSection-CfCpnNUD.js → QueriesSection-PswteoF9.js} +1 -1
  20. package/dist/react/{QueriesTab-DbBmAqzO.js → QueriesTab-osLUWd4L.js} +1 -1
  21. package/dist/react/RelatedLogs-DFDOyUMr.js +40 -0
  22. package/dist/react/RequestsSection-Nag30rEA.js +341 -0
  23. package/dist/react/{RoutesSection-CRqF-cNM.js → RoutesSection-BUSkM6PY.js} +1 -1
  24. package/dist/react/{RoutesTab-Bwreij3e.js → RoutesTab-DgVzd2PZ.js} +1 -1
  25. package/dist/react/TimelineTab-Covg5weo.js +220 -0
  26. package/dist/react/{index-CecA4IdQ.js → index-Cflz9Ebj.js} +197 -203
  27. package/dist/react/index.js +1 -1
  28. package/dist/react/react/components/shared/RelatedLogs.d.ts +7 -0
  29. package/dist/react/style.css +1 -1
  30. package/dist/src/controller/debug_controller.js +1 -1
  31. package/dist/src/dashboard/dashboard_controller.js +13 -0
  32. package/dist/src/dashboard/dashboard_store.d.ts +1 -0
  33. package/dist/src/dashboard/dashboard_store.js +88 -41
  34. package/dist/src/dashboard/migrator.js +6 -0
  35. package/dist/src/data/data_access.d.ts +7 -0
  36. package/dist/src/data/data_access.js +32 -1
  37. package/dist/src/debug/trace_collector.d.ts +1 -1
  38. package/dist/src/debug/trace_collector.js +2 -1
  39. package/dist/src/debug/types.d.ts +4 -0
  40. package/dist/src/edge/client/dashboard.js +2 -2
  41. package/dist/src/edge/client/debug-panel-deferred.js +1 -1
  42. package/dist/src/edge/client-vue/dashboard.js +4 -4
  43. package/dist/src/edge/client-vue/debug-panel-deferred.js +3 -3
  44. package/dist/src/middleware/request_tracking_middleware.d.ts +1 -0
  45. package/dist/src/middleware/request_tracking_middleware.js +3 -1
  46. package/dist/src/provider/server_stats_provider.d.ts +3 -3
  47. package/dist/src/provider/server_stats_provider.js +29 -15
  48. package/dist/src/routes/register_routes.js +7 -2
  49. package/dist/src/styles/components.css +81 -0
  50. package/dist/src/styles/debug-panel.css +9 -0
  51. package/dist/src/types.d.ts +1 -1
  52. package/dist/vue/{CacheSection-Cx-hj09X.js → CacheSection-oFAJL3mo.js} +1 -1
  53. package/dist/vue/{ConfigSection-CMXyryf6.js → ConfigSection-BhfJ4KqL.js} +1 -1
  54. package/dist/vue/{EmailsSection-DgKl9xGT.js → EmailsSection-BcNyhyHs.js} +1 -1
  55. package/dist/vue/{EventsSection-BNMCAim1.js → EventsSection-r60Q5Lmu.js} +1 -1
  56. package/dist/vue/{JobsSection-CCMgMlxd.js → JobsSection-BHL-hkQw.js} +1 -1
  57. package/dist/vue/{LogsSection-CvOnTxUu.js → LogsSection-DRMGzJmg.js} +1 -1
  58. package/dist/vue/{OverviewSection-CHgaKtUR.js → OverviewSection-CXh6Ja1B.js} +1 -1
  59. package/dist/vue/{QueriesSection-BnHRD98z.js → QueriesSection-IodIsCJ-.js} +1 -1
  60. package/dist/vue/RelatedLogs.vue_vue_type_script_setup_true_lang-CB2_TzYW.js +84 -0
  61. package/dist/vue/RequestsSection-BPuMdmMc.js +401 -0
  62. package/dist/vue/{RoutesSection-BrceOcKQ.js → RoutesSection-NKo3Rbq3.js} +1 -1
  63. package/dist/vue/TimelineTab-zj5Z5OdT.js +338 -0
  64. package/dist/vue/components/Dashboard/sections/RequestsSection.vue.d.ts +4 -0
  65. package/dist/vue/components/DebugPanel/tabs/TimelineTab.vue.d.ts +4 -0
  66. package/dist/vue/components/{Dashboard/sections/TimelineSection.vue.d.ts → shared/RelatedLogs.vue.d.ts} +5 -6
  67. package/dist/vue/index-Dtgysd26.js +1229 -0
  68. package/dist/vue/index.js +1 -1
  69. package/dist/vue/style.css +1 -1
  70. package/package.json +1 -1
  71. package/dist/react/RequestsSection-Cb5a6MlT.js +0 -209
  72. package/dist/react/TimelineSection-B2y06kRE.js +0 -158
  73. package/dist/react/TimelineTab-6hthfdBB.js +0 -193
  74. package/dist/react/WaterfallChart-Cj73WdfM.js +0 -100
  75. package/dist/react/react/components/Dashboard/sections/TimelineSection.d.ts +0 -8
  76. package/dist/vue/RequestsSection-B-uSlM0f.js +0 -243
  77. package/dist/vue/TimelineSection-CfvnA2Oo.js +0 -186
  78. package/dist/vue/TimelineTab-Db6lKKsD.js +0 -250
  79. package/dist/vue/WaterfallChart.vue_vue_type_script_setup_true_lang-tZ13cNj1.js +0 -118
  80. package/dist/vue/index-oLxS08vN.js +0 -1235
@@ -1,243 +0,0 @@
1
- import { defineComponent as M, inject as _, ref as h, computed as U, openBlock as o, createElementBlock as l, Fragment as m, createElementVNode as s, normalizeClass as v, toDisplayString as n, createVNode as D, unref as a, createCommentVNode as u, createTextVNode as y, renderList as j, createBlock as K } from "vue";
2
- import { formatTime as G, timeAgo as H, normalizeTraceFields as I, durationSeverity as J } from "adonisjs-server-stats/core";
3
- import { u as O } from "./useApiClient-BQQ9CF-q.js";
4
- import { u as Q } from "./index-oLxS08vN.js";
5
- import { u as W } from "./useResizableTable-BoivAevK.js";
6
- import { _ as X } from "./FilterBar.vue_vue_type_script_setup_true_lang-ClJ37hhT.js";
7
- import { _ as Y } from "./PaginationControls.vue_vue_type_script_setup_true_lang-CuN7g_8Z.js";
8
- import { _ as Z } from "./WaterfallChart.vue_vue_type_script_setup_true_lang-tZ13cNj1.js";
9
- const ss = { class: "ss-dash-tl-detail-header" }, ts = { style: { color: "var(--ss-text)" } }, es = { class: "ss-dash-tl-meta" }, as = { class: "ss-dash-tl-detail-header" }, os = {
10
- key: 0,
11
- class: "ss-dash-empty"
12
- }, ls = {
13
- key: 1,
14
- class: "ss-dash-empty"
15
- }, ns = { class: "ss-dash-table-wrap" }, ds = {
16
- key: 0,
17
- class: "ss-dash-sort-arrow"
18
- }, is = {
19
- key: 0,
20
- class: "ss-dash-sort-arrow"
21
- }, rs = {
22
- key: 0,
23
- class: "ss-dash-sort-arrow"
24
- }, us = {
25
- key: 0,
26
- class: "ss-dash-sort-arrow"
27
- }, cs = {
28
- key: 0,
29
- class: "ss-dash-sort-arrow"
30
- }, ps = ["onClick"], hs = { style: { color: "var(--ss-dim)" } }, ms = ["title"], vs = { style: { color: "var(--ss-muted)", "text-align": "center" } }, ys = {
31
- key: 0,
32
- style: { color: "var(--ss-amber-fg)", "text-align": "center", display: "block" }
33
- }, fs = {
34
- key: 1,
35
- style: { color: "var(--ss-dim)", "text-align": "center", display: "block" }
36
- }, ks = ["title"], _s = {
37
- key: 1,
38
- class: "ss-dash-empty"
39
- }, Rs = /* @__PURE__ */ M({
40
- __name: "RequestsSection",
41
- setup(gs) {
42
- const S = _("ss-refresh-key", h(0)), C = _("ss-dashboard-endpoint", "/__stats/api"), b = _("ss-auth-token", void 0), x = _("ss-base-url", ""), { data: f, loading: R, error: T, pagination: c, sort: r, goToPage: L, setSearch: A, setSort: B } = Q(
43
- () => "requests",
44
- {
45
- baseUrl: x,
46
- dashboardEndpoint: C,
47
- authToken: b,
48
- refreshKey: S
49
- }
50
- ), $ = h(""), g = h(null), k = h(!1), d = h(null), w = U(() => {
51
- if (!f.value) return [];
52
- const i = f.value;
53
- return i.data || i.requests || f.value || [];
54
- }), F = O(x, b);
55
- async function N(i) {
56
- const t = i.id;
57
- k.value = !0;
58
- try {
59
- const e = C || "/__stats/api", q = await F().fetch(`${e}/requests/${t}`);
60
- d.value = I(q), g.value = i;
61
- } catch {
62
- } finally {
63
- k.value = !1;
64
- }
65
- }
66
- function P() {
67
- g.value = null, d.value = null;
68
- }
69
- function V(i) {
70
- $.value = i, A(i);
71
- }
72
- function p(i) {
73
- B(i);
74
- }
75
- function z(i) {
76
- const t = J(i);
77
- return t === "very-slow" ? "ss-dash-very-slow" : t === "slow" ? "ss-dash-slow" : "";
78
- }
79
- const { tableRef: E } = W(() => w.value);
80
- return (i, t) => (o(), l("div", null, [
81
- d.value && g.value ? (o(), l(m, { key: 0 }, [
82
- s("div", ss, [
83
- s("button", {
84
- type: "button",
85
- class: "ss-dash-btn",
86
- onClick: P
87
- }, " ← Back to Requests "),
88
- s("span", {
89
- class: v(`ss-dash-method ss-dash-method-${(d.value.method || "").toLowerCase()}`)
90
- }, n(d.value.method), 3),
91
- s("span", ts, n(d.value.url), 1),
92
- s("span", {
93
- class: v(`ss-dash-status ss-dash-status-${Math.floor((d.value.statusCode || 200) / 100)}xx`)
94
- }, n(d.value.statusCode), 3),
95
- s("span", es, n(d.value.totalDuration.toFixed(1)) + "ms · " + n(d.value.spanCount) + " spans ", 1)
96
- ]),
97
- D(Z, {
98
- spans: d.value.spans,
99
- "total-duration": d.value.totalDuration,
100
- warnings: d.value.warnings
101
- }, null, 8, ["spans", "total-duration", "warnings"])
102
- ], 64)) : k.value ? (o(), l(m, { key: 1 }, [
103
- s("div", as, [
104
- s("button", {
105
- type: "button",
106
- class: "ss-dash-btn",
107
- onClick: t[0] || (t[0] = (e) => k.value = !1)
108
- }, " ← Back to Requests ")
109
- ]),
110
- t[6] || (t[6] = s("div", { class: "ss-dash-empty" }, "Loading request detail...", -1))
111
- ], 64)) : (o(), l(m, { key: 2 }, [
112
- D(X, {
113
- "model-value": $.value,
114
- placeholder: "Filter requests...",
115
- summary: `${a(c).total ?? 0} requests`,
116
- "onUpdate:modelValue": V
117
- }, null, 8, ["model-value", "summary"]),
118
- a(T) ? (o(), l("div", os, "Failed to load requests")) : u("", !0),
119
- a(R) && !a(f) ? (o(), l("div", ls, "Loading requests...")) : (o(), l(m, { key: 2 }, [
120
- s("div", ns, [
121
- w.value.length > 0 ? (o(), l("table", {
122
- key: 0,
123
- ref_key: "tableRef",
124
- ref: E,
125
- class: "ss-dash-table"
126
- }, [
127
- t[15] || (t[15] = s("colgroup", null, [
128
- s("col", { style: { width: "40px" } }),
129
- s("col", { style: { width: "70px" } }),
130
- s("col"),
131
- s("col", { style: { width: "60px" } }),
132
- s("col", { style: { width: "80px" } }),
133
- s("col", { style: { width: "50px" } }),
134
- s("col", { style: { width: "40px" } }),
135
- s("col", { style: { width: "80px" } })
136
- ], -1)),
137
- s("thead", null, [
138
- s("tr", null, [
139
- t[12] || (t[12] = s("th", null, "#", -1)),
140
- s("th", {
141
- class: "ss-dash-sortable",
142
- onClick: t[1] || (t[1] = (e) => p("method"))
143
- }, [
144
- t[7] || (t[7] = y(" Method ", -1)),
145
- a(r).column === "method" ? (o(), l("span", ds, n(a(r).direction === "asc" ? " ▲" : " ▼"), 1)) : u("", !0)
146
- ]),
147
- s("th", {
148
- class: "ss-dash-sortable",
149
- onClick: t[2] || (t[2] = (e) => p("url"))
150
- }, [
151
- t[8] || (t[8] = y(" URL ", -1)),
152
- a(r).column === "url" ? (o(), l("span", is, n(a(r).direction === "asc" ? " ▲" : " ▼"), 1)) : u("", !0)
153
- ]),
154
- s("th", {
155
- class: "ss-dash-sortable",
156
- onClick: t[3] || (t[3] = (e) => p("statusCode"))
157
- }, [
158
- t[9] || (t[9] = y(" Status ", -1)),
159
- a(r).column === "statusCode" ? (o(), l("span", rs, n(a(r).direction === "asc" ? " ▲" : " ▼"), 1)) : u("", !0)
160
- ]),
161
- s("th", {
162
- class: "ss-dash-sortable",
163
- onClick: t[4] || (t[4] = (e) => p("duration"))
164
- }, [
165
- t[10] || (t[10] = y(" Duration ", -1)),
166
- a(r).column === "duration" ? (o(), l("span", us, n(a(r).direction === "asc" ? " ▲" : " ▼"), 1)) : u("", !0)
167
- ]),
168
- t[13] || (t[13] = s("th", null, "Spans", -1)),
169
- t[14] || (t[14] = s("th", null, "⚠", -1)),
170
- s("th", {
171
- class: "ss-dash-sortable",
172
- onClick: t[5] || (t[5] = (e) => p("createdAt"))
173
- }, [
174
- t[11] || (t[11] = y(" Time ", -1)),
175
- a(r).column === "createdAt" ? (o(), l("span", cs, n(a(r).direction === "asc" ? " ▲" : " ▼"), 1)) : u("", !0)
176
- ])
177
- ])
178
- ]),
179
- s("tbody", null, [
180
- (o(!0), l(m, null, j(w.value, (e) => (o(), l("tr", {
181
- key: e.id,
182
- class: "ss-dash-clickable",
183
- onClick: (q) => N(e)
184
- }, [
185
- s("td", null, [
186
- s("span", hs, n(e.id), 1)
187
- ]),
188
- s("td", null, [
189
- s("span", {
190
- class: v(`ss-dash-method ss-dash-method-${(e.method || "").toLowerCase()}`)
191
- }, n(e.method), 3)
192
- ]),
193
- s("td", null, [
194
- s("span", {
195
- style: { color: "var(--ss-text)", overflow: "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" },
196
- title: e.url
197
- }, n(e.url), 9, ms)
198
- ]),
199
- s("td", null, [
200
- s("span", {
201
- class: v(`ss-dash-status ss-dash-status-${Math.floor((e.status_code || e.statusCode || 200) / 100)}xx`)
202
- }, n(e.status_code || e.statusCode), 3)
203
- ]),
204
- s("td", null, [
205
- s("span", {
206
- class: v(`ss-dash-duration ${z(e.total_duration || e.totalDuration || e.duration || 0)}`)
207
- }, n((e.total_duration || e.totalDuration || e.duration || 0).toFixed(1)) + "ms ", 3)
208
- ]),
209
- s("td", null, [
210
- s("span", vs, n(e.span_count || e.spanCount || 0), 1)
211
- ]),
212
- s("td", null, [
213
- (e.warning_count || e.warningCount || 0) > 0 ? (o(), l("span", ys, n(e.warning_count || e.warningCount || 0), 1)) : (o(), l("span", fs, "-"))
214
- ]),
215
- s("td", null, [
216
- s("span", {
217
- class: "ss-dash-event-time",
218
- title: a(G)(
219
- e.createdAt || e.created_at || e.timestamp || ""
220
- )
221
- }, n(a(H)(
222
- e.createdAt || e.created_at || e.timestamp || ""
223
- )), 9, ks)
224
- ])
225
- ], 8, ps))), 128))
226
- ])
227
- ], 512)) : (o(), l("div", _s, "No requests recorded yet"))
228
- ]),
229
- a(c).totalPages > 1 ? (o(), K(Y, {
230
- key: 0,
231
- page: a(c).page,
232
- "last-page": a(c).totalPages,
233
- total: a(c).total,
234
- onPageChange: a(L)
235
- }, null, 8, ["page", "last-page", "total", "onPageChange"])) : u("", !0)
236
- ], 64))
237
- ], 64))
238
- ]));
239
- }
240
- });
241
- export {
242
- Rs as default
243
- };
@@ -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-oLxS08vN.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
- };