durable-actors-observer 0.1.0 → 0.4.2
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.
- package/README.md +33 -0
- package/dist/ConsoleApp.d.ts +3 -2
- package/dist/FilterCombobox.d.ts +1 -2
- package/dist/Overview.d.ts +1 -2
- package/dist/RequestObserver.d.ts +1 -1
- package/dist/SocketTimeline.d.ts +1 -1
- package/dist/TimeRangePicker.d.ts +1 -2
- package/dist/WebSocketObserver.d.ts +1 -2
- package/dist/client.d.ts +26 -10
- package/dist/index.d.ts +25 -4
- package/dist/index.js +2138 -765
- package/dist/observer-hooks.d.ts +2 -2
- package/dist/{overview-sql.d.ts → overview-metrics.d.ts} +2 -4
- package/dist/queue-wait-history.d.ts +1 -1
- package/dist/queue-wait.d.ts +1 -4
- package/dist/request-history.d.ts +2 -3
- package/dist/socket-history.d.ts +1 -1
- package/dist/socket-sessions.d.ts +2 -4
- package/dist/standalone/app.css +1 -1
- package/dist/standalone/app.js +6 -53
- package/dist/styles.css +1 -1
- package/dist/theme.css +1 -1
- package/package.json +1 -1
- package/dist/request-sql.d.ts +0 -10
package/dist/index.js
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import * as e from "react";
|
|
2
2
|
import { useEffect as t, useId as n, useMemo as r, useRef as i, useState as a } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import { Slot as
|
|
5
|
-
import { cva as
|
|
6
|
-
import { clsx as
|
|
7
|
-
import { extendTailwindMerge as
|
|
8
|
-
import { Fragment as
|
|
9
|
-
import { DayPicker as
|
|
10
|
-
import * as
|
|
11
|
-
import * as
|
|
12
|
-
import {
|
|
3
|
+
import { Activity as o, ArrowRight as s, Box as c, Cable as l, Calendar as u, ChevronDown as d, ChevronDownIcon as f, ChevronLeftIcon as p, ChevronRightIcon as m, CircleHelp as h, Hash as g, LayoutGrid as _, Pause as v, Play as ee, RefreshCw as te, Search as y, SearchIcon as b, SunMoon as x, Unplug as S, X as C } from "lucide-react";
|
|
4
|
+
import { Slot as w } from "@radix-ui/react-slot";
|
|
5
|
+
import { cva as T } from "class-variance-authority";
|
|
6
|
+
import { clsx as E } from "clsx";
|
|
7
|
+
import { extendTailwindMerge as D } from "tailwind-merge";
|
|
8
|
+
import { Fragment as O, jsx as k, jsxs as A } from "react/jsx-runtime";
|
|
9
|
+
import { DayPicker as j, getDefaultClassNames as M } from "react-day-picker";
|
|
10
|
+
import * as N from "@radix-ui/react-popover";
|
|
11
|
+
import * as P from "@radix-ui/react-dialog";
|
|
12
|
+
import { Command as F } from "cmdk";
|
|
13
|
+
import { createParser as ne } from "eventsource-parser";
|
|
13
14
|
//#region src/lib/utils.ts
|
|
14
|
-
var
|
|
15
|
-
function
|
|
16
|
-
return
|
|
15
|
+
var re = D({ prefix: "la" });
|
|
16
|
+
function I(...e) {
|
|
17
|
+
return re(E(e));
|
|
17
18
|
}
|
|
18
19
|
//#endregion
|
|
19
20
|
//#region src/components/ui/button.tsx
|
|
20
|
-
var
|
|
21
|
+
var ie = T("la:inline-flex la:shrink-0 la:items-center la:justify-center la:gap-2 la:whitespace-nowrap la:rounded-md la:text-sm la:font-medium la:outline-none la:transition-[background-color,border-color,color,box-shadow,transform] la:duration-150 la:ease-out la:active:translate-y-px la:disabled:pointer-events-none la:disabled:translate-y-0 la:disabled:opacity-45 la:focus-visible:ring-2 la:focus-visible:ring-ring la:focus-visible:ring-offset-2 la:focus-visible:ring-offset-background la:aria-invalid:border-destructive la:aria-invalid:ring-destructive/25 la:[&_svg]:pointer-events-none la:[&_svg]:shrink-0 la:[&_svg:not([class*='size-'])]:size-4", {
|
|
21
22
|
variants: {
|
|
22
23
|
variant: {
|
|
23
24
|
default: "la:bg-primary la:text-primary-foreground la:shadow-[var(--shadow-control)] la:hover:bg-primary/88",
|
|
@@ -41,10 +42,10 @@ var N = b("la:inline-flex la:shrink-0 la:items-center la:justify-center la:gap-2
|
|
|
41
42
|
size: "default"
|
|
42
43
|
}
|
|
43
44
|
});
|
|
44
|
-
function
|
|
45
|
-
return /* @__PURE__ */
|
|
45
|
+
function L({ className: e, variant: t, size: n, asChild: r = !1, ...i }) {
|
|
46
|
+
return /* @__PURE__ */ k(r ? w : "button", {
|
|
46
47
|
"data-slot": "button",
|
|
47
|
-
className:
|
|
48
|
+
className: I(ie({
|
|
48
49
|
variant: t,
|
|
49
50
|
size: n,
|
|
50
51
|
className: e
|
|
@@ -54,59 +55,59 @@ function P({ className: e, variant: t, size: n, asChild: r = !1, ...i }) {
|
|
|
54
55
|
}
|
|
55
56
|
//#endregion
|
|
56
57
|
//#region src/components/ui/calendar.tsx
|
|
57
|
-
function
|
|
58
|
-
let c =
|
|
59
|
-
return /* @__PURE__ */
|
|
58
|
+
function ae({ className: e, classNames: t, showOutsideDays: n = !0, captionLayout: r = "label", buttonVariant: i = "ghost", formatters: a, components: o, ...s }) {
|
|
59
|
+
let c = M();
|
|
60
|
+
return /* @__PURE__ */ k(j, {
|
|
60
61
|
showOutsideDays: n,
|
|
61
|
-
className:
|
|
62
|
+
className: I("la:group/calendar la:bg-background la:p-3 la:[--cell-size:--spacing(8)] la:[[data-slot=card-content]_&]:bg-transparent la:[[data-slot=popover-content]_&]:bg-transparent", e),
|
|
62
63
|
captionLayout: r,
|
|
63
64
|
formatters: {
|
|
64
65
|
formatMonthDropdown: (e) => e.toLocaleString("default", { month: "short" }),
|
|
65
66
|
...a
|
|
66
67
|
},
|
|
67
68
|
classNames: {
|
|
68
|
-
root:
|
|
69
|
-
months:
|
|
70
|
-
month:
|
|
71
|
-
nav:
|
|
72
|
-
button_previous:
|
|
73
|
-
button_next:
|
|
74
|
-
month_caption:
|
|
75
|
-
dropdowns:
|
|
76
|
-
dropdown_root:
|
|
77
|
-
dropdown:
|
|
78
|
-
caption_label:
|
|
79
|
-
month_grid:
|
|
80
|
-
weekdays:
|
|
81
|
-
weekday:
|
|
82
|
-
week:
|
|
83
|
-
week_number_header:
|
|
84
|
-
week_number:
|
|
85
|
-
day:
|
|
86
|
-
range_start:
|
|
87
|
-
range_middle:
|
|
88
|
-
range_end:
|
|
89
|
-
today:
|
|
90
|
-
outside:
|
|
91
|
-
disabled:
|
|
92
|
-
hidden:
|
|
69
|
+
root: I("la:w-fit", c.root),
|
|
70
|
+
months: I("la:relative la:flex la:flex-col la:gap-4 la:md:flex-row", c.months),
|
|
71
|
+
month: I("la:flex la:w-full la:flex-col la:gap-4", c.month),
|
|
72
|
+
nav: I("la:absolute la:inset-x-0 la:top-0 la:flex la:w-full la:items-center la:justify-between la:gap-1", c.nav),
|
|
73
|
+
button_previous: I(ie({ variant: i }), "la:size-(--cell-size) la:p-0 la:select-none la:aria-disabled:opacity-50", c.button_previous),
|
|
74
|
+
button_next: I(ie({ variant: i }), "la:size-(--cell-size) la:p-0 la:select-none la:aria-disabled:opacity-50", c.button_next),
|
|
75
|
+
month_caption: I("la:flex la:h-(--cell-size) la:w-full la:items-center la:justify-center la:px-(--cell-size)", c.month_caption),
|
|
76
|
+
dropdowns: I("la:flex la:h-(--cell-size) la:w-full la:items-center la:justify-center la:gap-1.5 la:text-sm la:font-medium", c.dropdowns),
|
|
77
|
+
dropdown_root: I("la:relative la:rounded-md la:border la:border-input la:shadow-xs la:has-focus:border-ring la:has-focus:ring-[3px] la:has-focus:ring-ring/50", c.dropdown_root),
|
|
78
|
+
dropdown: I("la:absolute la:inset-0 la:bg-popover la:opacity-0", c.dropdown),
|
|
79
|
+
caption_label: I("la:font-medium la:select-none", r === "label" ? "la:text-sm" : "la:flex la:h-8 la:items-center la:gap-1 la:rounded-md la:pr-1 la:pl-2 la:text-sm la:[&>svg]:size-3.5 la:[&>svg]:text-muted-foreground", c.caption_label),
|
|
80
|
+
month_grid: I("la:w-full la:border-collapse", c.month_grid),
|
|
81
|
+
weekdays: I("la:flex", c.weekdays),
|
|
82
|
+
weekday: I("la:flex-1 la:rounded-md la:text-[0.8rem] la:font-normal la:text-muted-foreground la:select-none", c.weekday),
|
|
83
|
+
week: I("la:mt-2 la:flex la:w-full", c.week),
|
|
84
|
+
week_number_header: I("la:w-(--cell-size) la:select-none", c.week_number_header),
|
|
85
|
+
week_number: I("la:text-[0.8rem] la:text-muted-foreground la:select-none", c.week_number),
|
|
86
|
+
day: I("la:group/day la:relative la:aspect-square la:h-full la:w-full la:p-0 la:text-center la:select-none la:[&:last-child[data-selected=true]_button]:rounded-r-md", s.showWeekNumber ? "la:[&:nth-child(2)[data-selected=true]_button]:rounded-l-md" : "la:[&:first-child[data-selected=true]_button]:rounded-l-md", c.day),
|
|
87
|
+
range_start: I("la:rounded-l-md la:bg-accent", c.range_start),
|
|
88
|
+
range_middle: I("la:rounded-none", c.range_middle),
|
|
89
|
+
range_end: I("la:rounded-r-md la:bg-accent", c.range_end),
|
|
90
|
+
today: I("la:rounded-md la:bg-accent la:text-accent-foreground la:data-[selected=true]:rounded-none", c.today),
|
|
91
|
+
outside: I("la:text-muted-foreground la:aria-selected:text-muted-foreground", c.outside),
|
|
92
|
+
disabled: I("la:text-muted-foreground la:opacity-50", c.disabled),
|
|
93
|
+
hidden: I("la:invisible", c.hidden),
|
|
93
94
|
...t
|
|
94
95
|
},
|
|
95
96
|
components: {
|
|
96
|
-
Root: ({ className: e, rootRef: t, ...n }) => /* @__PURE__ */
|
|
97
|
+
Root: ({ className: e, rootRef: t, ...n }) => /* @__PURE__ */ k("div", {
|
|
97
98
|
"data-slot": "calendar",
|
|
98
99
|
ref: t,
|
|
99
|
-
className:
|
|
100
|
+
className: I(e),
|
|
100
101
|
...n
|
|
101
102
|
}),
|
|
102
|
-
Chevron: ({ className: e, orientation: t, ...n }) =>
|
|
103
|
-
className:
|
|
103
|
+
Chevron: ({ className: e, orientation: t, ...n }) => k(t === "left" ? p : t === "right" ? m : f, {
|
|
104
|
+
className: I("la:size-4", e),
|
|
104
105
|
...n
|
|
105
106
|
}),
|
|
106
|
-
DayButton:
|
|
107
|
-
WeekNumber: ({ children: e, ...t }) => /* @__PURE__ */
|
|
107
|
+
DayButton: oe,
|
|
108
|
+
WeekNumber: ({ children: e, ...t }) => /* @__PURE__ */ k("td", {
|
|
108
109
|
...t,
|
|
109
|
-
children: /* @__PURE__ */
|
|
110
|
+
children: /* @__PURE__ */ k("div", {
|
|
110
111
|
className: "la:flex la:size-(--cell-size) la:items-center la:justify-center la:text-center",
|
|
111
112
|
children: e
|
|
112
113
|
})
|
|
@@ -116,11 +117,11 @@ function ee({ className: e, classNames: t, showOutsideDays: n = !0, captionLayou
|
|
|
116
117
|
...s
|
|
117
118
|
});
|
|
118
119
|
}
|
|
119
|
-
function
|
|
120
|
-
let a =
|
|
120
|
+
function oe({ className: t, day: n, modifiers: r, ...i }) {
|
|
121
|
+
let a = M(), o = e.useRef(null);
|
|
121
122
|
return e.useEffect(() => {
|
|
122
123
|
r.focused && o.current?.focus();
|
|
123
|
-
}, [r.focused]), /* @__PURE__ */
|
|
124
|
+
}, [r.focused]), /* @__PURE__ */ k(L, {
|
|
124
125
|
ref: o,
|
|
125
126
|
variant: "ghost",
|
|
126
127
|
size: "icon",
|
|
@@ -129,46 +130,73 @@ function te({ className: t, day: n, modifiers: r, ...i }) {
|
|
|
129
130
|
"data-range-start": r.range_start,
|
|
130
131
|
"data-range-end": r.range_end,
|
|
131
132
|
"data-range-middle": r.range_middle,
|
|
132
|
-
className:
|
|
133
|
+
className: I("la:flex la:aspect-square la:size-auto la:w-full la:min-w-(--cell-size) la:flex-col la:gap-1 la:leading-none la:font-normal la:group-data-[focused=true]/day:relative la:group-data-[focused=true]/day:z-10 la:group-data-[focused=true]/day:border-ring la:group-data-[focused=true]/day:ring-[3px] la:group-data-[focused=true]/day:ring-ring/50 la:data-[range-end=true]:rounded-md la:data-[range-end=true]:rounded-r-md la:data-[range-end=true]:bg-primary la:data-[range-end=true]:text-primary-foreground la:data-[range-middle=true]:rounded-none la:data-[range-middle=true]:bg-accent la:data-[range-middle=true]:text-accent-foreground la:data-[range-start=true]:rounded-md la:data-[range-start=true]:rounded-l-md la:data-[range-start=true]:bg-primary la:data-[range-start=true]:text-primary-foreground la:data-[selected-single=true]:bg-primary la:data-[selected-single=true]:text-primary-foreground la:dark:hover:text-accent-foreground la:[&>span]:text-xs la:[&>span]:opacity-70", a.day, t),
|
|
133
134
|
...i
|
|
134
135
|
});
|
|
135
136
|
}
|
|
136
137
|
//#endregion
|
|
137
138
|
//#region src/components/ui/input.tsx
|
|
138
|
-
function
|
|
139
|
-
return /* @__PURE__ */
|
|
139
|
+
function R({ className: e, type: t, ...n }) {
|
|
140
|
+
return /* @__PURE__ */ k("input", {
|
|
140
141
|
type: t,
|
|
141
142
|
"data-slot": "input",
|
|
142
|
-
className:
|
|
143
|
+
className: I("la:flex la:h-9 la:w-full la:min-w-0 la:rounded-md la:border la:border-input la:bg-card la:px-3 la:py-1 la:text-sm la:text-foreground la:outline-none la:transition-colors la:placeholder:text-muted-foreground la:focus-visible:border-ring la:focus-visible:ring-2 la:focus-visible:ring-ring/20 la:disabled:cursor-not-allowed la:disabled:opacity-50 la:max-md:min-h-11", e),
|
|
143
144
|
...n
|
|
144
145
|
});
|
|
145
146
|
}
|
|
146
147
|
//#endregion
|
|
147
148
|
//#region src/components/ui/popover.tsx
|
|
148
|
-
function
|
|
149
|
-
return /* @__PURE__ */
|
|
149
|
+
function se({ ...e }) {
|
|
150
|
+
return /* @__PURE__ */ k(N.Root, {
|
|
150
151
|
"data-slot": "popover",
|
|
151
152
|
...e
|
|
152
153
|
});
|
|
153
154
|
}
|
|
154
|
-
function
|
|
155
|
-
return /* @__PURE__ */
|
|
155
|
+
function ce({ ...e }) {
|
|
156
|
+
return /* @__PURE__ */ k(N.Trigger, {
|
|
156
157
|
"data-slot": "popover-trigger",
|
|
157
158
|
...e
|
|
158
159
|
});
|
|
159
160
|
}
|
|
160
|
-
function
|
|
161
|
-
return /* @__PURE__ */
|
|
161
|
+
function le({ className: e, align: t = "center", sideOffset: n = 4, ...r }) {
|
|
162
|
+
return /* @__PURE__ */ k(N.Portal, { children: /* @__PURE__ */ k(N.Content, {
|
|
162
163
|
"data-slot": "popover-content",
|
|
163
164
|
align: t,
|
|
164
165
|
sideOffset: n,
|
|
165
|
-
className:
|
|
166
|
+
className: I("la:z-50 la:w-72 la:origin-(--radix-popover-content-transform-origin) la:rounded-md la:border la:bg-popover la:p-4 la:text-popover-foreground la:shadow-md la:outline-hidden", e),
|
|
166
167
|
...r
|
|
167
168
|
}) });
|
|
168
169
|
}
|
|
170
|
+
function ue({ ...e }) {
|
|
171
|
+
return /* @__PURE__ */ k(N.Anchor, {
|
|
172
|
+
"data-slot": "popover-anchor",
|
|
173
|
+
...e
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
function de({ className: e, ...t }) {
|
|
177
|
+
return /* @__PURE__ */ k("div", {
|
|
178
|
+
"data-slot": "popover-header",
|
|
179
|
+
className: I("la:flex la:flex-col la:gap-1 la:text-sm", e),
|
|
180
|
+
...t
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
function fe({ className: e, ...t }) {
|
|
184
|
+
return /* @__PURE__ */ k("div", {
|
|
185
|
+
"data-slot": "popover-title",
|
|
186
|
+
className: I("la:font-medium", e),
|
|
187
|
+
...t
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
function pe({ className: e, ...t }) {
|
|
191
|
+
return /* @__PURE__ */ k("p", {
|
|
192
|
+
"data-slot": "popover-description",
|
|
193
|
+
className: I("la:text-muted-foreground", e),
|
|
194
|
+
...t
|
|
195
|
+
});
|
|
196
|
+
}
|
|
169
197
|
//#endregion
|
|
170
198
|
//#region src/time-range.ts
|
|
171
|
-
var
|
|
199
|
+
var me = [
|
|
172
200
|
{
|
|
173
201
|
minutes: 5,
|
|
174
202
|
label: "Last 5 minutes"
|
|
@@ -193,11 +221,11 @@ var ae = [
|
|
|
193
221
|
minutes: 10080,
|
|
194
222
|
label: "Last 7 days"
|
|
195
223
|
}
|
|
196
|
-
],
|
|
224
|
+
], z = {
|
|
197
225
|
kind: "relative",
|
|
198
226
|
minutes: 60
|
|
199
227
|
};
|
|
200
|
-
function
|
|
228
|
+
function B(e, t) {
|
|
201
229
|
switch (e.kind) {
|
|
202
230
|
case "relative": return { fromMs: Math.floor((t - e.minutes * 6e4) / 6e4) * 6e4 };
|
|
203
231
|
case "absolute": return {
|
|
@@ -207,24 +235,24 @@ function L(e, t) {
|
|
|
207
235
|
case "all": return {};
|
|
208
236
|
}
|
|
209
237
|
}
|
|
210
|
-
function
|
|
238
|
+
function V(e) {
|
|
211
239
|
switch (e.kind) {
|
|
212
|
-
case "relative": return
|
|
213
|
-
case "absolute": return `${
|
|
240
|
+
case "relative": return me.find((t) => t.minutes === e.minutes)?.label ?? `Last ${e.minutes} minutes`;
|
|
241
|
+
case "absolute": return `${ge(e.fromMs, e.toMs)} – ${ge(e.toMs, e.fromMs)}`;
|
|
214
242
|
case "all": return "All retained";
|
|
215
243
|
}
|
|
216
244
|
}
|
|
217
|
-
function
|
|
245
|
+
function H(e) {
|
|
218
246
|
switch (e.kind) {
|
|
219
|
-
case "relative": return `in the ${
|
|
220
|
-
case "absolute": return `between ${
|
|
247
|
+
case "relative": return `in the ${V(e).toLocaleLowerCase()}`;
|
|
248
|
+
case "absolute": return `between ${V(e)}`;
|
|
221
249
|
case "all": return "in retained history";
|
|
222
250
|
}
|
|
223
251
|
}
|
|
224
|
-
function
|
|
252
|
+
function he(e, t) {
|
|
225
253
|
return e.kind === t.kind && (e.kind !== "relative" || e.minutes === t.minutes) && (e.kind !== "absolute" || e.fromMs === t.fromMs && e.toMs === t.toMs);
|
|
226
254
|
}
|
|
227
|
-
function
|
|
255
|
+
function ge(e, t) {
|
|
228
256
|
let n = new Date(e), r = n.toDateString() === new Date(t).toDateString(), i = n.toLocaleTimeString([], {
|
|
229
257
|
hour: "2-digit",
|
|
230
258
|
minute: "2-digit",
|
|
@@ -237,45 +265,45 @@ function se(e, t) {
|
|
|
237
265
|
}
|
|
238
266
|
//#endregion
|
|
239
267
|
//#region src/TimeRangePicker.tsx
|
|
240
|
-
function
|
|
241
|
-
let [o,
|
|
242
|
-
t(e),
|
|
268
|
+
function _e({ value: e, onChange: t, allowAll: n = !0, className: r, align: i = "end" }) {
|
|
269
|
+
let [o, s] = a(!1), [c, l] = a(() => ye(e)), [f, p] = a(!1), m = (e) => {
|
|
270
|
+
t(e), s(!1);
|
|
243
271
|
};
|
|
244
|
-
return /* @__PURE__ */
|
|
272
|
+
return /* @__PURE__ */ A(se, {
|
|
245
273
|
open: o,
|
|
246
274
|
onOpenChange: (t) => {
|
|
247
|
-
t && (
|
|
275
|
+
t && (l(ye(e)), p(!1)), s(t);
|
|
248
276
|
},
|
|
249
|
-
children: [/* @__PURE__ */
|
|
277
|
+
children: [/* @__PURE__ */ k(ce, {
|
|
250
278
|
asChild: !0,
|
|
251
|
-
children: /* @__PURE__ */
|
|
279
|
+
children: /* @__PURE__ */ A(L, {
|
|
252
280
|
type: "button",
|
|
253
281
|
variant: "outline",
|
|
254
282
|
className: r,
|
|
255
|
-
"aria-label": `Time range: ${
|
|
283
|
+
"aria-label": `Time range: ${V(e)}`,
|
|
256
284
|
children: [
|
|
257
|
-
/* @__PURE__ */
|
|
258
|
-
/* @__PURE__ */
|
|
285
|
+
/* @__PURE__ */ k(u, { "aria-hidden": "true" }),
|
|
286
|
+
/* @__PURE__ */ k("span", {
|
|
259
287
|
className: "la:truncate la:tabular-nums",
|
|
260
|
-
children:
|
|
288
|
+
children: V(e)
|
|
261
289
|
}),
|
|
262
|
-
/* @__PURE__ */
|
|
290
|
+
/* @__PURE__ */ k(d, {
|
|
263
291
|
"aria-hidden": "true",
|
|
264
292
|
className: "la:text-muted-foreground"
|
|
265
293
|
})
|
|
266
294
|
]
|
|
267
295
|
})
|
|
268
|
-
}), /* @__PURE__ */
|
|
296
|
+
}), /* @__PURE__ */ A(le, {
|
|
269
297
|
align: i,
|
|
270
298
|
"aria-label": "Time range",
|
|
271
299
|
className: "la:flex la:w-auto la:p-0 la:text-sm",
|
|
272
|
-
children: [/* @__PURE__ */
|
|
300
|
+
children: [/* @__PURE__ */ A("div", {
|
|
273
301
|
className: "la:flex la:flex-col la:gap-0.5 la:border-r la:p-2",
|
|
274
302
|
role: "group",
|
|
275
303
|
"aria-label": "Preset ranges",
|
|
276
|
-
children: [
|
|
304
|
+
children: [me.map((t) => /* @__PURE__ */ k(ve, {
|
|
277
305
|
label: t.label,
|
|
278
|
-
selected:
|
|
306
|
+
selected: he(e, {
|
|
279
307
|
kind: "relative",
|
|
280
308
|
minutes: t.minutes
|
|
281
309
|
}),
|
|
@@ -283,17 +311,17 @@ function B({ value: e, onChange: t, allowAll: n = !0, className: r, align: i = "
|
|
|
283
311
|
kind: "relative",
|
|
284
312
|
minutes: t.minutes
|
|
285
313
|
})
|
|
286
|
-
}, t.minutes)), n && /* @__PURE__ */
|
|
314
|
+
}, t.minutes)), n && /* @__PURE__ */ k(ve, {
|
|
287
315
|
label: "All retained",
|
|
288
316
|
selected: e.kind === "all",
|
|
289
317
|
onSelect: () => m({ kind: "all" })
|
|
290
318
|
})]
|
|
291
|
-
}), /* @__PURE__ */
|
|
319
|
+
}), /* @__PURE__ */ A("form", {
|
|
292
320
|
className: "la:flex la:w-[22rem] la:flex-col",
|
|
293
321
|
"aria-label": "Custom range",
|
|
294
322
|
onSubmit: (e) => {
|
|
295
323
|
e.preventDefault();
|
|
296
|
-
let t =
|
|
324
|
+
let t = be(c);
|
|
297
325
|
if (!t) {
|
|
298
326
|
p(!0);
|
|
299
327
|
return;
|
|
@@ -301,61 +329,61 @@ function B({ value: e, onChange: t, allowAll: n = !0, className: r, align: i = "
|
|
|
301
329
|
p(!1), m(t);
|
|
302
330
|
},
|
|
303
331
|
children: [
|
|
304
|
-
/* @__PURE__ */
|
|
332
|
+
/* @__PURE__ */ k(ae, {
|
|
305
333
|
mode: "range",
|
|
306
334
|
numberOfMonths: 1,
|
|
307
|
-
defaultMonth:
|
|
308
|
-
selected:
|
|
309
|
-
onSelect: (e) =>
|
|
335
|
+
defaultMonth: c.dates?.to ?? c.dates?.from,
|
|
336
|
+
selected: c.dates,
|
|
337
|
+
onSelect: (e) => l((t) => ({
|
|
310
338
|
...t,
|
|
311
339
|
dates: e
|
|
312
340
|
})),
|
|
313
341
|
disabled: { after: /* @__PURE__ */ new Date() }
|
|
314
342
|
}),
|
|
315
|
-
/* @__PURE__ */
|
|
343
|
+
/* @__PURE__ */ A("div", {
|
|
316
344
|
className: "la:flex la:items-end la:gap-2 la:border-t la:px-3 la:py-3",
|
|
317
345
|
children: [
|
|
318
|
-
/* @__PURE__ */
|
|
346
|
+
/* @__PURE__ */ A("label", {
|
|
319
347
|
className: "la:grid la:gap-1 la:text-xs la:text-muted-foreground",
|
|
320
|
-
children: ["From", /* @__PURE__ */
|
|
348
|
+
children: ["From", /* @__PURE__ */ k(R, {
|
|
321
349
|
type: "time",
|
|
322
350
|
name: "from",
|
|
323
351
|
required: !0,
|
|
324
352
|
className: "la:h-8 la:w-24 la:tabular-nums",
|
|
325
|
-
value:
|
|
326
|
-
onChange: (e) =>
|
|
327
|
-
...
|
|
353
|
+
value: c.fromTime,
|
|
354
|
+
onChange: (e) => l({
|
|
355
|
+
...c,
|
|
328
356
|
fromTime: e.target.value
|
|
329
357
|
}),
|
|
330
358
|
"aria-invalid": f || void 0
|
|
331
359
|
})]
|
|
332
360
|
}),
|
|
333
|
-
/* @__PURE__ */
|
|
361
|
+
/* @__PURE__ */ A("label", {
|
|
334
362
|
className: "la:grid la:gap-1 la:text-xs la:text-muted-foreground",
|
|
335
|
-
children: ["To", /* @__PURE__ */
|
|
363
|
+
children: ["To", /* @__PURE__ */ k(R, {
|
|
336
364
|
type: "time",
|
|
337
365
|
name: "to",
|
|
338
366
|
required: !0,
|
|
339
367
|
className: "la:h-8 la:w-24 la:tabular-nums",
|
|
340
|
-
value:
|
|
341
|
-
onChange: (e) =>
|
|
342
|
-
...
|
|
368
|
+
value: c.toTime,
|
|
369
|
+
onChange: (e) => l({
|
|
370
|
+
...c,
|
|
343
371
|
toTime: e.target.value
|
|
344
372
|
}),
|
|
345
373
|
"aria-invalid": f || void 0
|
|
346
374
|
})]
|
|
347
375
|
}),
|
|
348
|
-
/* @__PURE__ */
|
|
376
|
+
/* @__PURE__ */ k(L, {
|
|
349
377
|
type: "submit",
|
|
350
378
|
variant: "outline",
|
|
351
379
|
size: "sm",
|
|
352
380
|
className: "la:ml-auto",
|
|
353
|
-
disabled: !
|
|
381
|
+
disabled: !c.dates?.from,
|
|
354
382
|
children: "Apply range"
|
|
355
383
|
})
|
|
356
384
|
]
|
|
357
385
|
}),
|
|
358
|
-
f && /* @__PURE__ */
|
|
386
|
+
f && /* @__PURE__ */ k("p", {
|
|
359
387
|
className: "la:px-3 la:pb-3 la:text-xs la:text-danger",
|
|
360
388
|
role: "alert",
|
|
361
389
|
children: "From must be before To."
|
|
@@ -365,8 +393,8 @@ function B({ value: e, onChange: t, allowAll: n = !0, className: r, align: i = "
|
|
|
365
393
|
})]
|
|
366
394
|
});
|
|
367
395
|
}
|
|
368
|
-
function
|
|
369
|
-
return /* @__PURE__ */
|
|
396
|
+
function ve({ label: e, selected: t, onSelect: n }) {
|
|
397
|
+
return /* @__PURE__ */ k(L, {
|
|
370
398
|
type: "button",
|
|
371
399
|
variant: t ? "secondary" : "ghost",
|
|
372
400
|
size: "sm",
|
|
@@ -376,71 +404,71 @@ function ce({ label: e, selected: t, onSelect: n }) {
|
|
|
376
404
|
children: e
|
|
377
405
|
});
|
|
378
406
|
}
|
|
379
|
-
function
|
|
380
|
-
let t = Date.now(), n =
|
|
407
|
+
function ye(e) {
|
|
408
|
+
let t = Date.now(), n = B(e, t), r = new Date(n.fromMs ?? t - 36e5), i = new Date(n.toMs ?? t);
|
|
381
409
|
return {
|
|
382
410
|
dates: {
|
|
383
|
-
from:
|
|
384
|
-
to:
|
|
411
|
+
from: xe(r),
|
|
412
|
+
to: xe(i)
|
|
385
413
|
},
|
|
386
|
-
fromTime:
|
|
387
|
-
toTime:
|
|
414
|
+
fromTime: Se(r),
|
|
415
|
+
toTime: Se(i)
|
|
388
416
|
};
|
|
389
417
|
}
|
|
390
|
-
function
|
|
418
|
+
function be(e) {
|
|
391
419
|
let t = e.dates?.from, n = e.dates?.to ?? t;
|
|
392
420
|
if (!t || !n) return null;
|
|
393
|
-
let r =
|
|
421
|
+
let r = Ce(t, e.fromTime), i = Ce(n, e.toTime);
|
|
394
422
|
return Number.isFinite(r) && Number.isFinite(i) && r < i ? {
|
|
395
423
|
kind: "absolute",
|
|
396
424
|
fromMs: r,
|
|
397
425
|
toMs: i
|
|
398
426
|
} : null;
|
|
399
427
|
}
|
|
400
|
-
function
|
|
428
|
+
function xe(e) {
|
|
401
429
|
return new Date(e.getFullYear(), e.getMonth(), e.getDate());
|
|
402
430
|
}
|
|
403
|
-
function
|
|
431
|
+
function Se(e) {
|
|
404
432
|
return `${String(e.getHours()).padStart(2, "0")}:${String(e.getMinutes()).padStart(2, "0")}`;
|
|
405
433
|
}
|
|
406
|
-
function
|
|
434
|
+
function Ce(e, t) {
|
|
407
435
|
let [n, r] = t.split(":").map(Number);
|
|
408
436
|
return new Date(e.getFullYear(), e.getMonth(), e.getDate(), n ?? 0, r ?? 0).getTime();
|
|
409
437
|
}
|
|
410
438
|
//#endregion
|
|
411
439
|
//#region src/components/ui/badge.tsx
|
|
412
|
-
var
|
|
440
|
+
var we = T("la:inline-flex la:items-center la:justify-center la:gap-1.5 la:rounded-md la:border la:px-2 la:py-0.5 la:text-xs la:font-medium la:whitespace-nowrap", {
|
|
413
441
|
variants: { variant: {
|
|
414
442
|
default: "la:border-transparent la:bg-muted la:text-muted-foreground",
|
|
415
443
|
outline: "la:border-border la:text-muted-foreground"
|
|
416
444
|
} },
|
|
417
445
|
defaultVariants: { variant: "default" }
|
|
418
446
|
});
|
|
419
|
-
function
|
|
420
|
-
return /* @__PURE__ */
|
|
447
|
+
function U({ className: e, variant: t, ...n }) {
|
|
448
|
+
return /* @__PURE__ */ k("span", {
|
|
421
449
|
"data-slot": "badge",
|
|
422
|
-
className:
|
|
450
|
+
className: I(we({ variant: t }), e),
|
|
423
451
|
...n
|
|
424
452
|
});
|
|
425
453
|
}
|
|
426
454
|
//#endregion
|
|
427
455
|
//#region src/components/ui/sheet.tsx
|
|
428
|
-
var
|
|
429
|
-
function
|
|
430
|
-
return /* @__PURE__ */
|
|
456
|
+
var Te = P.Root, Ee = P.Title, De = P.Description;
|
|
457
|
+
function Oe({ className: e, children: t, container: n, ...r }) {
|
|
458
|
+
return /* @__PURE__ */ A(P.Portal, {
|
|
431
459
|
container: n,
|
|
432
|
-
children: [/* @__PURE__ */
|
|
460
|
+
children: [/* @__PURE__ */ k(P.Overlay, { className: "la-sheet-overlay" }), /* @__PURE__ */ A(P.Content, {
|
|
433
461
|
"data-slot": "sheet-content",
|
|
434
|
-
className:
|
|
462
|
+
className: I("la-observer la-sheet", e),
|
|
435
463
|
...r,
|
|
436
|
-
children: [t, /* @__PURE__ */
|
|
464
|
+
children: [t, /* @__PURE__ */ k(P.Close, {
|
|
437
465
|
asChild: !0,
|
|
438
|
-
children: /* @__PURE__ */
|
|
466
|
+
children: /* @__PURE__ */ k(L, {
|
|
439
467
|
className: "la-sheet-close",
|
|
440
468
|
variant: "ghost",
|
|
441
469
|
size: "icon",
|
|
442
470
|
"aria-label": "Close",
|
|
443
|
-
children: /* @__PURE__ */
|
|
471
|
+
children: /* @__PURE__ */ k(C, { "aria-hidden": "true" })
|
|
444
472
|
})
|
|
445
473
|
})]
|
|
446
474
|
})]
|
|
@@ -448,55 +476,69 @@ function ve({ className: e, children: t, container: n, ...r }) {
|
|
|
448
476
|
}
|
|
449
477
|
//#endregion
|
|
450
478
|
//#region src/components/ui/table.tsx
|
|
451
|
-
function
|
|
452
|
-
return /* @__PURE__ */
|
|
479
|
+
function W({ className: e, ...t }) {
|
|
480
|
+
return /* @__PURE__ */ k("div", {
|
|
453
481
|
"data-slot": "table-container",
|
|
454
482
|
className: "la:relative la:w-full la:overflow-x-auto",
|
|
455
|
-
children: /* @__PURE__ */
|
|
483
|
+
children: /* @__PURE__ */ k("table", {
|
|
456
484
|
"data-slot": "table",
|
|
457
|
-
className:
|
|
485
|
+
className: I("la:w-full la:caption-bottom la:text-sm la:tabular-nums", e),
|
|
458
486
|
...t
|
|
459
487
|
})
|
|
460
488
|
});
|
|
461
489
|
}
|
|
462
|
-
function
|
|
463
|
-
return /* @__PURE__ */
|
|
490
|
+
function G({ className: e, ...t }) {
|
|
491
|
+
return /* @__PURE__ */ k("thead", {
|
|
464
492
|
"data-slot": "table-header",
|
|
465
|
-
className:
|
|
493
|
+
className: I("la:[&_tr]:border-b", e),
|
|
466
494
|
...t
|
|
467
495
|
});
|
|
468
496
|
}
|
|
469
|
-
function
|
|
470
|
-
return /* @__PURE__ */
|
|
497
|
+
function K({ className: e, ...t }) {
|
|
498
|
+
return /* @__PURE__ */ k("tbody", {
|
|
471
499
|
"data-slot": "table-body",
|
|
472
|
-
className:
|
|
500
|
+
className: I("la:[&_tr:last-child]:border-0", e),
|
|
473
501
|
...t
|
|
474
502
|
});
|
|
475
503
|
}
|
|
476
|
-
function
|
|
477
|
-
return /* @__PURE__ */
|
|
504
|
+
function ke({ className: e, ...t }) {
|
|
505
|
+
return /* @__PURE__ */ k("tfoot", {
|
|
506
|
+
"data-slot": "table-footer",
|
|
507
|
+
className: I("la:bg-muted/50 la:border-t la:font-medium la:[&>tr]:last:border-b-0", e),
|
|
508
|
+
...t
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
function q({ className: e, ...t }) {
|
|
512
|
+
return /* @__PURE__ */ k("tr", {
|
|
478
513
|
"data-slot": "table-row",
|
|
479
|
-
className:
|
|
514
|
+
className: I("la:border-b la:transition-colors la:duration-150 la:hover:bg-muted/60 la:data-[state=selected]:bg-muted", e),
|
|
480
515
|
...t
|
|
481
516
|
});
|
|
482
517
|
}
|
|
483
|
-
function
|
|
484
|
-
return /* @__PURE__ */
|
|
518
|
+
function J({ className: e, ...t }) {
|
|
519
|
+
return /* @__PURE__ */ k("th", {
|
|
485
520
|
"data-slot": "table-head",
|
|
486
|
-
className:
|
|
521
|
+
className: I("la:h-10 la:whitespace-nowrap la:px-3 la:text-left la:align-middle la:text-xs la:font-medium la:text-muted-foreground la:[&:has([role=checkbox])]:pr-0 la:[&>[role=checkbox]]:translate-y-[2px]", e),
|
|
487
522
|
...t
|
|
488
523
|
});
|
|
489
524
|
}
|
|
490
|
-
function
|
|
491
|
-
return /* @__PURE__ */
|
|
525
|
+
function Y({ className: e, ...t }) {
|
|
526
|
+
return /* @__PURE__ */ k("td", {
|
|
492
527
|
"data-slot": "table-cell",
|
|
493
|
-
className:
|
|
528
|
+
className: I("la:whitespace-nowrap la:px-3 la:py-2.5 la:align-middle la:[&:has([role=checkbox])]:pr-0 la:[&>[role=checkbox]]:translate-y-[2px]", e),
|
|
529
|
+
...t
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
function Ae({ className: e, ...t }) {
|
|
533
|
+
return /* @__PURE__ */ k("caption", {
|
|
534
|
+
"data-slot": "table-caption",
|
|
535
|
+
className: I("la:text-muted-foreground la:mt-4 la:text-sm", e),
|
|
494
536
|
...t
|
|
495
537
|
});
|
|
496
538
|
}
|
|
497
539
|
//#endregion
|
|
498
540
|
//#region src/observer-hooks.ts
|
|
499
|
-
function
|
|
541
|
+
function je(e) {
|
|
500
542
|
let [n, r] = a(0), [i, o] = a(), [s, c] = a(!0), [l, u] = a(!1);
|
|
501
543
|
return t(() => {
|
|
502
544
|
let t = new AbortController(), n, r = 1e3;
|
|
@@ -529,7 +571,7 @@ function ye(e) {
|
|
|
529
571
|
retry: () => r((e) => e + 1)
|
|
530
572
|
};
|
|
531
573
|
}
|
|
532
|
-
function
|
|
574
|
+
function Me(e, n = !0) {
|
|
533
575
|
let [r, i] = a(), [o, s] = a(!1), [c, l] = a(0);
|
|
534
576
|
return t(() => i(void 0), [e]), t(() => {
|
|
535
577
|
if (!n) return;
|
|
@@ -538,7 +580,7 @@ function be(e, n = !0) {
|
|
|
538
580
|
try {
|
|
539
581
|
if (!e.watchRequests) throw Error("Request traces unavailable");
|
|
540
582
|
if (await e.watchRequests((e) => {
|
|
541
|
-
r.signal.aborted || (t = e.resumeCursor, i((t) =>
|
|
583
|
+
r.signal.aborted || (t = e.resumeCursor, i((t) => Ne(t, e)), s(!1), o = 1e3);
|
|
542
584
|
}, r.signal, t), !r.signal.aborted) throw Error("Request stream disconnected");
|
|
543
585
|
} catch {
|
|
544
586
|
r.signal.aborted || s(!0);
|
|
@@ -559,7 +601,7 @@ function be(e, n = !0) {
|
|
|
559
601
|
retry: () => l((e) => e + 1)
|
|
560
602
|
};
|
|
561
603
|
}
|
|
562
|
-
function
|
|
604
|
+
function Ne(e, t) {
|
|
563
605
|
let n = new Map((e?.epoch === t.epoch && !t.reset ? e.records : []).map((e) => [e.eventId ?? e.sequence, e]));
|
|
564
606
|
for (let e of t.records) n.set(e.eventId ?? e.sequence, e);
|
|
565
607
|
return {
|
|
@@ -568,269 +610,50 @@ function xe(e, t) {
|
|
|
568
610
|
records: [...n.values()].sort((e, t) => t.sequence - e.sequence).slice(0, t.capacity)
|
|
569
611
|
};
|
|
570
612
|
}
|
|
571
|
-
function
|
|
572
|
-
let
|
|
573
|
-
c.current = r;
|
|
574
|
-
let [l, u] = a(0), [d, f] = a(), [p, m] = a(!1), [h, g] = a(!1);
|
|
613
|
+
function Pe(e, n, r, i = 1e4) {
|
|
614
|
+
let o = r ? JSON.stringify(n) : void 0, [s, c] = a(0), [l, u] = a(), [d, f] = a(!1), [p, m] = a(!1);
|
|
575
615
|
t(() => {
|
|
576
|
-
if (!
|
|
616
|
+
if (!o) return;
|
|
577
617
|
let t = new AbortController(), n;
|
|
578
|
-
return
|
|
618
|
+
return f(!1), m(!0), a(), () => {
|
|
579
619
|
t.abort(), clearTimeout(n);
|
|
580
620
|
};
|
|
581
|
-
async function
|
|
621
|
+
async function a() {
|
|
582
622
|
try {
|
|
583
|
-
let n =
|
|
623
|
+
let n = await r.call(e, JSON.parse(o), t.signal);
|
|
584
624
|
if (t.signal.aborted) return;
|
|
585
|
-
|
|
586
|
-
client: e
|
|
587
|
-
key:
|
|
625
|
+
u({
|
|
626
|
+
client: e,
|
|
627
|
+
key: o,
|
|
588
628
|
value: n,
|
|
589
629
|
updatedAt: Date.now()
|
|
590
|
-
}),
|
|
630
|
+
}), f(!1);
|
|
591
631
|
} catch {
|
|
592
|
-
t.signal.aborted ||
|
|
632
|
+
t.signal.aborted || f(!0);
|
|
593
633
|
} finally {
|
|
594
|
-
t.signal.aborted || (
|
|
634
|
+
t.signal.aborted || (m(!1), n = setTimeout(a, i));
|
|
595
635
|
}
|
|
596
636
|
}
|
|
597
637
|
}, [
|
|
598
638
|
e,
|
|
639
|
+
r,
|
|
640
|
+
o,
|
|
599
641
|
s,
|
|
600
|
-
|
|
601
|
-
o
|
|
642
|
+
i
|
|
602
643
|
]);
|
|
603
|
-
let
|
|
604
|
-
return {
|
|
605
|
-
supported: !!e.query,
|
|
606
|
-
value: _?.value,
|
|
607
|
-
updatedAt: _?.updatedAt,
|
|
608
|
-
loading: h,
|
|
609
|
-
failed: p,
|
|
610
|
-
retry: () => u((e) => e + 1)
|
|
611
|
-
};
|
|
612
|
-
}
|
|
613
|
-
//#endregion
|
|
614
|
-
//#region src/client.ts
|
|
615
|
-
var Ce = class {
|
|
616
|
-
baseUrl;
|
|
617
|
-
request;
|
|
618
|
-
constructor(e = "/api/observe", t = globalThis.fetch.bind(globalThis)) {
|
|
619
|
-
this.baseUrl = e, this.request = t;
|
|
620
|
-
}
|
|
621
|
-
async listActors(e) {
|
|
622
|
-
let t = await this.get("actors", e);
|
|
623
|
-
if (!we(t)) throw Error("Invalid actor inventory response.");
|
|
624
|
-
return t;
|
|
625
|
-
}
|
|
626
|
-
async watchActors(e, t) {
|
|
627
|
-
return this.watch("events", "inventory", we, e, t);
|
|
628
|
-
}
|
|
629
|
-
async watchRequests(e, t, n) {
|
|
630
|
-
let r = n ? `?${new URLSearchParams({ after: n })}` : "";
|
|
631
|
-
return this.watch(`requests/events${r}`, "requests", De, e, t);
|
|
632
|
-
}
|
|
633
|
-
async query(e, t) {
|
|
634
|
-
let n = await this.request(`${this.baseUrl.replace(/\/$/u, "")}/query`, {
|
|
635
|
-
method: "POST",
|
|
636
|
-
credentials: "same-origin",
|
|
637
|
-
redirect: "error",
|
|
638
|
-
signal: t,
|
|
639
|
-
headers: {
|
|
640
|
-
"content-type": "application/json",
|
|
641
|
-
accept: "application/json"
|
|
642
|
-
},
|
|
643
|
-
body: JSON.stringify(e)
|
|
644
|
-
});
|
|
645
|
-
if (!n.ok) throw Error(`Observability query failed (HTTP ${n.status}).`);
|
|
646
|
-
let r = await n.json();
|
|
647
|
-
if (!r || typeof r != "object" || !("rows" in r) || !Array.isArray(r.rows) || r.rows.length > 500 || !("truncated" in r) || typeof r.truncated != "boolean" || !r.rows.every((e) => e && typeof e == "object" && !Array.isArray(e) && Object.values(e).every((e) => e === null || [
|
|
648
|
-
"string",
|
|
649
|
-
"boolean",
|
|
650
|
-
"number"
|
|
651
|
-
].includes(typeof e)))) throw Error("Invalid SQL query response");
|
|
652
|
-
return r;
|
|
653
|
-
}
|
|
654
|
-
async watch(e, t, n, r, i) {
|
|
655
|
-
let a = await this.request(`${this.baseUrl.replace(/\/$/u, "")}/${e}`, {
|
|
656
|
-
signal: i,
|
|
657
|
-
credentials: "same-origin",
|
|
658
|
-
redirect: "error",
|
|
659
|
-
headers: { accept: "text/event-stream" }
|
|
660
|
-
});
|
|
661
|
-
if (!a.ok || !a.headers.get("content-type")?.startsWith("text/event-stream") || !a.body) throw await a.body?.cancel(), Error("Live inventory is unavailable");
|
|
662
|
-
let o = a.body.getReader(), s = new TextDecoder(), c = A({ onEvent(e) {
|
|
663
|
-
if (i.aborted) return;
|
|
664
|
-
if (e.event === "error") throw Error("Live inventory is unavailable");
|
|
665
|
-
if (e.event !== t) return;
|
|
666
|
-
let a = JSON.parse(e.data);
|
|
667
|
-
if (!n(a)) throw Error("Invalid observer response");
|
|
668
|
-
r(a);
|
|
669
|
-
} }), l = () => {
|
|
670
|
-
o.cancel().catch(() => {});
|
|
671
|
-
};
|
|
672
|
-
i.addEventListener("abort", l, { once: !0 });
|
|
673
|
-
try {
|
|
674
|
-
for (; !i.aborted;) {
|
|
675
|
-
let { value: e, done: t } = await o.read();
|
|
676
|
-
if (t) break;
|
|
677
|
-
c.feed(s.decode(e, { stream: !0 }));
|
|
678
|
-
}
|
|
679
|
-
if (!i.aborted) throw Error("Live inventory disconnected");
|
|
680
|
-
} finally {
|
|
681
|
-
i.removeEventListener("abort", l), await o.cancel().catch(() => {}), o.releaseLock();
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
async checkConnection(e) {
|
|
685
|
-
let t = await this.get("connection", e);
|
|
686
|
-
if (!t || typeof t != "object" || !("connected" in t) || t.connected !== !0) throw Error("Invalid connection response.");
|
|
687
|
-
}
|
|
688
|
-
async get(e, t) {
|
|
689
|
-
let n = await this.request(`${this.baseUrl.replace(/\/$/u, "")}/${e}`, {
|
|
690
|
-
method: "GET",
|
|
691
|
-
credentials: "same-origin",
|
|
692
|
-
redirect: "error",
|
|
693
|
-
signal: t,
|
|
694
|
-
headers: { accept: "application/json" }
|
|
695
|
-
});
|
|
696
|
-
if (!n.ok) throw Error(`Connection check failed (HTTP ${n.status}).`);
|
|
697
|
-
return n.json();
|
|
698
|
-
}
|
|
699
|
-
};
|
|
700
|
-
function we(e) {
|
|
701
|
-
return !e || typeof e != "object" || !("actors" in e) || !Array.isArray(e.actors) ? !1 : e.actors.every((e) => e && typeof e.actorName == "string" && [
|
|
702
|
-
e.live,
|
|
703
|
-
e.dormant,
|
|
704
|
-
e.unknown
|
|
705
|
-
].every((e) => Number.isSafeInteger(e) && e >= 0) && Array.isArray(e.instances) && e.instances.every(Te));
|
|
706
|
-
}
|
|
707
|
-
function Te(e) {
|
|
708
|
-
return !!e && typeof e == "object" && "actorId" in e && typeof e.actorId == "string" && "status" in e && [
|
|
709
|
-
"live",
|
|
710
|
-
"dormant",
|
|
711
|
-
"unknown"
|
|
712
|
-
].includes(String(e.status)) && "connections" in e && Array.isArray(e.connections) && e.connections.every(Ee) && (!("waiting" in e) || e.waiting == null || Array.isArray(e.waiting) && e.waiting.every((e) => !!e && typeof e == "object" && typeof e.id == "string" && typeof e.operation == "string"));
|
|
713
|
-
}
|
|
714
|
-
function Ee(e) {
|
|
715
|
-
return !!e && typeof e == "object" && "id" in e && typeof e.id == "string" && "metadata" in e;
|
|
716
|
-
}
|
|
717
|
-
function De(e) {
|
|
718
|
-
if (!e || typeof e != "object") return !1;
|
|
719
|
-
let t = e;
|
|
720
|
-
return typeof t.epoch == "string" && [
|
|
721
|
-
t.cursor,
|
|
722
|
-
t.capacity,
|
|
723
|
-
t.evicted,
|
|
724
|
-
t.dropped
|
|
725
|
-
].every(J) && (t.persistenceFailed === void 0 || typeof t.persistenceFailed == "boolean") && (t.nextCursor == null || typeof t.nextCursor == "string") && (t.resumeCursor === void 0 || typeof t.resumeCursor == "string") && (t.reset === void 0 || typeof t.reset == "boolean") && t.capacity > 0 && t.capacity <= 500 && Array.isArray(t.records) && t.records.length <= t.capacity && t.records.every((e) => Oe(e) && e.sequence <= t.cursor);
|
|
726
|
-
}
|
|
727
|
-
function J(e) {
|
|
728
|
-
return Number.isSafeInteger(e) && Number(e) >= 0;
|
|
729
|
-
}
|
|
730
|
-
function Oe(e) {
|
|
731
|
-
if (!e || typeof e != "object") return !1;
|
|
732
|
-
let t = e;
|
|
733
|
-
return [
|
|
734
|
-
t.requestId,
|
|
735
|
-
t.hostId,
|
|
736
|
-
t.sessionId,
|
|
737
|
-
t.actorName,
|
|
738
|
-
t.actorId,
|
|
739
|
-
t.operation
|
|
740
|
-
].every((e) => typeof e == "string") && (t.eventId === void 0 || typeof t.eventId == "string" && t.eventId.length > 0) && J(t.sequence) && J(t.startedAtMs) && t.startedAtMs <= 864e13 && ["method", "websocket"].includes(t.kind) && [
|
|
741
|
-
"completed",
|
|
742
|
-
"failed",
|
|
743
|
-
"rejected",
|
|
744
|
-
"rerouted",
|
|
745
|
-
"interrupted"
|
|
746
|
-
].includes(t.outcome) && (t.connectionId === null || typeof t.connectionId == "string") && Number.isFinite(t.durationMs) && t.durationMs >= 0 && (t.queueWaitMs === null || Number.isFinite(t.queueWaitMs) && t.queueWaitMs >= 0 && t.queueWaitMs <= t.durationMs);
|
|
747
|
-
}
|
|
748
|
-
//#endregion
|
|
749
|
-
//#region src/request-sql.ts
|
|
750
|
-
var Y = 100;
|
|
751
|
-
function ke(e, t) {
|
|
752
|
-
let n = [], r = [];
|
|
753
|
-
for (let [t, i, a] of [
|
|
754
|
-
[
|
|
755
|
-
"started_at_ms",
|
|
756
|
-
">=",
|
|
757
|
-
e.fromMs
|
|
758
|
-
],
|
|
759
|
-
[
|
|
760
|
-
"started_at_ms",
|
|
761
|
-
"<=",
|
|
762
|
-
e.toMs
|
|
763
|
-
],
|
|
764
|
-
[
|
|
765
|
-
"actor_name",
|
|
766
|
-
"=",
|
|
767
|
-
e.actorName
|
|
768
|
-
],
|
|
769
|
-
[
|
|
770
|
-
"actor_id",
|
|
771
|
-
"=",
|
|
772
|
-
e.actorId
|
|
773
|
-
],
|
|
774
|
-
[
|
|
775
|
-
"outcome",
|
|
776
|
-
"=",
|
|
777
|
-
e.outcome
|
|
778
|
-
]
|
|
779
|
-
]) a !== void 0 && (n.push(`${t} ${i} ?`), r.push(a));
|
|
780
|
-
if (t) {
|
|
781
|
-
let e = JSON.parse(t);
|
|
782
|
-
n.push("sequence <= ?", "(started_at_ms, sequence) < (?, ?)"), r.push(e.watermark, e.time, e.sequence);
|
|
783
|
-
}
|
|
784
|
-
return {
|
|
785
|
-
sql: `SELECT h.generation, h.watermark, h.pruned, h.total, r.sequence, r.event
|
|
786
|
-
FROM request_history h LEFT JOIN (
|
|
787
|
-
SELECT sequence, event, started_at_ms FROM request_events
|
|
788
|
-
${n.length ? `WHERE ${n.join(" AND ")}` : ""}
|
|
789
|
-
ORDER BY started_at_ms DESC, sequence DESC LIMIT 101
|
|
790
|
-
) r ON 1 = 1
|
|
791
|
-
ORDER BY r.started_at_ms DESC, r.sequence DESC`,
|
|
792
|
-
params: r
|
|
793
|
-
};
|
|
794
|
-
}
|
|
795
|
-
function Ae(e, t) {
|
|
796
|
-
if (e.truncated) throw Error("History query exceeded the server result limit");
|
|
797
|
-
let n = e.rows[0];
|
|
798
|
-
if (!n || typeof n.generation != "string" || ![
|
|
799
|
-
n.watermark,
|
|
800
|
-
n.pruned,
|
|
801
|
-
n.total
|
|
802
|
-
].every((e) => Number.isSafeInteger(e) && Number(e) >= 0)) throw Error("Invalid history metadata");
|
|
803
|
-
let r = t ? JSON.parse(t) : void 0, i = e.rows.filter((e) => e.sequence !== null).map((e) => {
|
|
804
|
-
if (typeof e.event != "string") throw Error("Invalid saved event");
|
|
805
|
-
let t = {
|
|
806
|
-
...JSON.parse(e.event),
|
|
807
|
-
sequence: e.sequence
|
|
808
|
-
};
|
|
809
|
-
if (!Oe(t)) throw Error("Invalid saved event");
|
|
810
|
-
return t;
|
|
811
|
-
}), a = i.length > Y;
|
|
812
|
-
i.length = Math.min(i.length, Y);
|
|
813
|
-
let o = i.at(-1), s = r?.watermark ?? Number(n.watermark);
|
|
644
|
+
let h = l && l.client === e && l.key === o ? l : void 0;
|
|
814
645
|
return {
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
reset: !!r && (r.generation !== n.generation || r.pruned < Number(n.pruned)),
|
|
822
|
-
nextCursor: a && o ? JSON.stringify({
|
|
823
|
-
watermark: s,
|
|
824
|
-
sequence: o.sequence,
|
|
825
|
-
time: o.startedAtMs,
|
|
826
|
-
generation: n.generation,
|
|
827
|
-
pruned: Number(n.pruned)
|
|
828
|
-
}) : null
|
|
646
|
+
supported: !!r,
|
|
647
|
+
value: h?.value,
|
|
648
|
+
updatedAt: h?.updatedAt,
|
|
649
|
+
loading: p,
|
|
650
|
+
failed: d,
|
|
651
|
+
retry: () => c((e) => e + 1)
|
|
829
652
|
};
|
|
830
653
|
}
|
|
831
654
|
//#endregion
|
|
832
655
|
//#region src/request-history.ts
|
|
833
|
-
function
|
|
656
|
+
function Fe(e, n) {
|
|
834
657
|
let [r, o] = a(), [s, c] = a(!1), [l, u] = a(!1), d = i(() => {});
|
|
835
658
|
return t(() => {
|
|
836
659
|
if (o(void 0), u(!1), c(!1), !n) return;
|
|
@@ -840,11 +663,14 @@ function je(e, n) {
|
|
|
840
663
|
};
|
|
841
664
|
async function i(i) {
|
|
842
665
|
try {
|
|
843
|
-
if (!e.
|
|
844
|
-
let r =
|
|
666
|
+
if (!e.listRequests) throw Error("History is unavailable");
|
|
667
|
+
let r = await e.listRequests({
|
|
668
|
+
...n,
|
|
669
|
+
cursor: i
|
|
670
|
+
}, t.signal);
|
|
845
671
|
if (t.signal.aborted) return;
|
|
846
672
|
o((e) => {
|
|
847
|
-
if (!i || !e || e.epoch !== r.epoch) return r;
|
|
673
|
+
if (!i || !e || r.reset || e.epoch !== r.epoch) return r;
|
|
848
674
|
let t = new Map(e.records.map((e) => [e.eventId ?? e.sequence, e]));
|
|
849
675
|
for (let e of r.records) t.set(e.eventId ?? e.sequence, e);
|
|
850
676
|
return {
|
|
@@ -870,164 +696,164 @@ function je(e, n) {
|
|
|
870
696
|
}
|
|
871
697
|
//#endregion
|
|
872
698
|
//#region src/RequestObserver.tsx
|
|
873
|
-
function
|
|
874
|
-
let [c, l] = a(), [u, d] = a(
|
|
699
|
+
function Ie({ client: e, actor: n, timeRange: o, onTimeRangeChange: s }) {
|
|
700
|
+
let [c, l] = a(), [u, d] = a(z), f = o ?? u, p = s ?? d, m = Fe(e, r(() => c ? {
|
|
875
701
|
...c,
|
|
876
702
|
...n,
|
|
877
|
-
...
|
|
703
|
+
...B(f, Date.now())
|
|
878
704
|
} : void 0, [
|
|
879
705
|
c,
|
|
880
706
|
n?.actorName,
|
|
881
707
|
n?.actorId,
|
|
882
708
|
f
|
|
883
|
-
])), { page:
|
|
709
|
+
])), { page: h, failed: g, retry: _ } = Me(e), [y, b] = a(), [x, S] = a(), C = i(null), w = i(null), T = n ? "h3" : "h1", E = c ? m.page : y ?? h, D = h ?? m.page, j = (E?.records ?? []).filter((e) => !n || e.actorName === n.actorName && e.actorId === n.actorId);
|
|
884
710
|
return t(() => {
|
|
885
|
-
|
|
711
|
+
b(void 0), l(void 0);
|
|
886
712
|
}, [
|
|
887
713
|
e,
|
|
888
714
|
n?.actorName,
|
|
889
715
|
n?.actorId
|
|
890
|
-
]), t(() =>
|
|
716
|
+
]), t(() => S(void 0), [
|
|
891
717
|
e,
|
|
892
|
-
|
|
718
|
+
h?.epoch,
|
|
893
719
|
c,
|
|
894
720
|
n?.actorName,
|
|
895
721
|
n?.actorId
|
|
896
|
-
]), /* @__PURE__ */
|
|
897
|
-
ref:
|
|
722
|
+
]), /* @__PURE__ */ A("section", {
|
|
723
|
+
ref: C,
|
|
898
724
|
className: "la-observer la-requests",
|
|
899
725
|
"aria-label": "Request observer",
|
|
900
726
|
children: [
|
|
901
|
-
/* @__PURE__ */
|
|
727
|
+
/* @__PURE__ */ A("div", {
|
|
902
728
|
className: "la-observer-toolbar",
|
|
903
|
-
children: [/* @__PURE__ */
|
|
729
|
+
children: [/* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k(T, { children: "Requests" }), /* @__PURE__ */ k("p", { children: n ? "Method calls and WebSocket events for this instance." : "Method calls and WebSocket events, with time spent waiting and processing." })] }), /* @__PURE__ */ A("div", {
|
|
904
730
|
className: "la-request-actions",
|
|
905
|
-
children: [e.
|
|
731
|
+
children: [e.listRequests && /* @__PURE__ */ A(O, { children: [/* @__PURE__ */ k(L, {
|
|
906
732
|
variant: c ? "outline" : "secondary",
|
|
907
733
|
"aria-pressed": !c,
|
|
908
734
|
onClick: () => {
|
|
909
|
-
l(void 0),
|
|
735
|
+
l(void 0), b(void 0);
|
|
910
736
|
},
|
|
911
737
|
children: "Live"
|
|
912
|
-
}), /* @__PURE__ */
|
|
738
|
+
}), /* @__PURE__ */ k(L, {
|
|
913
739
|
variant: c ? "secondary" : "outline",
|
|
914
740
|
"aria-pressed": !!c,
|
|
915
741
|
onClick: () => {
|
|
916
742
|
c || l({});
|
|
917
743
|
},
|
|
918
744
|
children: "History"
|
|
919
|
-
})] }), !c && /* @__PURE__ */
|
|
745
|
+
})] }), !c && /* @__PURE__ */ A(O, { children: [/* @__PURE__ */ A(L, {
|
|
920
746
|
variant: "outline",
|
|
921
|
-
disabled: !
|
|
922
|
-
onClick: () =>
|
|
923
|
-
children: [
|
|
924
|
-
}),
|
|
747
|
+
disabled: !E,
|
|
748
|
+
onClick: () => b(y ? void 0 : h),
|
|
749
|
+
children: [k(y ? ee : v, { "aria-hidden": "true" }), y ? "Resume" : "Pause"]
|
|
750
|
+
}), g && /* @__PURE__ */ A(L, {
|
|
925
751
|
variant: "outline",
|
|
926
|
-
onClick:
|
|
927
|
-
children: [/* @__PURE__ */
|
|
752
|
+
onClick: _,
|
|
753
|
+
children: [/* @__PURE__ */ k(te, { "aria-hidden": "true" }), "Retry"]
|
|
928
754
|
})] })]
|
|
929
755
|
})]
|
|
930
756
|
}),
|
|
931
|
-
c && /* @__PURE__ */
|
|
757
|
+
c && /* @__PURE__ */ k(Le, {
|
|
932
758
|
query: c,
|
|
933
759
|
range: f,
|
|
934
|
-
onRangeChange:
|
|
935
|
-
loading:
|
|
760
|
+
onRangeChange: p,
|
|
761
|
+
loading: m.loading,
|
|
936
762
|
onSearch: l,
|
|
937
763
|
scoped: !!n
|
|
938
764
|
}),
|
|
939
|
-
c &&
|
|
765
|
+
c && m.failed && /* @__PURE__ */ A("div", {
|
|
940
766
|
className: "la-observer-error",
|
|
941
767
|
role: "alert",
|
|
942
768
|
children: [
|
|
943
769
|
"Request history unavailable.",
|
|
944
770
|
" ",
|
|
945
|
-
/* @__PURE__ */
|
|
771
|
+
/* @__PURE__ */ k(L, {
|
|
946
772
|
variant: "outline",
|
|
947
|
-
onClick:
|
|
773
|
+
onClick: m.retry,
|
|
948
774
|
children: "Retry history"
|
|
949
775
|
})
|
|
950
776
|
]
|
|
951
777
|
}),
|
|
952
|
-
!c &&
|
|
778
|
+
!c && g && /* @__PURE__ */ A("div", {
|
|
953
779
|
className: "la-observer-error",
|
|
954
780
|
role: "alert",
|
|
955
|
-
children: ["Request stream disconnected. Reconnecting… ",
|
|
781
|
+
children: ["Request stream disconnected. Reconnecting… ", h ? "Showing the last received requests." : "Check your connection and runtime version."]
|
|
956
782
|
}),
|
|
957
|
-
!!
|
|
783
|
+
!!D?.dropped && /* @__PURE__ */ A("div", {
|
|
958
784
|
className: "la-observer-error",
|
|
959
785
|
role: "alert",
|
|
960
|
-
children: [
|
|
786
|
+
children: [D.dropped.toLocaleString(), " request traces were not delivered. This history is incomplete."]
|
|
961
787
|
}),
|
|
962
|
-
|
|
788
|
+
D?.persistenceFailed && /* @__PURE__ */ k("div", {
|
|
963
789
|
className: "la-observer-error",
|
|
964
790
|
role: "alert",
|
|
965
791
|
children: "Some request events could not be saved. This history may be incomplete."
|
|
966
792
|
}),
|
|
967
|
-
|
|
793
|
+
E?.reset && /* @__PURE__ */ k("div", {
|
|
968
794
|
className: "la-observer-error",
|
|
969
795
|
role: "alert",
|
|
970
796
|
children: "Some older events are no longer retained. Showing available history."
|
|
971
797
|
}),
|
|
972
|
-
/* @__PURE__ */
|
|
798
|
+
/* @__PURE__ */ A("div", {
|
|
973
799
|
className: "la-observer-table-frame",
|
|
974
|
-
children: [/* @__PURE__ */
|
|
800
|
+
children: [/* @__PURE__ */ A(W, {
|
|
975
801
|
"aria-label": c ? "Saved requests" : "Recent requests",
|
|
976
802
|
className: "la-request-table",
|
|
977
|
-
children: [/* @__PURE__ */
|
|
978
|
-
/* @__PURE__ */
|
|
803
|
+
children: [/* @__PURE__ */ k(G, { children: /* @__PURE__ */ A(q, { children: [
|
|
804
|
+
/* @__PURE__ */ k(J, {
|
|
979
805
|
scope: "col",
|
|
980
806
|
children: "Time"
|
|
981
807
|
}),
|
|
982
|
-
/* @__PURE__ */
|
|
808
|
+
/* @__PURE__ */ k(J, {
|
|
983
809
|
scope: "col",
|
|
984
810
|
children: "Request"
|
|
985
811
|
}),
|
|
986
|
-
/* @__PURE__ */
|
|
812
|
+
/* @__PURE__ */ k(J, {
|
|
987
813
|
scope: "col",
|
|
988
814
|
children: "Instance"
|
|
989
815
|
}),
|
|
990
|
-
/* @__PURE__ */
|
|
816
|
+
/* @__PURE__ */ k(J, {
|
|
991
817
|
scope: "col",
|
|
992
818
|
children: "Transport"
|
|
993
819
|
}),
|
|
994
|
-
/* @__PURE__ */
|
|
820
|
+
/* @__PURE__ */ k(J, {
|
|
995
821
|
scope: "col",
|
|
996
822
|
children: "Outcome"
|
|
997
823
|
}),
|
|
998
|
-
/* @__PURE__ */
|
|
824
|
+
/* @__PURE__ */ k(J, {
|
|
999
825
|
scope: "col",
|
|
1000
826
|
children: "Total"
|
|
1001
827
|
}),
|
|
1002
|
-
/* @__PURE__ */
|
|
828
|
+
/* @__PURE__ */ k(J, {
|
|
1003
829
|
scope: "col",
|
|
1004
830
|
children: "Queue wait"
|
|
1005
831
|
}),
|
|
1006
|
-
/* @__PURE__ */
|
|
832
|
+
/* @__PURE__ */ k(J, {
|
|
1007
833
|
scope: "col",
|
|
1008
|
-
children: /* @__PURE__ */
|
|
834
|
+
children: /* @__PURE__ */ k("span", {
|
|
1009
835
|
className: "la:sr-only",
|
|
1010
836
|
children: "Details"
|
|
1011
837
|
})
|
|
1012
838
|
})
|
|
1013
|
-
] }) }), /* @__PURE__ */
|
|
839
|
+
] }) }), /* @__PURE__ */ k(K, { children: j.map((e) => /* @__PURE__ */ A(q, {
|
|
1014
840
|
className: "la-clickable-row",
|
|
1015
|
-
"data-state":
|
|
841
|
+
"data-state": x === e ? "selected" : void 0,
|
|
1016
842
|
onClick: (t) => {
|
|
1017
|
-
|
|
843
|
+
w.current = t.currentTarget.querySelector("button"), S(e);
|
|
1018
844
|
},
|
|
1019
845
|
children: [
|
|
1020
|
-
/* @__PURE__ */
|
|
846
|
+
/* @__PURE__ */ k(Y, { children: /* @__PURE__ */ k("time", {
|
|
1021
847
|
dateTime: new Date(e.startedAtMs).toISOString(),
|
|
1022
848
|
title: new Date(e.startedAtMs).toLocaleString(),
|
|
1023
849
|
children: c ? new Date(e.startedAtMs).toLocaleString([], { hour12: !1 }) : new Date(e.startedAtMs).toLocaleTimeString([], { hour12: !1 })
|
|
1024
850
|
}) }),
|
|
1025
|
-
/* @__PURE__ */
|
|
851
|
+
/* @__PURE__ */ k(Y, { children: /* @__PURE__ */ k("span", {
|
|
1026
852
|
className: "la-request-operation",
|
|
1027
853
|
title: e.operation,
|
|
1028
854
|
children: e.operation
|
|
1029
855
|
}) }),
|
|
1030
|
-
/* @__PURE__ */
|
|
856
|
+
/* @__PURE__ */ k(Y, { children: /* @__PURE__ */ A("span", {
|
|
1031
857
|
className: "la-request-actor",
|
|
1032
858
|
title: `${e.actorName} / ${e.actorId}`,
|
|
1033
859
|
children: [
|
|
@@ -1036,18 +862,18 @@ function Me({ client: e, actor: n, timeRange: o, onTimeRangeChange: s }) {
|
|
|
1036
862
|
e.actorId
|
|
1037
863
|
]
|
|
1038
864
|
}) }),
|
|
1039
|
-
/* @__PURE__ */
|
|
1040
|
-
/* @__PURE__ */
|
|
865
|
+
/* @__PURE__ */ k(Y, { children: e.kind === "method" ? "Method" : "WebSocket" }),
|
|
866
|
+
/* @__PURE__ */ k(Y, { children: /* @__PURE__ */ k(U, {
|
|
1041
867
|
variant: "outline",
|
|
1042
868
|
className: `la-request-outcome-${e.outcome}`,
|
|
1043
869
|
children: e.outcome[0].toUpperCase() + e.outcome.slice(1)
|
|
1044
870
|
}) }),
|
|
1045
|
-
/* @__PURE__ */
|
|
1046
|
-
/* @__PURE__ */
|
|
871
|
+
/* @__PURE__ */ k(Y, { children: ze(e.durationMs) }),
|
|
872
|
+
/* @__PURE__ */ k(Y, { children: e.queueWaitMs === null ? /* @__PURE__ */ k("span", {
|
|
1047
873
|
title: "Request did not begin processing",
|
|
1048
874
|
children: "—"
|
|
1049
|
-
}) :
|
|
1050
|
-
/* @__PURE__ */
|
|
875
|
+
}) : ze(e.queueWaitMs) }),
|
|
876
|
+
/* @__PURE__ */ k(Y, { children: /* @__PURE__ */ k(L, {
|
|
1051
877
|
variant: "ghost",
|
|
1052
878
|
size: "sm",
|
|
1053
879
|
"aria-label": `Inspect ${e.operation} request`,
|
|
@@ -1055,57 +881,57 @@ function Me({ client: e, actor: n, timeRange: o, onTimeRangeChange: s }) {
|
|
|
1055
881
|
children: "Details"
|
|
1056
882
|
}) })
|
|
1057
883
|
]
|
|
1058
|
-
}, e.eventId ?? `${
|
|
1059
|
-
}), !
|
|
884
|
+
}, e.eventId ?? `${E.epoch}-${e.sequence}`)) })]
|
|
885
|
+
}), !j.length && /* @__PURE__ */ A("div", {
|
|
1060
886
|
className: "la-request-empty",
|
|
1061
887
|
role: "status",
|
|
1062
|
-
children: [/* @__PURE__ */
|
|
888
|
+
children: [/* @__PURE__ */ k("strong", { children: c ? m.loading ? "Loading history…" : m.failed ? "History unavailable" : "No saved requests in this range" : E ? "No requests yet" : g ? "Requests unavailable" : "Connecting to requests…" }), /* @__PURE__ */ k("p", { children: c ? "Try a wider time range or fewer filters. Local history retains the latest 10,000 events." : "Call an actor method or send a WebSocket message to see its timings." })]
|
|
1063
889
|
})]
|
|
1064
890
|
}),
|
|
1065
|
-
c &&
|
|
891
|
+
c && E?.nextCursor && /* @__PURE__ */ k(L, {
|
|
1066
892
|
className: "la-request-load-older",
|
|
1067
893
|
variant: "outline",
|
|
1068
|
-
disabled:
|
|
1069
|
-
onClick:
|
|
1070
|
-
children:
|
|
894
|
+
disabled: m.loading,
|
|
895
|
+
onClick: m.loadOlder,
|
|
896
|
+
children: m.loading ? "Loading…" : "Load older"
|
|
1071
897
|
}),
|
|
1072
|
-
/* @__PURE__ */
|
|
898
|
+
/* @__PURE__ */ A("div", {
|
|
1073
899
|
className: "la-observer-footnote",
|
|
1074
|
-
children: [/* @__PURE__ */
|
|
900
|
+
children: [/* @__PURE__ */ A("span", {
|
|
1075
901
|
className: "la-observer-refresh-status",
|
|
1076
|
-
children: [!c && /* @__PURE__ */
|
|
1077
|
-
}), /* @__PURE__ */
|
|
902
|
+
children: [!c && /* @__PURE__ */ k("span", { className: `la-observer-dot ${g ? "la-observer-dot-unknown" : "la-observer-dot-live"}` }), c ? "Saved history" : y ? "Display paused · collection continues" : g ? "Reconnecting…" : h ? "Live updates" : "Connecting…"]
|
|
903
|
+
}), /* @__PURE__ */ k("span", { children: c ? `${j.length.toLocaleString()} saved requests shown` : n ? `${j.length} matching requests from the latest ${E?.capacity ?? 500} on this control plane.` : `Latest ${E?.capacity ?? 500} requests on this control plane.` })]
|
|
1078
904
|
}),
|
|
1079
|
-
!c && !!
|
|
905
|
+
!c && !!E?.evicted && /* @__PURE__ */ A("p", {
|
|
1080
906
|
className: "la-request-note",
|
|
1081
|
-
children: [
|
|
907
|
+
children: [E.evicted.toLocaleString(), " older records have left this history window."]
|
|
1082
908
|
}),
|
|
1083
|
-
/* @__PURE__ */
|
|
909
|
+
/* @__PURE__ */ k("p", {
|
|
1084
910
|
className: "la-request-note",
|
|
1085
911
|
children: "Total includes queue wait, actor processing, and persistence. Queue wait includes the WebSocket message queue. Timings exclude the caller’s network round trip."
|
|
1086
912
|
}),
|
|
1087
|
-
/* @__PURE__ */
|
|
1088
|
-
open: !!
|
|
913
|
+
/* @__PURE__ */ k(Te, {
|
|
914
|
+
open: !!x,
|
|
1089
915
|
onOpenChange: (e) => {
|
|
1090
|
-
e ||
|
|
916
|
+
e || S(void 0);
|
|
1091
917
|
},
|
|
1092
|
-
children: /* @__PURE__ */
|
|
1093
|
-
container:
|
|
918
|
+
children: /* @__PURE__ */ A(Oe, {
|
|
919
|
+
container: C.current,
|
|
1094
920
|
onCloseAutoFocus: (e) => {
|
|
1095
|
-
e.preventDefault(),
|
|
921
|
+
e.preventDefault(), w.current?.focus();
|
|
1096
922
|
},
|
|
1097
923
|
children: [
|
|
1098
|
-
/* @__PURE__ */
|
|
1099
|
-
/* @__PURE__ */
|
|
1100
|
-
|
|
924
|
+
/* @__PURE__ */ k(Ee, { children: "Request details" }),
|
|
925
|
+
/* @__PURE__ */ k(De, { children: "Full identifiers and timings for this request." }),
|
|
926
|
+
x && /* @__PURE__ */ k(Re, { record: x })
|
|
1101
927
|
]
|
|
1102
928
|
})
|
|
1103
929
|
})
|
|
1104
930
|
]
|
|
1105
931
|
});
|
|
1106
932
|
}
|
|
1107
|
-
function
|
|
1108
|
-
return /* @__PURE__ */
|
|
933
|
+
function Le({ query: e, range: t, onRangeChange: n, loading: r, onSearch: i, scoped: a }) {
|
|
934
|
+
return /* @__PURE__ */ A("form", {
|
|
1109
935
|
className: "la-request-history-filters",
|
|
1110
936
|
onSubmit: (e) => {
|
|
1111
937
|
e.preventDefault();
|
|
@@ -1116,25 +942,25 @@ function Ne({ query: e, range: t, onRangeChange: n, loading: r, onSearch: i, sco
|
|
|
1116
942
|
});
|
|
1117
943
|
},
|
|
1118
944
|
children: [
|
|
1119
|
-
/* @__PURE__ */
|
|
945
|
+
/* @__PURE__ */ A("div", {
|
|
1120
946
|
className: "la-request-history-range",
|
|
1121
|
-
children: [/* @__PURE__ */
|
|
947
|
+
children: [/* @__PURE__ */ k("span", { children: "Time range" }), /* @__PURE__ */ k(_e, {
|
|
1122
948
|
value: t,
|
|
1123
949
|
onChange: n,
|
|
1124
950
|
align: "start"
|
|
1125
951
|
})]
|
|
1126
952
|
}),
|
|
1127
|
-
!a && /* @__PURE__ */
|
|
953
|
+
!a && /* @__PURE__ */ A("label", { children: ["Actor ID", /* @__PURE__ */ k(R, {
|
|
1128
954
|
name: "actorId",
|
|
1129
955
|
placeholder: "All actors",
|
|
1130
956
|
maxLength: 256,
|
|
1131
957
|
defaultValue: e.actorId
|
|
1132
958
|
})] }),
|
|
1133
|
-
/* @__PURE__ */
|
|
959
|
+
/* @__PURE__ */ A("label", { children: ["Outcome", /* @__PURE__ */ A("select", {
|
|
1134
960
|
className: "la-observer-select",
|
|
1135
961
|
name: "outcome",
|
|
1136
962
|
defaultValue: e.outcome ?? "",
|
|
1137
|
-
children: [/* @__PURE__ */
|
|
963
|
+
children: [/* @__PURE__ */ k("option", {
|
|
1138
964
|
value: "",
|
|
1139
965
|
children: "All outcomes"
|
|
1140
966
|
}), [
|
|
@@ -1143,12 +969,12 @@ function Ne({ query: e, range: t, onRangeChange: n, loading: r, onSearch: i, sco
|
|
|
1143
969
|
"rejected",
|
|
1144
970
|
"rerouted",
|
|
1145
971
|
"interrupted"
|
|
1146
|
-
].map((e) => /* @__PURE__ */
|
|
972
|
+
].map((e) => /* @__PURE__ */ k("option", {
|
|
1147
973
|
value: e,
|
|
1148
974
|
children: e[0].toUpperCase() + e.slice(1)
|
|
1149
975
|
}, e))]
|
|
1150
976
|
})] }),
|
|
1151
|
-
/* @__PURE__ */
|
|
977
|
+
/* @__PURE__ */ k(L, {
|
|
1152
978
|
type: "submit",
|
|
1153
979
|
variant: "outline",
|
|
1154
980
|
disabled: r,
|
|
@@ -1157,7 +983,7 @@ function Ne({ query: e, range: t, onRangeChange: n, loading: r, onSearch: i, sco
|
|
|
1157
983
|
]
|
|
1158
984
|
});
|
|
1159
985
|
}
|
|
1160
|
-
function
|
|
986
|
+
function Re({ record: e }) {
|
|
1161
987
|
let t = {
|
|
1162
988
|
Operation: e.operation,
|
|
1163
989
|
"Actor class": e.actorName,
|
|
@@ -1166,59 +992,54 @@ function Pe({ record: e }) {
|
|
|
1166
992
|
Time: new Date(e.startedAtMs).toLocaleString(),
|
|
1167
993
|
Transport: e.kind === "method" ? "Method" : "WebSocket",
|
|
1168
994
|
Outcome: e.outcome,
|
|
1169
|
-
Total:
|
|
1170
|
-
"Queue wait": e.queueWaitMs === null ? "Did not begin processing" :
|
|
995
|
+
Total: ze(e.durationMs),
|
|
996
|
+
"Queue wait": e.queueWaitMs === null ? "Did not begin processing" : ze(e.queueWaitMs),
|
|
1171
997
|
Host: e.hostId,
|
|
1172
998
|
...e.connectionId ? { Connection: e.connectionId } : {}
|
|
1173
999
|
};
|
|
1174
|
-
return /* @__PURE__ */
|
|
1000
|
+
return /* @__PURE__ */ k("dl", {
|
|
1175
1001
|
className: "la-request-details",
|
|
1176
|
-
children: Object.entries(t).map(([e, t]) => /* @__PURE__ */
|
|
1002
|
+
children: Object.entries(t).map(([e, t]) => /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("dt", { children: e }), /* @__PURE__ */ k("dd", { children: t })] }, e))
|
|
1177
1003
|
});
|
|
1178
1004
|
}
|
|
1179
|
-
function
|
|
1005
|
+
function ze(e) {
|
|
1180
1006
|
return e >= 1e3 ? `${(e / 1e3).toLocaleString(void 0, { maximumFractionDigits: 2 })} s` : `${e.toLocaleString(void 0, { maximumFractionDigits: 1 })} ms`;
|
|
1181
1007
|
}
|
|
1182
1008
|
//#endregion
|
|
1183
|
-
//#region src/queue-wait.ts
|
|
1184
|
-
function
|
|
1185
|
-
let
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
params: r
|
|
1009
|
+
//#region src/queue-wait-history.ts
|
|
1010
|
+
function Be(e, t, n) {
|
|
1011
|
+
let r = Pe(e, {
|
|
1012
|
+
...t,
|
|
1013
|
+
actorName: n
|
|
1014
|
+
}, e.listQueueWaits);
|
|
1015
|
+
return {
|
|
1016
|
+
supported: r.supported,
|
|
1017
|
+
rows: r.value,
|
|
1018
|
+
failed: r.failed
|
|
1194
1019
|
};
|
|
1195
1020
|
}
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
admitted: e.admitted,
|
|
1202
|
-
averageMs: e.average_ms,
|
|
1203
|
-
maxMs: e.max_ms
|
|
1204
|
-
};
|
|
1205
|
-
if (typeof t.actorName != "string" || typeof t.actorId != "string" || !Number.isSafeInteger(t.admitted) || Number(t.admitted) <= 0 || ![t.averageMs, t.maxMs].every((e) => typeof e == "number" && Number.isFinite(e) && e >= 0)) throw Error("Invalid queue wait row");
|
|
1206
|
-
return t;
|
|
1207
|
-
});
|
|
1021
|
+
//#endregion
|
|
1022
|
+
//#region src/queue-wait.ts
|
|
1023
|
+
function Ve(e) {
|
|
1024
|
+
if (!Array.isArray(e) || !e.every(He)) throw Error("Invalid queue wait response");
|
|
1025
|
+
return e;
|
|
1208
1026
|
}
|
|
1209
|
-
function
|
|
1210
|
-
return
|
|
1027
|
+
function He(e) {
|
|
1028
|
+
return !!e && typeof e.actorName == "string" && typeof e.actorId == "string" && Number.isSafeInteger(e.admitted) && e.admitted > 0 && [e.averageMs, e.maxMs].every((e) => typeof e == "number" && Number.isFinite(e) && e >= 0) && e.averageMs <= e.maxMs;
|
|
1211
1029
|
}
|
|
1212
|
-
function
|
|
1213
|
-
return
|
|
1030
|
+
function Ue(e) {
|
|
1031
|
+
return Ke(e, () => "all").get("all") ?? null;
|
|
1214
1032
|
}
|
|
1215
|
-
function
|
|
1216
|
-
return
|
|
1033
|
+
function We(e) {
|
|
1034
|
+
return Ke(e, (e) => e.actorName);
|
|
1217
1035
|
}
|
|
1218
|
-
function
|
|
1036
|
+
function Ge(e, t) {
|
|
1037
|
+
return Ke(e.filter((e) => e.actorName === t), (e) => e.actorId);
|
|
1038
|
+
}
|
|
1039
|
+
function X(e) {
|
|
1219
1040
|
return e === void 0 ? "—" : e >= 1e3 ? `${(e / 1e3).toLocaleString(void 0, { maximumFractionDigits: 2 })} s` : `${e.toLocaleString(void 0, { maximumFractionDigits: 1 })} ms`;
|
|
1220
1041
|
}
|
|
1221
|
-
function
|
|
1042
|
+
function Ke(e, t) {
|
|
1222
1043
|
let n = /* @__PURE__ */ new Map();
|
|
1223
1044
|
for (let r of e) {
|
|
1224
1045
|
let e = n.get(t(r)) ?? {
|
|
@@ -1235,135 +1056,125 @@ function Q(e, t) {
|
|
|
1235
1056
|
return n;
|
|
1236
1057
|
}
|
|
1237
1058
|
//#endregion
|
|
1238
|
-
//#region src/queue-wait-history.ts
|
|
1239
|
-
function Be(e, t, n) {
|
|
1240
|
-
let r = Se(e, Fe(t, n), Ie);
|
|
1241
|
-
return {
|
|
1242
|
-
supported: r.supported,
|
|
1243
|
-
rows: r.value,
|
|
1244
|
-
failed: r.failed
|
|
1245
|
-
};
|
|
1246
|
-
}
|
|
1247
|
-
//#endregion
|
|
1248
1059
|
//#region src/ActorObserver.tsx
|
|
1249
|
-
function
|
|
1250
|
-
let { inventory: u, loading: d, failed:
|
|
1060
|
+
function qe({ client: e, className: r = "", initialActorName: o, navigation: s, timeRange: c, onTimeRangeChange: l }) {
|
|
1061
|
+
let { inventory: u, loading: d, failed: f, retry: p } = je(e), [m, g] = a(z), _ = c ?? m, v = l ?? g, [ee, y] = a(o), b = s ? s.actorName : ee, x = s ? s.onSelectActor : y, [S, C] = a(""), w = i(null), T = i(o), E = n(), D = u?.actors.find((e) => e.actorName === b), j = Be(e, B(_, Date.now()), b), M = j.rows && We(j.rows), N = j.rows && b !== void 0 ? Ge(j.rows, b) : void 0, P = j.supported && j.rows ? Ue(j.rows) : void 0;
|
|
1251
1062
|
return t(() => {
|
|
1252
|
-
|
|
1063
|
+
y(o), C("");
|
|
1253
1064
|
}, [e, o]), t(() => {
|
|
1254
|
-
|
|
1255
|
-
}, [
|
|
1065
|
+
T.current !== b && w.current?.focus(), T.current = b;
|
|
1066
|
+
}, [b]), /* @__PURE__ */ A("section", {
|
|
1256
1067
|
className: `la-observer ${r}`,
|
|
1257
1068
|
"aria-label": "Actor observer",
|
|
1258
1069
|
children: [
|
|
1259
|
-
|
|
1070
|
+
b !== void 0 && /* @__PURE__ */ A("nav", {
|
|
1260
1071
|
className: "la-observer-breadcrumb",
|
|
1261
1072
|
"aria-label": "Breadcrumb",
|
|
1262
1073
|
children: [
|
|
1263
|
-
/* @__PURE__ */
|
|
1074
|
+
/* @__PURE__ */ k(L, {
|
|
1264
1075
|
variant: "link",
|
|
1265
1076
|
type: "button",
|
|
1266
1077
|
"aria-label": "Back to actors",
|
|
1267
|
-
onClick: () =>
|
|
1078
|
+
onClick: () => x(void 0),
|
|
1268
1079
|
children: "Actors"
|
|
1269
1080
|
}),
|
|
1270
|
-
/* @__PURE__ */
|
|
1081
|
+
/* @__PURE__ */ k("span", {
|
|
1271
1082
|
"aria-hidden": "true",
|
|
1272
1083
|
children: "/"
|
|
1273
1084
|
}),
|
|
1274
|
-
/* @__PURE__ */
|
|
1085
|
+
/* @__PURE__ */ k("span", {
|
|
1275
1086
|
"aria-current": "page",
|
|
1276
|
-
children:
|
|
1087
|
+
children: b
|
|
1277
1088
|
})
|
|
1278
1089
|
]
|
|
1279
1090
|
}),
|
|
1280
|
-
/* @__PURE__ */
|
|
1091
|
+
/* @__PURE__ */ A("div", {
|
|
1281
1092
|
className: "la-observer-toolbar",
|
|
1282
|
-
children: [/* @__PURE__ */
|
|
1093
|
+
children: [/* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("div", {
|
|
1283
1094
|
className: "la-observer-title",
|
|
1284
|
-
children: /* @__PURE__ */
|
|
1285
|
-
ref:
|
|
1095
|
+
children: /* @__PURE__ */ k("h1", {
|
|
1096
|
+
ref: w,
|
|
1286
1097
|
tabIndex: -1,
|
|
1287
|
-
children:
|
|
1098
|
+
children: b ?? "Actors"
|
|
1288
1099
|
})
|
|
1289
|
-
}), /* @__PURE__ */
|
|
1100
|
+
}), /* @__PURE__ */ k("p", { children: b === void 0 ? "Inspect instances, residency, and connections." : "Inspect this actor class’s instances, residency, and connections." })] }), /* @__PURE__ */ A("div", {
|
|
1290
1101
|
className: "la-observer-actions",
|
|
1291
|
-
children: [
|
|
1292
|
-
value:
|
|
1293
|
-
onChange:
|
|
1294
|
-
}), /* @__PURE__ */
|
|
1102
|
+
children: [j.supported && /* @__PURE__ */ k(_e, {
|
|
1103
|
+
value: _,
|
|
1104
|
+
onChange: v
|
|
1105
|
+
}), /* @__PURE__ */ A(L, {
|
|
1295
1106
|
variant: "outline",
|
|
1296
1107
|
type: "button",
|
|
1297
1108
|
disabled: d,
|
|
1298
|
-
onClick:
|
|
1299
|
-
children: [/* @__PURE__ */
|
|
1109
|
+
onClick: p,
|
|
1110
|
+
children: [/* @__PURE__ */ k(te, {
|
|
1300
1111
|
"aria-hidden": "true",
|
|
1301
1112
|
className: d ? "la-observer-spin" : void 0
|
|
1302
|
-
}), d ? "Refreshing…" :
|
|
1113
|
+
}), d ? "Refreshing…" : f ? "Try again" : "Refresh"]
|
|
1303
1114
|
})]
|
|
1304
1115
|
})]
|
|
1305
1116
|
}),
|
|
1306
|
-
|
|
1117
|
+
f && /* @__PURE__ */ A("div", {
|
|
1307
1118
|
className: "la-observer-error",
|
|
1308
1119
|
role: "alert",
|
|
1309
|
-
children: [/* @__PURE__ */
|
|
1120
|
+
children: [/* @__PURE__ */ k(h, { "aria-hidden": "true" }), /* @__PURE__ */ k("p", { children: u ? "Could not refresh. These counts may be out of date." : "Could not load actors. Check your connection and access, then try again." })]
|
|
1310
1121
|
}),
|
|
1311
|
-
!u && !
|
|
1312
|
-
u && /* @__PURE__ */
|
|
1122
|
+
!u && !f && /* @__PURE__ */ k(Je, {}),
|
|
1123
|
+
u && /* @__PURE__ */ A(O, { children: [b === void 0 ? /* @__PURE__ */ A(O, { children: [/* @__PURE__ */ k(Ye, {
|
|
1313
1124
|
inventory: u,
|
|
1314
|
-
queueWait:
|
|
1315
|
-
range:
|
|
1316
|
-
}), u.actors.length ? /* @__PURE__ */
|
|
1125
|
+
queueWait: j.supported ? P ?? null : void 0,
|
|
1126
|
+
range: _
|
|
1127
|
+
}), u.actors.length ? /* @__PURE__ */ k(Xe, {
|
|
1317
1128
|
inventory: u,
|
|
1318
|
-
query:
|
|
1319
|
-
onQueryChange:
|
|
1320
|
-
onSelectActor:
|
|
1321
|
-
waits:
|
|
1322
|
-
}) : /* @__PURE__ */
|
|
1129
|
+
query: S,
|
|
1130
|
+
onQueryChange: C,
|
|
1131
|
+
onSelectActor: x,
|
|
1132
|
+
waits: j.supported ? M : void 0
|
|
1133
|
+
}) : /* @__PURE__ */ k(it, {
|
|
1323
1134
|
title: "No actors yet",
|
|
1324
1135
|
description: "Deploy your actor classes to see them here. Instance counts appear as actors are used."
|
|
1325
|
-
})] }) :
|
|
1326
|
-
inventory: { actors: [
|
|
1327
|
-
actorName:
|
|
1328
|
-
queueWait:
|
|
1329
|
-
range:
|
|
1330
|
-
}), /* @__PURE__ */
|
|
1136
|
+
})] }) : D ? /* @__PURE__ */ A(O, { children: [/* @__PURE__ */ k(Ye, {
|
|
1137
|
+
inventory: { actors: [D] },
|
|
1138
|
+
actorName: b,
|
|
1139
|
+
queueWait: j.supported ? P ?? null : void 0,
|
|
1140
|
+
range: _
|
|
1141
|
+
}), /* @__PURE__ */ k(Ze, {
|
|
1331
1142
|
client: e,
|
|
1332
|
-
id:
|
|
1333
|
-
actorName:
|
|
1334
|
-
instances:
|
|
1335
|
-
waits:
|
|
1336
|
-
range:
|
|
1337
|
-
},
|
|
1143
|
+
id: E,
|
|
1144
|
+
actorName: b,
|
|
1145
|
+
instances: D.instances,
|
|
1146
|
+
waits: j.supported ? N : void 0,
|
|
1147
|
+
range: _
|
|
1148
|
+
}, b)] }) : /* @__PURE__ */ k(it, {
|
|
1338
1149
|
title: "Actor class unavailable",
|
|
1339
1150
|
description: "This actor class is no longer in the latest inventory. Return to Actors to see available classes."
|
|
1340
|
-
}), /* @__PURE__ */
|
|
1151
|
+
}), /* @__PURE__ */ A("div", {
|
|
1341
1152
|
className: "la-observer-footnote",
|
|
1342
|
-
children: [/* @__PURE__ */
|
|
1153
|
+
children: [/* @__PURE__ */ A("span", {
|
|
1343
1154
|
className: "la-observer-refresh-status",
|
|
1344
|
-
children: [/* @__PURE__ */
|
|
1345
|
-
}), /* @__PURE__ */
|
|
1155
|
+
children: [/* @__PURE__ */ k("span", { className: `la-observer-dot ${f ? "la-observer-dot-unknown" : e.watchActors ? "la-observer-dot-live" : ""}` }), f ? "Reconnecting…" : e.watchActors ? "Live updates" : "Auto-refresh every 5s"]
|
|
1156
|
+
}), /* @__PURE__ */ k("span", { children: e.watchActors ? "Changes stream from the control plane." : "Counts follow the latest host heartbeat." })]
|
|
1346
1157
|
})] })
|
|
1347
1158
|
]
|
|
1348
1159
|
});
|
|
1349
1160
|
}
|
|
1350
|
-
function
|
|
1351
|
-
return /* @__PURE__ */
|
|
1161
|
+
function Je() {
|
|
1162
|
+
return /* @__PURE__ */ A("div", {
|
|
1352
1163
|
className: "la-observer-skeleton",
|
|
1353
1164
|
role: "status",
|
|
1354
1165
|
"aria-label": "Loading actors",
|
|
1355
1166
|
children: [
|
|
1356
|
-
/* @__PURE__ */
|
|
1167
|
+
/* @__PURE__ */ k("span", {
|
|
1357
1168
|
className: "la:sr-only",
|
|
1358
1169
|
children: "Loading actors…"
|
|
1359
1170
|
}),
|
|
1360
|
-
/* @__PURE__ */
|
|
1361
|
-
/* @__PURE__ */
|
|
1362
|
-
/* @__PURE__ */
|
|
1171
|
+
/* @__PURE__ */ k("div", {}),
|
|
1172
|
+
/* @__PURE__ */ k("div", {}),
|
|
1173
|
+
/* @__PURE__ */ k("div", {})
|
|
1363
1174
|
]
|
|
1364
1175
|
});
|
|
1365
1176
|
}
|
|
1366
|
-
function
|
|
1177
|
+
function Ye({ inventory: e, actorName: t, queueWait: n, range: r }) {
|
|
1367
1178
|
let i = e.actors.reduce((e, t) => ({
|
|
1368
1179
|
live: e.live + t.live,
|
|
1369
1180
|
dormant: e.dormant + t.dormant,
|
|
@@ -1373,259 +1184,259 @@ function Ue({ inventory: e, actorName: t, queueWait: n, range: r }) {
|
|
|
1373
1184
|
dormant: 0,
|
|
1374
1185
|
unknown: 0
|
|
1375
1186
|
});
|
|
1376
|
-
return /* @__PURE__ */
|
|
1187
|
+
return /* @__PURE__ */ A("dl", {
|
|
1377
1188
|
className: "la-observer-summary",
|
|
1378
1189
|
children: [
|
|
1379
|
-
/* @__PURE__ */
|
|
1380
|
-
/* @__PURE__ */
|
|
1381
|
-
/* @__PURE__ */
|
|
1190
|
+
/* @__PURE__ */ A("div", { children: [
|
|
1191
|
+
/* @__PURE__ */ k("dt", { children: "Total instances" }),
|
|
1192
|
+
/* @__PURE__ */ k("dd", {
|
|
1382
1193
|
"aria-label": "Total instances",
|
|
1383
1194
|
children: (i.live + i.dormant + i.unknown).toLocaleString()
|
|
1384
1195
|
}),
|
|
1385
|
-
/* @__PURE__ */
|
|
1196
|
+
/* @__PURE__ */ k("p", { children: t === void 0 ? `${e.actors.length} actor ${e.actors.length === 1 ? "type" : "types"}` : "In this actor class" })
|
|
1386
1197
|
] }),
|
|
1387
|
-
/* @__PURE__ */
|
|
1388
|
-
/* @__PURE__ */
|
|
1389
|
-
/* @__PURE__ */
|
|
1198
|
+
/* @__PURE__ */ A("div", { children: [
|
|
1199
|
+
/* @__PURE__ */ A("dt", { children: [/* @__PURE__ */ k("span", { className: "la-observer-dot la-observer-dot-live" }), "Live"] }),
|
|
1200
|
+
/* @__PURE__ */ k("dd", {
|
|
1390
1201
|
"aria-label": "Live instances",
|
|
1391
1202
|
children: i.live.toLocaleString()
|
|
1392
1203
|
}),
|
|
1393
|
-
/* @__PURE__ */
|
|
1204
|
+
/* @__PURE__ */ k("p", { children: "Loaded in memory" })
|
|
1394
1205
|
] }),
|
|
1395
|
-
/* @__PURE__ */
|
|
1396
|
-
/* @__PURE__ */
|
|
1397
|
-
/* @__PURE__ */
|
|
1206
|
+
/* @__PURE__ */ A("div", { children: [
|
|
1207
|
+
/* @__PURE__ */ A("dt", { children: [/* @__PURE__ */ k("span", { className: "la-observer-dot" }), "Dormant"] }),
|
|
1208
|
+
/* @__PURE__ */ k("dd", {
|
|
1398
1209
|
"aria-label": "Dormant instances",
|
|
1399
1210
|
children: i.dormant.toLocaleString()
|
|
1400
1211
|
}),
|
|
1401
|
-
/* @__PURE__ */
|
|
1212
|
+
/* @__PURE__ */ k("p", { children: "Currently unloaded" })
|
|
1402
1213
|
] }),
|
|
1403
|
-
i.unknown > 0 && /* @__PURE__ */
|
|
1404
|
-
/* @__PURE__ */
|
|
1405
|
-
/* @__PURE__ */
|
|
1214
|
+
i.unknown > 0 && /* @__PURE__ */ A("div", { children: [
|
|
1215
|
+
/* @__PURE__ */ A("dt", { children: [/* @__PURE__ */ k("span", { className: "la-observer-dot la-observer-dot-unknown" }), "Unknown"] }),
|
|
1216
|
+
/* @__PURE__ */ k("dd", {
|
|
1406
1217
|
"aria-label": "Unknown instances",
|
|
1407
1218
|
children: i.unknown.toLocaleString()
|
|
1408
1219
|
}),
|
|
1409
|
-
/* @__PURE__ */
|
|
1220
|
+
/* @__PURE__ */ k("p", { children: "Awaiting host report" })
|
|
1410
1221
|
] }),
|
|
1411
|
-
n !== void 0 && /* @__PURE__ */
|
|
1222
|
+
n !== void 0 && /* @__PURE__ */ A("div", {
|
|
1412
1223
|
className: "la-observer-queue-wait",
|
|
1413
1224
|
children: [
|
|
1414
|
-
/* @__PURE__ */
|
|
1415
|
-
/* @__PURE__ */
|
|
1225
|
+
/* @__PURE__ */ k("dt", { children: "Avg queue wait" }),
|
|
1226
|
+
/* @__PURE__ */ k("dd", {
|
|
1416
1227
|
"aria-label": "Average queue wait",
|
|
1417
|
-
children:
|
|
1228
|
+
children: X(n?.averageMs)
|
|
1418
1229
|
}),
|
|
1419
|
-
/* @__PURE__ */
|
|
1230
|
+
/* @__PURE__ */ k("p", { children: n ? `Max ${X(n.maxMs)} · ${n.admitted.toLocaleString()} admitted ${H(r)}` : `No admitted requests ${H(r)}` })
|
|
1420
1231
|
]
|
|
1421
1232
|
})
|
|
1422
1233
|
]
|
|
1423
1234
|
});
|
|
1424
1235
|
}
|
|
1425
|
-
function
|
|
1426
|
-
let a = e.actors.some((e) => e.unknown > 0),
|
|
1427
|
-
return /* @__PURE__ */
|
|
1428
|
-
/* @__PURE__ */
|
|
1236
|
+
function Xe({ inventory: e, query: t, onQueryChange: n, onSelectActor: r, waits: i }) {
|
|
1237
|
+
let a = e.actors.some((e) => e.unknown > 0), o = e.actors.filter((e) => at(e.actorName, t)).sort((e, t) => Number(t.live > 0) - Number(e.live > 0));
|
|
1238
|
+
return /* @__PURE__ */ A(O, { children: [
|
|
1239
|
+
/* @__PURE__ */ A("div", {
|
|
1429
1240
|
className: "la-observer-list-toolbar",
|
|
1430
|
-
children: [/* @__PURE__ */
|
|
1241
|
+
children: [/* @__PURE__ */ A("h2", { children: ["Actor names ", /* @__PURE__ */ k(U, { children: e.actors.length })] }), /* @__PURE__ */ k(rt, {
|
|
1431
1242
|
label: "Search actors",
|
|
1432
1243
|
placeholder: "Search actors…",
|
|
1433
1244
|
value: t,
|
|
1434
1245
|
onChange: n
|
|
1435
1246
|
})]
|
|
1436
1247
|
}),
|
|
1437
|
-
/* @__PURE__ */
|
|
1248
|
+
/* @__PURE__ */ k("div", {
|
|
1438
1249
|
className: "la-observer-table-frame",
|
|
1439
|
-
children:
|
|
1250
|
+
children: o.length ? /* @__PURE__ */ A(W, {
|
|
1440
1251
|
"aria-label": "Actor instance counts",
|
|
1441
1252
|
className: "la-observer-table",
|
|
1442
|
-
children: [/* @__PURE__ */
|
|
1443
|
-
/* @__PURE__ */
|
|
1253
|
+
children: [/* @__PURE__ */ k(G, { children: /* @__PURE__ */ A(q, { children: [
|
|
1254
|
+
/* @__PURE__ */ k(J, {
|
|
1444
1255
|
scope: "col",
|
|
1445
1256
|
children: "Actor"
|
|
1446
1257
|
}),
|
|
1447
|
-
/* @__PURE__ */
|
|
1258
|
+
/* @__PURE__ */ k(J, {
|
|
1448
1259
|
scope: "col",
|
|
1449
1260
|
children: "Live"
|
|
1450
1261
|
}),
|
|
1451
|
-
/* @__PURE__ */
|
|
1262
|
+
/* @__PURE__ */ k(J, {
|
|
1452
1263
|
scope: "col",
|
|
1453
1264
|
children: "Dormant"
|
|
1454
1265
|
}),
|
|
1455
|
-
a && /* @__PURE__ */
|
|
1266
|
+
a && /* @__PURE__ */ k(J, {
|
|
1456
1267
|
scope: "col",
|
|
1457
1268
|
children: "Unknown"
|
|
1458
1269
|
}),
|
|
1459
|
-
/* @__PURE__ */
|
|
1270
|
+
/* @__PURE__ */ k(J, {
|
|
1460
1271
|
scope: "col",
|
|
1461
1272
|
children: "Total"
|
|
1462
1273
|
}),
|
|
1463
|
-
i && /* @__PURE__ */
|
|
1274
|
+
i && /* @__PURE__ */ k(J, {
|
|
1464
1275
|
scope: "col",
|
|
1465
1276
|
className: "la-observer-wait-cell",
|
|
1466
1277
|
children: "Avg queue wait"
|
|
1467
1278
|
})
|
|
1468
|
-
] }) }), /* @__PURE__ */
|
|
1279
|
+
] }) }), /* @__PURE__ */ k(K, { children: o.map((e) => /* @__PURE__ */ A(q, {
|
|
1469
1280
|
className: "la-clickable-row",
|
|
1470
1281
|
onClick: () => r(e.actorName),
|
|
1471
1282
|
children: [
|
|
1472
|
-
/* @__PURE__ */
|
|
1283
|
+
/* @__PURE__ */ k(Y, {
|
|
1473
1284
|
className: "la-observer-name",
|
|
1474
|
-
children: /* @__PURE__ */
|
|
1285
|
+
children: /* @__PURE__ */ A(L, {
|
|
1475
1286
|
variant: "ghost",
|
|
1476
1287
|
type: "button",
|
|
1477
1288
|
className: "la-observer-actor-button la-observer-class-button",
|
|
1478
|
-
children: [/* @__PURE__ */
|
|
1289
|
+
children: [/* @__PURE__ */ k(c, {
|
|
1479
1290
|
className: "la-observer-type-icon",
|
|
1480
1291
|
"aria-hidden": "true"
|
|
1481
|
-
}), /* @__PURE__ */
|
|
1292
|
+
}), /* @__PURE__ */ k("span", { children: e.actorName })]
|
|
1482
1293
|
})
|
|
1483
1294
|
}),
|
|
1484
|
-
/* @__PURE__ */
|
|
1295
|
+
/* @__PURE__ */ k(Y, { children: /* @__PURE__ */ k("span", {
|
|
1485
1296
|
className: e.live > 0 ? "la-observer-live" : void 0,
|
|
1486
1297
|
children: e.live.toLocaleString()
|
|
1487
1298
|
}) }),
|
|
1488
|
-
/* @__PURE__ */
|
|
1489
|
-
a && /* @__PURE__ */
|
|
1490
|
-
/* @__PURE__ */
|
|
1491
|
-
i && /* @__PURE__ */
|
|
1299
|
+
/* @__PURE__ */ k(Y, { children: e.dormant.toLocaleString() }),
|
|
1300
|
+
a && /* @__PURE__ */ k(Y, { children: e.unknown.toLocaleString() }),
|
|
1301
|
+
/* @__PURE__ */ k(Y, { children: (e.live + e.dormant + e.unknown).toLocaleString() }),
|
|
1302
|
+
i && /* @__PURE__ */ k(Y, {
|
|
1492
1303
|
className: "la-observer-wait-cell",
|
|
1493
|
-
children: /* @__PURE__ */
|
|
1304
|
+
children: /* @__PURE__ */ k(Qe, { stats: i.get(e.actorName) })
|
|
1494
1305
|
})
|
|
1495
1306
|
]
|
|
1496
1307
|
}, e.actorName)) })]
|
|
1497
|
-
}) : /* @__PURE__ */
|
|
1308
|
+
}) : /* @__PURE__ */ k(it, {
|
|
1498
1309
|
title: "No matching actors",
|
|
1499
1310
|
description: "Try a different actor name.",
|
|
1500
1311
|
action: "Clear search",
|
|
1501
1312
|
onReset: () => n("")
|
|
1502
1313
|
})
|
|
1503
1314
|
}),
|
|
1504
|
-
a && /* @__PURE__ */
|
|
1315
|
+
a && /* @__PURE__ */ A("p", {
|
|
1505
1316
|
className: "la-observer-unknown",
|
|
1506
|
-
children: [/* @__PURE__ */
|
|
1317
|
+
children: [/* @__PURE__ */ k(h, { "aria-hidden": "true" }), "Some hosts have not reported which instances are loaded. Their counts are shown as unknown."]
|
|
1507
1318
|
})
|
|
1508
1319
|
] });
|
|
1509
1320
|
}
|
|
1510
|
-
function
|
|
1511
|
-
let [l, u] = a(""), [d, f] = a("all"), [p, m] = a(), h = `${n}-connections`, g = o.filter((e) =>
|
|
1321
|
+
function Ze({ client: e, id: n, actorName: r, instances: o, waits: s, range: c }) {
|
|
1322
|
+
let [l, u] = a(""), [d, f] = a("all"), [p, m] = a(), h = `${n}-connections`, g = o.filter((e) => at(e.actorId, l) && (d === "all" || e.status === d));
|
|
1512
1323
|
g.sort((e, t) => Number(t.status === "live") - Number(e.status === "live"));
|
|
1513
1324
|
let _ = o.find((e) => e.actorId === p), v = i(null);
|
|
1514
1325
|
return t(() => {
|
|
1515
1326
|
v.current?.focus();
|
|
1516
|
-
}, [p]), p === void 0 ? /* @__PURE__ */
|
|
1327
|
+
}, [p]), p === void 0 ? /* @__PURE__ */ A("section", {
|
|
1517
1328
|
id: n,
|
|
1518
1329
|
className: "la-observer-instances",
|
|
1519
1330
|
"aria-labelledby": `${n}-heading`,
|
|
1520
|
-
children: [/* @__PURE__ */
|
|
1331
|
+
children: [/* @__PURE__ */ k("div", {
|
|
1521
1332
|
className: "la-observer-instances-heading",
|
|
1522
|
-
children: /* @__PURE__ */
|
|
1333
|
+
children: /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ A("h2", {
|
|
1523
1334
|
ref: v,
|
|
1524
1335
|
tabIndex: -1,
|
|
1525
1336
|
id: `${n}-heading`,
|
|
1526
1337
|
children: [
|
|
1527
1338
|
r,
|
|
1528
1339
|
" instances ",
|
|
1529
|
-
/* @__PURE__ */
|
|
1340
|
+
/* @__PURE__ */ k(U, {
|
|
1530
1341
|
"aria-hidden": "true",
|
|
1531
1342
|
children: o.length.toLocaleString()
|
|
1532
1343
|
})
|
|
1533
1344
|
]
|
|
1534
|
-
}), /* @__PURE__ */
|
|
1535
|
-
}), o.length ? /* @__PURE__ */
|
|
1536
|
-
/* @__PURE__ */
|
|
1345
|
+
}), /* @__PURE__ */ k("p", { children: "Select an instance to inspect its waiting line, requests, and WebSocket connections." })] })
|
|
1346
|
+
}), o.length ? /* @__PURE__ */ A(O, { children: [
|
|
1347
|
+
/* @__PURE__ */ A("div", {
|
|
1537
1348
|
className: "la-observer-filters",
|
|
1538
|
-
children: [/* @__PURE__ */
|
|
1349
|
+
children: [/* @__PURE__ */ k(rt, {
|
|
1539
1350
|
label: "Search instances",
|
|
1540
1351
|
placeholder: "Search instance IDs…",
|
|
1541
1352
|
value: l,
|
|
1542
1353
|
onChange: u
|
|
1543
|
-
}), /* @__PURE__ */
|
|
1354
|
+
}), /* @__PURE__ */ A("select", {
|
|
1544
1355
|
className: "la-observer-select",
|
|
1545
1356
|
"aria-label": "Instance state",
|
|
1546
1357
|
value: d,
|
|
1547
1358
|
onChange: (e) => f(e.target.value),
|
|
1548
1359
|
children: [
|
|
1549
|
-
/* @__PURE__ */
|
|
1360
|
+
/* @__PURE__ */ k("option", {
|
|
1550
1361
|
value: "all",
|
|
1551
1362
|
children: "All states"
|
|
1552
1363
|
}),
|
|
1553
|
-
/* @__PURE__ */
|
|
1364
|
+
/* @__PURE__ */ k("option", {
|
|
1554
1365
|
value: "live",
|
|
1555
1366
|
children: "Live"
|
|
1556
1367
|
}),
|
|
1557
|
-
/* @__PURE__ */
|
|
1368
|
+
/* @__PURE__ */ k("option", {
|
|
1558
1369
|
value: "dormant",
|
|
1559
1370
|
children: "Dormant"
|
|
1560
1371
|
}),
|
|
1561
|
-
/* @__PURE__ */
|
|
1372
|
+
/* @__PURE__ */ k("option", {
|
|
1562
1373
|
value: "unknown",
|
|
1563
1374
|
children: "Unknown"
|
|
1564
1375
|
})
|
|
1565
1376
|
]
|
|
1566
1377
|
})]
|
|
1567
1378
|
}),
|
|
1568
|
-
/* @__PURE__ */
|
|
1379
|
+
/* @__PURE__ */ k("div", {
|
|
1569
1380
|
className: "la-observer-table-frame",
|
|
1570
|
-
children: g.length ? /* @__PURE__ */
|
|
1381
|
+
children: g.length ? /* @__PURE__ */ A(W, {
|
|
1571
1382
|
"aria-label": `${r} instances`,
|
|
1572
1383
|
className: "la-observer-instance-table",
|
|
1573
|
-
children: [/* @__PURE__ */
|
|
1574
|
-
/* @__PURE__ */
|
|
1384
|
+
children: [/* @__PURE__ */ k(G, { children: /* @__PURE__ */ A(q, { children: [
|
|
1385
|
+
/* @__PURE__ */ k(J, {
|
|
1575
1386
|
scope: "col",
|
|
1576
1387
|
children: "Instance"
|
|
1577
1388
|
}),
|
|
1578
|
-
/* @__PURE__ */
|
|
1389
|
+
/* @__PURE__ */ k(J, {
|
|
1579
1390
|
scope: "col",
|
|
1580
1391
|
children: "State"
|
|
1581
1392
|
}),
|
|
1582
|
-
/* @__PURE__ */
|
|
1393
|
+
/* @__PURE__ */ k(J, {
|
|
1583
1394
|
scope: "col",
|
|
1584
1395
|
children: "Connections"
|
|
1585
1396
|
}),
|
|
1586
|
-
s && /* @__PURE__ */
|
|
1397
|
+
s && /* @__PURE__ */ k(J, {
|
|
1587
1398
|
scope: "col",
|
|
1588
1399
|
className: "la-observer-wait-cell",
|
|
1589
1400
|
children: "Avg queue wait"
|
|
1590
1401
|
}),
|
|
1591
|
-
/* @__PURE__ */
|
|
1402
|
+
/* @__PURE__ */ k(J, {
|
|
1592
1403
|
scope: "col",
|
|
1593
1404
|
className: "la-observer-waiting-cell",
|
|
1594
1405
|
children: "Waiting"
|
|
1595
1406
|
})
|
|
1596
|
-
] }) }), /* @__PURE__ */
|
|
1407
|
+
] }) }), /* @__PURE__ */ k(K, { children: g.map((e) => /* @__PURE__ */ A(q, {
|
|
1597
1408
|
className: "la-clickable-row",
|
|
1598
1409
|
onClick: () => m(e.actorId),
|
|
1599
1410
|
children: [
|
|
1600
|
-
/* @__PURE__ */
|
|
1411
|
+
/* @__PURE__ */ k(Y, {
|
|
1601
1412
|
className: "la-observer-instance-id",
|
|
1602
|
-
children: /* @__PURE__ */
|
|
1413
|
+
children: /* @__PURE__ */ k(L, {
|
|
1603
1414
|
variant: "ghost",
|
|
1604
1415
|
type: "button",
|
|
1605
1416
|
className: "la-observer-actor-button",
|
|
1606
|
-
children: /* @__PURE__ */
|
|
1417
|
+
children: /* @__PURE__ */ k("span", { children: e.actorId })
|
|
1607
1418
|
})
|
|
1608
1419
|
}),
|
|
1609
|
-
/* @__PURE__ */
|
|
1420
|
+
/* @__PURE__ */ k(Y, { children: /* @__PURE__ */ A(U, {
|
|
1610
1421
|
variant: "outline",
|
|
1611
1422
|
className: `la-observer-status-${e.status}`,
|
|
1612
|
-
children: [/* @__PURE__ */
|
|
1423
|
+
children: [/* @__PURE__ */ k("span", { className: `la-observer-dot la-observer-dot-${e.status}` }), ot(e.status)]
|
|
1613
1424
|
}) }),
|
|
1614
|
-
/* @__PURE__ */
|
|
1615
|
-
s && /* @__PURE__ */
|
|
1425
|
+
/* @__PURE__ */ k(Y, { children: e.connections.length.toLocaleString() }),
|
|
1426
|
+
s && /* @__PURE__ */ k(Y, {
|
|
1616
1427
|
className: "la-observer-wait-cell",
|
|
1617
|
-
children: /* @__PURE__ */
|
|
1428
|
+
children: /* @__PURE__ */ k(Qe, { stats: s.get(e.actorId) })
|
|
1618
1429
|
}),
|
|
1619
|
-
/* @__PURE__ */
|
|
1430
|
+
/* @__PURE__ */ k(Y, {
|
|
1620
1431
|
className: "la-observer-waiting-cell",
|
|
1621
|
-
children: /* @__PURE__ */
|
|
1432
|
+
children: /* @__PURE__ */ k(tt, {
|
|
1622
1433
|
waiting: e.waiting,
|
|
1623
1434
|
compact: !0
|
|
1624
1435
|
})
|
|
1625
1436
|
})
|
|
1626
1437
|
]
|
|
1627
1438
|
}, e.actorId)) })]
|
|
1628
|
-
}) : /* @__PURE__ */
|
|
1439
|
+
}) : /* @__PURE__ */ k(it, {
|
|
1629
1440
|
title: "No matching instances",
|
|
1630
1441
|
description: "Try another instance ID or state.",
|
|
1631
1442
|
action: "Clear filters",
|
|
@@ -1634,11 +1445,11 @@ function Ge({ client: e, id: n, actorName: r, instances: o, waits: s, range: c }
|
|
|
1634
1445
|
}
|
|
1635
1446
|
})
|
|
1636
1447
|
}),
|
|
1637
|
-
/* @__PURE__ */
|
|
1448
|
+
/* @__PURE__ */ k("p", {
|
|
1638
1449
|
className: "la-observer-connection-note",
|
|
1639
1450
|
children: "Connections are active WebSocket connections, not unique people."
|
|
1640
1451
|
})
|
|
1641
|
-
] }) : /* @__PURE__ */
|
|
1452
|
+
] }) : /* @__PURE__ */ A("p", {
|
|
1642
1453
|
className: "la-observer-instance-empty",
|
|
1643
1454
|
role: "status",
|
|
1644
1455
|
children: [
|
|
@@ -1647,46 +1458,46 @@ function Ge({ client: e, id: n, actorName: r, instances: o, waits: s, range: c }
|
|
|
1647
1458
|
" instances have been created yet."
|
|
1648
1459
|
]
|
|
1649
1460
|
})]
|
|
1650
|
-
}) : /* @__PURE__ */
|
|
1461
|
+
}) : /* @__PURE__ */ A("section", {
|
|
1651
1462
|
className: "la-observer-instance-detail",
|
|
1652
1463
|
"aria-label": `${r} / ${p}`,
|
|
1653
1464
|
children: [
|
|
1654
|
-
/* @__PURE__ */
|
|
1465
|
+
/* @__PURE__ */ k(L, {
|
|
1655
1466
|
variant: "link",
|
|
1656
1467
|
"aria-label": "Back to instances",
|
|
1657
1468
|
onClick: () => m(void 0),
|
|
1658
1469
|
children: "Back to instances"
|
|
1659
1470
|
}),
|
|
1660
|
-
/* @__PURE__ */
|
|
1471
|
+
/* @__PURE__ */ A("div", {
|
|
1661
1472
|
className: "la-observer-instance-heading",
|
|
1662
|
-
children: [/* @__PURE__ */
|
|
1473
|
+
children: [/* @__PURE__ */ k("h2", {
|
|
1663
1474
|
ref: v,
|
|
1664
1475
|
tabIndex: -1,
|
|
1665
1476
|
children: p
|
|
1666
|
-
}), _ && /* @__PURE__ */
|
|
1477
|
+
}), _ && /* @__PURE__ */ k(U, {
|
|
1667
1478
|
variant: "outline",
|
|
1668
1479
|
className: `la-observer-status-${_.status}`,
|
|
1669
|
-
children:
|
|
1480
|
+
children: ot(_.status)
|
|
1670
1481
|
})]
|
|
1671
1482
|
}),
|
|
1672
|
-
!_ && /* @__PURE__ */
|
|
1483
|
+
!_ && /* @__PURE__ */ k("p", {
|
|
1673
1484
|
role: "status",
|
|
1674
1485
|
children: "This instance is no longer in the current inventory. Its retained requests are still available below."
|
|
1675
1486
|
}),
|
|
1676
|
-
s && /* @__PURE__ */
|
|
1487
|
+
s && /* @__PURE__ */ k($e, {
|
|
1677
1488
|
stats: s.get(p),
|
|
1678
1489
|
range: c
|
|
1679
1490
|
}),
|
|
1680
|
-
_ && /* @__PURE__ */
|
|
1681
|
-
e.watchRequests || e.
|
|
1491
|
+
_ && /* @__PURE__ */ k(et, { waiting: _.waiting }),
|
|
1492
|
+
e.watchRequests || e.listRequests ? /* @__PURE__ */ k(Ie, {
|
|
1682
1493
|
client: e,
|
|
1683
1494
|
actor: {
|
|
1684
1495
|
actorName: r,
|
|
1685
1496
|
actorId: p
|
|
1686
1497
|
},
|
|
1687
1498
|
timeRange: c
|
|
1688
|
-
}, p) : /* @__PURE__ */
|
|
1689
|
-
_ && /* @__PURE__ */
|
|
1499
|
+
}, p) : /* @__PURE__ */ A("section", { children: [/* @__PURE__ */ k("h3", { children: "Requests" }), /* @__PURE__ */ k("p", { children: "Request timings are unavailable for this connection." })] }),
|
|
1500
|
+
_ && /* @__PURE__ */ k(nt, {
|
|
1690
1501
|
id: h,
|
|
1691
1502
|
actorId: _.actorId,
|
|
1692
1503
|
connections: _.connections
|
|
@@ -1694,141 +1505,141 @@ function Ge({ client: e, id: n, actorName: r, instances: o, waits: s, range: c }
|
|
|
1694
1505
|
]
|
|
1695
1506
|
});
|
|
1696
1507
|
}
|
|
1697
|
-
function
|
|
1698
|
-
return e ? /* @__PURE__ */
|
|
1508
|
+
function Qe({ stats: e }) {
|
|
1509
|
+
return e ? /* @__PURE__ */ A("span", {
|
|
1699
1510
|
className: "la-observer-wait",
|
|
1700
|
-
title: `Average of ${e.admitted.toLocaleString()} admitted requests in the selected time range; longest wait ${
|
|
1701
|
-
children: [
|
|
1702
|
-
}) : /* @__PURE__ */
|
|
1511
|
+
title: `Average of ${e.admitted.toLocaleString()} admitted requests in the selected time range; longest wait ${X(e.maxMs)}`,
|
|
1512
|
+
children: [X(e.averageMs), /* @__PURE__ */ A("small", { children: ["max ", X(e.maxMs)] })]
|
|
1513
|
+
}) : /* @__PURE__ */ k("span", {
|
|
1703
1514
|
title: "No admitted requests in the selected time range",
|
|
1704
1515
|
children: "—"
|
|
1705
1516
|
});
|
|
1706
1517
|
}
|
|
1707
|
-
function
|
|
1708
|
-
return /* @__PURE__ */
|
|
1518
|
+
function $e({ stats: e, range: t }) {
|
|
1519
|
+
return /* @__PURE__ */ A("section", {
|
|
1709
1520
|
className: "la-observer-queue-wait-detail",
|
|
1710
1521
|
"aria-label": "Queue wait",
|
|
1711
1522
|
children: [
|
|
1712
|
-
/* @__PURE__ */
|
|
1713
|
-
/* @__PURE__ */
|
|
1714
|
-
e && /* @__PURE__ */
|
|
1523
|
+
/* @__PURE__ */ k("h3", { children: "Queue wait" }),
|
|
1524
|
+
/* @__PURE__ */ k("p", { children: e ? `Time requests spent waiting to enter this actor ${H(t)}.` : `No requests were admitted to this actor ${H(t)}.` }),
|
|
1525
|
+
e && /* @__PURE__ */ A("dl", {
|
|
1715
1526
|
className: "la-observer-summary la-observer-summary-compact",
|
|
1716
1527
|
children: [
|
|
1717
|
-
/* @__PURE__ */
|
|
1718
|
-
/* @__PURE__ */
|
|
1719
|
-
/* @__PURE__ */
|
|
1528
|
+
/* @__PURE__ */ A("div", { children: [
|
|
1529
|
+
/* @__PURE__ */ k("dt", { children: "Average" }),
|
|
1530
|
+
/* @__PURE__ */ k("dd", {
|
|
1720
1531
|
"aria-label": "Average queue wait",
|
|
1721
|
-
children:
|
|
1532
|
+
children: X(e.averageMs)
|
|
1722
1533
|
}),
|
|
1723
|
-
/* @__PURE__ */
|
|
1534
|
+
/* @__PURE__ */ k("p", { children: "Per admitted request" })
|
|
1724
1535
|
] }),
|
|
1725
|
-
/* @__PURE__ */
|
|
1726
|
-
/* @__PURE__ */
|
|
1727
|
-
/* @__PURE__ */
|
|
1536
|
+
/* @__PURE__ */ A("div", { children: [
|
|
1537
|
+
/* @__PURE__ */ k("dt", { children: "Longest" }),
|
|
1538
|
+
/* @__PURE__ */ k("dd", {
|
|
1728
1539
|
"aria-label": "Longest queue wait",
|
|
1729
|
-
children:
|
|
1540
|
+
children: X(e.maxMs)
|
|
1730
1541
|
}),
|
|
1731
|
-
/* @__PURE__ */
|
|
1542
|
+
/* @__PURE__ */ k("p", { children: "Single request" })
|
|
1732
1543
|
] }),
|
|
1733
|
-
/* @__PURE__ */
|
|
1734
|
-
/* @__PURE__ */
|
|
1735
|
-
/* @__PURE__ */
|
|
1544
|
+
/* @__PURE__ */ A("div", { children: [
|
|
1545
|
+
/* @__PURE__ */ k("dt", { children: "Admitted" }),
|
|
1546
|
+
/* @__PURE__ */ k("dd", {
|
|
1736
1547
|
"aria-label": "Admitted requests",
|
|
1737
1548
|
children: e.admitted.toLocaleString()
|
|
1738
1549
|
}),
|
|
1739
|
-
/* @__PURE__ */
|
|
1550
|
+
/* @__PURE__ */ k("p", { children: "Requests that entered the actor" })
|
|
1740
1551
|
] })
|
|
1741
1552
|
]
|
|
1742
1553
|
})
|
|
1743
1554
|
]
|
|
1744
1555
|
});
|
|
1745
1556
|
}
|
|
1746
|
-
function
|
|
1747
|
-
return /* @__PURE__ */
|
|
1557
|
+
function et({ waiting: e }) {
|
|
1558
|
+
return /* @__PURE__ */ A("section", {
|
|
1748
1559
|
className: "la-observer-waiting",
|
|
1749
1560
|
"aria-label": "Waiting requests",
|
|
1750
1561
|
children: [
|
|
1751
|
-
/* @__PURE__ */
|
|
1752
|
-
/* @__PURE__ */
|
|
1753
|
-
!!e?.length && /* @__PURE__ */
|
|
1562
|
+
/* @__PURE__ */ A("h3", { children: ["Waiting requests", e != null && ` (${e.length})`] }),
|
|
1563
|
+
/* @__PURE__ */ k("p", { children: e == null ? "This host has not reported its waiting line." : e.length ? "Next to run first. Operations leave this line when they start." : "No requests waiting." }),
|
|
1564
|
+
!!e?.length && /* @__PURE__ */ k(tt, { waiting: e })
|
|
1754
1565
|
]
|
|
1755
1566
|
});
|
|
1756
1567
|
}
|
|
1757
|
-
function
|
|
1758
|
-
if (e == null) return /* @__PURE__ */
|
|
1568
|
+
function tt({ waiting: e, compact: t = !1 }) {
|
|
1569
|
+
if (e == null) return /* @__PURE__ */ k("span", {
|
|
1759
1570
|
title: "Queue reporting is unavailable",
|
|
1760
1571
|
children: "Unavailable"
|
|
1761
1572
|
});
|
|
1762
|
-
if (!e.length) return /* @__PURE__ */
|
|
1573
|
+
if (!e.length) return /* @__PURE__ */ k("span", {
|
|
1763
1574
|
className: "la-observer-queue-empty",
|
|
1764
1575
|
children: "None"
|
|
1765
1576
|
});
|
|
1766
1577
|
let n = t ? e.slice(0, 3) : e;
|
|
1767
|
-
return /* @__PURE__ */
|
|
1578
|
+
return /* @__PURE__ */ A("ol", {
|
|
1768
1579
|
className: `la-observer-queue${t ? " la-observer-queue-compact" : ""}`,
|
|
1769
1580
|
"aria-label": `${e.length} waiting requests, next to run first`,
|
|
1770
|
-
children: [n.map((e, n) => /* @__PURE__ */
|
|
1581
|
+
children: [n.map((e, n) => /* @__PURE__ */ k("li", { children: /* @__PURE__ */ A(U, {
|
|
1771
1582
|
variant: "outline",
|
|
1772
1583
|
className: "la-observer-queue-bubble",
|
|
1773
1584
|
title: e.operation,
|
|
1774
|
-
children: [!t && /* @__PURE__ */
|
|
1585
|
+
children: [!t && /* @__PURE__ */ k("span", {
|
|
1775
1586
|
className: "la-observer-queue-position",
|
|
1776
1587
|
children: n + 1
|
|
1777
|
-
}), /* @__PURE__ */
|
|
1588
|
+
}), /* @__PURE__ */ k("span", {
|
|
1778
1589
|
className: "la-observer-queue-operation",
|
|
1779
1590
|
children: e.operation
|
|
1780
1591
|
})]
|
|
1781
|
-
}) }, e.id)), t && e.length > n.length && /* @__PURE__ */
|
|
1592
|
+
}) }, e.id)), t && e.length > n.length && /* @__PURE__ */ k("li", { children: /* @__PURE__ */ A(U, {
|
|
1782
1593
|
"aria-label": `${e.length - n.length} more waiting requests`,
|
|
1783
1594
|
children: ["+", e.length - n.length]
|
|
1784
1595
|
}) })]
|
|
1785
1596
|
});
|
|
1786
1597
|
}
|
|
1787
|
-
function
|
|
1788
|
-
return /* @__PURE__ */
|
|
1598
|
+
function nt({ id: e, actorId: t, connections: n }) {
|
|
1599
|
+
return /* @__PURE__ */ A("section", {
|
|
1789
1600
|
id: e,
|
|
1790
1601
|
className: "la-observer-connections",
|
|
1791
1602
|
"aria-labelledby": `${e}-heading`,
|
|
1792
|
-
children: [/* @__PURE__ */
|
|
1603
|
+
children: [/* @__PURE__ */ k("div", {
|
|
1793
1604
|
className: "la-observer-instances-heading",
|
|
1794
|
-
children: /* @__PURE__ */
|
|
1605
|
+
children: /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ A("h3", {
|
|
1795
1606
|
id: `${e}-heading`,
|
|
1796
1607
|
children: [
|
|
1797
1608
|
t,
|
|
1798
1609
|
" WebSockets ",
|
|
1799
|
-
/* @__PURE__ */
|
|
1610
|
+
/* @__PURE__ */ k(U, {
|
|
1800
1611
|
"aria-hidden": "true",
|
|
1801
1612
|
children: n.length.toLocaleString()
|
|
1802
1613
|
})
|
|
1803
1614
|
]
|
|
1804
|
-
}), /* @__PURE__ */
|
|
1805
|
-
}), n.length ? /* @__PURE__ */
|
|
1615
|
+
}), /* @__PURE__ */ k("p", { children: `${n.length.toLocaleString()} active ${n.length === 1 ? "connection" : "connections"}` })] })
|
|
1616
|
+
}), n.length ? /* @__PURE__ */ k("div", {
|
|
1806
1617
|
className: "la-observer-table-frame",
|
|
1807
|
-
children: /* @__PURE__ */
|
|
1618
|
+
children: /* @__PURE__ */ A(W, {
|
|
1808
1619
|
"aria-label": `${t} WebSocket connections`,
|
|
1809
1620
|
className: "la-observer-connection-table",
|
|
1810
|
-
children: [/* @__PURE__ */
|
|
1621
|
+
children: [/* @__PURE__ */ k(G, { children: /* @__PURE__ */ A(q, { children: [/* @__PURE__ */ k(J, {
|
|
1811
1622
|
scope: "col",
|
|
1812
1623
|
children: "Socket"
|
|
1813
|
-
}), /* @__PURE__ */
|
|
1624
|
+
}), /* @__PURE__ */ k(J, {
|
|
1814
1625
|
scope: "col",
|
|
1815
1626
|
children: "Metadata"
|
|
1816
|
-
})] }) }), /* @__PURE__ */
|
|
1627
|
+
})] }) }), /* @__PURE__ */ k(K, { children: n.map((e) => /* @__PURE__ */ A(q, { children: [/* @__PURE__ */ k(Y, {
|
|
1817
1628
|
className: "la-observer-socket-id",
|
|
1818
1629
|
children: e.id
|
|
1819
|
-
}), /* @__PURE__ */
|
|
1630
|
+
}), /* @__PURE__ */ k(Y, { children: /* @__PURE__ */ k("pre", { children: JSON.stringify(e.metadata, null, 2) }) })] }, e.id)) })]
|
|
1820
1631
|
})
|
|
1821
|
-
}) : /* @__PURE__ */
|
|
1632
|
+
}) : /* @__PURE__ */ A("div", {
|
|
1822
1633
|
className: "la-observer-no-connections",
|
|
1823
1634
|
role: "status",
|
|
1824
|
-
children: [/* @__PURE__ */
|
|
1635
|
+
children: [/* @__PURE__ */ k(S, { "aria-hidden": "true" }), /* @__PURE__ */ k("p", { children: "No active WebSocket connections." })]
|
|
1825
1636
|
})]
|
|
1826
1637
|
});
|
|
1827
1638
|
}
|
|
1828
|
-
function
|
|
1829
|
-
return /* @__PURE__ */
|
|
1639
|
+
function rt({ label: e, placeholder: t, value: n, onChange: r }) {
|
|
1640
|
+
return /* @__PURE__ */ A("div", {
|
|
1830
1641
|
className: "la-observer-search",
|
|
1831
|
-
children: [/* @__PURE__ */
|
|
1642
|
+
children: [/* @__PURE__ */ k(y, { "aria-hidden": "true" }), /* @__PURE__ */ k(R, {
|
|
1832
1643
|
type: "search",
|
|
1833
1644
|
"aria-label": e,
|
|
1834
1645
|
placeholder: t,
|
|
@@ -1837,14 +1648,14 @@ function Ze({ label: e, placeholder: t, value: n, onChange: r }) {
|
|
|
1837
1648
|
})]
|
|
1838
1649
|
});
|
|
1839
1650
|
}
|
|
1840
|
-
function
|
|
1841
|
-
return /* @__PURE__ */
|
|
1651
|
+
function it({ title: e, description: t, action: n, onReset: r }) {
|
|
1652
|
+
return /* @__PURE__ */ A("div", {
|
|
1842
1653
|
className: "la-observer-empty",
|
|
1843
1654
|
children: [
|
|
1844
|
-
/* @__PURE__ */
|
|
1845
|
-
/* @__PURE__ */
|
|
1846
|
-
/* @__PURE__ */
|
|
1847
|
-
n && /* @__PURE__ */
|
|
1655
|
+
/* @__PURE__ */ k(y, { "aria-hidden": "true" }),
|
|
1656
|
+
/* @__PURE__ */ k("h3", { children: e }),
|
|
1657
|
+
/* @__PURE__ */ k("p", { children: t }),
|
|
1658
|
+
n && /* @__PURE__ */ k(L, {
|
|
1848
1659
|
type: "button",
|
|
1849
1660
|
variant: "outline",
|
|
1850
1661
|
onClick: r,
|
|
@@ -1853,11 +1664,1573 @@ function $({ title: e, description: t, action: n, onReset: r }) {
|
|
|
1853
1664
|
]
|
|
1854
1665
|
});
|
|
1855
1666
|
}
|
|
1856
|
-
function
|
|
1667
|
+
function at(e, t) {
|
|
1857
1668
|
return e.toLocaleLowerCase().includes(t.trim().toLocaleLowerCase());
|
|
1858
1669
|
}
|
|
1859
|
-
function
|
|
1670
|
+
function ot(e) {
|
|
1860
1671
|
return e[0].toUpperCase() + e.slice(1);
|
|
1861
1672
|
}
|
|
1862
1673
|
//#endregion
|
|
1863
|
-
|
|
1674
|
+
//#region src/overview-data.ts
|
|
1675
|
+
function st(e) {
|
|
1676
|
+
let t = e.filter((e) => e.outcome !== "rerouted");
|
|
1677
|
+
return {
|
|
1678
|
+
count: e.length,
|
|
1679
|
+
success: t.length ? 100 * t.filter((e) => e.outcome === "completed").length / t.length : null,
|
|
1680
|
+
p95: dt(t.map((e) => e.durationMs))
|
|
1681
|
+
};
|
|
1682
|
+
}
|
|
1683
|
+
function ct(e, t, n) {
|
|
1684
|
+
return e.filter((e) => e.startedAtMs >= (t.fromMs ?? 0) && e.startedAtMs <= (t.toMs ?? n));
|
|
1685
|
+
}
|
|
1686
|
+
function lt(e) {
|
|
1687
|
+
return e.actors.reduce((e, t) => ({
|
|
1688
|
+
live: e.live + t.live,
|
|
1689
|
+
dormant: e.dormant + t.dormant,
|
|
1690
|
+
unknown: e.unknown + t.unknown,
|
|
1691
|
+
connections: e.connections + t.instances.reduce((e, t) => e + t.connections.length, 0)
|
|
1692
|
+
}), {
|
|
1693
|
+
live: 0,
|
|
1694
|
+
dormant: 0,
|
|
1695
|
+
unknown: 0,
|
|
1696
|
+
connections: 0
|
|
1697
|
+
});
|
|
1698
|
+
}
|
|
1699
|
+
function ut(e) {
|
|
1700
|
+
return dt(e.filter((e) => e.outcome !== "rerouted" && e.queueWaitMs !== null).map((e) => e.queueWaitMs));
|
|
1701
|
+
}
|
|
1702
|
+
function dt(e) {
|
|
1703
|
+
return e.length ? e.sort((e, t) => e - t)[Math.ceil(e.length * .95) - 1] : null;
|
|
1704
|
+
}
|
|
1705
|
+
//#endregion
|
|
1706
|
+
//#region src/overview-metrics.ts
|
|
1707
|
+
function ft(e) {
|
|
1708
|
+
let t = e;
|
|
1709
|
+
if (!t || !pt(t.total) || !Array.isArray(t.classes) || !t.classes.every(pt)) throw Error("Invalid overview metrics response");
|
|
1710
|
+
return t;
|
|
1711
|
+
}
|
|
1712
|
+
function pt(e) {
|
|
1713
|
+
return !!e && typeof e.actorName == "string" && Number.isSafeInteger(e.count) && e.count >= 0 && [
|
|
1714
|
+
e.success,
|
|
1715
|
+
e.p95,
|
|
1716
|
+
e.queueP95
|
|
1717
|
+
].every((e) => e === null || typeof e == "number" && Number.isFinite(e) && e >= 0) && (e.success === null || e.success <= 100);
|
|
1718
|
+
}
|
|
1719
|
+
function mt(e) {
|
|
1720
|
+
let t = /* @__PURE__ */ new Map();
|
|
1721
|
+
for (let n of e) t.set(n.actorName, [...t.get(n.actorName) ?? [], n]);
|
|
1722
|
+
let n = (e, t) => ({
|
|
1723
|
+
actorName: e,
|
|
1724
|
+
...st(t),
|
|
1725
|
+
queueP95: ut(t)
|
|
1726
|
+
});
|
|
1727
|
+
return {
|
|
1728
|
+
total: n("", e),
|
|
1729
|
+
classes: [...t].map(([e, t]) => n(e, t))
|
|
1730
|
+
};
|
|
1731
|
+
}
|
|
1732
|
+
//#endregion
|
|
1733
|
+
//#region src/Overview.tsx
|
|
1734
|
+
function ht({ client: e, onSelectActor: n, timeRange: r, onTimeRangeChange: i }) {
|
|
1735
|
+
let o = je(e), [s, c] = a(z), l = r ?? s, u = i ?? c, [d, f] = a(Date.now);
|
|
1736
|
+
t(() => {
|
|
1737
|
+
let e = setInterval(() => f(Date.now()), 1e4);
|
|
1738
|
+
return () => clearInterval(e);
|
|
1739
|
+
}, []);
|
|
1740
|
+
let p = B(l, d), m = Pe(e, p, e.getMetrics), h = Me(e, !m.supported), g = h.page ? mt(ct(h.page.records, p, Math.max(d, Date.now()))) : void 0, _ = m.supported ? m.value : g, v = m.supported ? m.failed : h.failed;
|
|
1741
|
+
return /* @__PURE__ */ A("section", {
|
|
1742
|
+
className: "la-observer overview",
|
|
1743
|
+
"aria-label": "Runtime overview",
|
|
1744
|
+
children: [
|
|
1745
|
+
/* @__PURE__ */ A("div", {
|
|
1746
|
+
className: "overview-heading",
|
|
1747
|
+
children: [/* @__PURE__ */ k("h1", { children: "Durable Actors" }), /* @__PURE__ */ A("div", {
|
|
1748
|
+
className: "overview-controls",
|
|
1749
|
+
children: [
|
|
1750
|
+
/* @__PURE__ */ k("span", {
|
|
1751
|
+
className: "overview-updated",
|
|
1752
|
+
children: o.failed ? "Inventory reconnecting…" : o.updatedAt ? /* @__PURE__ */ A(O, { children: ["Last inventory update ", /* @__PURE__ */ k("time", {
|
|
1753
|
+
dateTime: new Date(o.updatedAt).toISOString(),
|
|
1754
|
+
children: new Date(o.updatedAt).toLocaleTimeString([], { hour12: !1 })
|
|
1755
|
+
})] }) : "Connecting…"
|
|
1756
|
+
}),
|
|
1757
|
+
/* @__PURE__ */ k(_e, {
|
|
1758
|
+
value: l,
|
|
1759
|
+
onChange: u,
|
|
1760
|
+
className: "overview-range"
|
|
1761
|
+
}),
|
|
1762
|
+
/* @__PURE__ */ k(L, {
|
|
1763
|
+
variant: "outline",
|
|
1764
|
+
size: "icon",
|
|
1765
|
+
"aria-label": "Refresh overview",
|
|
1766
|
+
onClick: () => {
|
|
1767
|
+
o.retry(), m.retry(), h.retry();
|
|
1768
|
+
},
|
|
1769
|
+
children: /* @__PURE__ */ k(te, { "aria-hidden": "true" })
|
|
1770
|
+
})
|
|
1771
|
+
]
|
|
1772
|
+
})]
|
|
1773
|
+
}),
|
|
1774
|
+
o.failed && /* @__PURE__ */ A("p", {
|
|
1775
|
+
className: "overview-alert",
|
|
1776
|
+
role: "alert",
|
|
1777
|
+
children: [
|
|
1778
|
+
"Inventory unavailable. ",
|
|
1779
|
+
o.inventory ? "Showing the last received counts; they may be out of date." : "Check your connection and access.",
|
|
1780
|
+
" Retrying automatically."
|
|
1781
|
+
]
|
|
1782
|
+
}),
|
|
1783
|
+
v && /* @__PURE__ */ A("p", {
|
|
1784
|
+
className: "overview-alert",
|
|
1785
|
+
role: "alert",
|
|
1786
|
+
children: [
|
|
1787
|
+
m.supported ? "Request history unavailable." : "Request stream unavailable.",
|
|
1788
|
+
" ",
|
|
1789
|
+
_ ? "Showing the last received metrics." : "Request metrics are not available yet.",
|
|
1790
|
+
" ",
|
|
1791
|
+
"Retrying automatically."
|
|
1792
|
+
]
|
|
1793
|
+
}),
|
|
1794
|
+
/* @__PURE__ */ k(gt, {
|
|
1795
|
+
inventory: o.inventory,
|
|
1796
|
+
metrics: _,
|
|
1797
|
+
range: l
|
|
1798
|
+
}),
|
|
1799
|
+
/* @__PURE__ */ k(_t, {
|
|
1800
|
+
inventory: o.inventory,
|
|
1801
|
+
metrics: _,
|
|
1802
|
+
failed: o.failed,
|
|
1803
|
+
onSelectActor: n
|
|
1804
|
+
}),
|
|
1805
|
+
/* @__PURE__ */ k(xt, {
|
|
1806
|
+
page: m.supported ? void 0 : h.page,
|
|
1807
|
+
range: l,
|
|
1808
|
+
saved: m.supported
|
|
1809
|
+
})
|
|
1810
|
+
]
|
|
1811
|
+
});
|
|
1812
|
+
}
|
|
1813
|
+
function gt({ inventory: e, metrics: t, range: n }) {
|
|
1814
|
+
let r = e ? lt(e) : void 0, i = r ? r.live + r.dormant + r.unknown : void 0, a = t?.total;
|
|
1815
|
+
return /* @__PURE__ */ A("div", {
|
|
1816
|
+
className: "overview-metrics",
|
|
1817
|
+
children: [
|
|
1818
|
+
/* @__PURE__ */ A("section", {
|
|
1819
|
+
className: "overview-metric",
|
|
1820
|
+
children: [
|
|
1821
|
+
/* @__PURE__ */ k("h2", { children: "Actor instances" }),
|
|
1822
|
+
/* @__PURE__ */ A("div", {
|
|
1823
|
+
className: "overview-value",
|
|
1824
|
+
children: [/* @__PURE__ */ k("strong", {
|
|
1825
|
+
"aria-label": "Actor instances",
|
|
1826
|
+
children: Z(i)
|
|
1827
|
+
}), /* @__PURE__ */ k("span", { children: e ? `${e.actors.length} actor ${e.actors.length === 1 ? "class" : "classes"}` : "Waiting for inventory" })]
|
|
1828
|
+
}),
|
|
1829
|
+
/* @__PURE__ */ k("div", {
|
|
1830
|
+
className: "overview-residency",
|
|
1831
|
+
"aria-hidden": "true",
|
|
1832
|
+
children: r && Object.entries(r).filter(([e]) => e !== "connections").map(([e, t]) => /* @__PURE__ */ k("span", {
|
|
1833
|
+
className: `residency-${e}`,
|
|
1834
|
+
style: { flexGrow: t }
|
|
1835
|
+
}, e))
|
|
1836
|
+
}),
|
|
1837
|
+
/* @__PURE__ */ A("div", {
|
|
1838
|
+
className: "overview-metric-foot",
|
|
1839
|
+
children: [
|
|
1840
|
+
/* @__PURE__ */ A("span", { children: [/* @__PURE__ */ k("b", { children: Z(r?.live) }), " live"] }),
|
|
1841
|
+
/* @__PURE__ */ A("span", { children: [/* @__PURE__ */ k("b", { children: Z(r?.dormant) }), " dormant"] }),
|
|
1842
|
+
!!r?.unknown && /* @__PURE__ */ A("span", { children: [/* @__PURE__ */ k("b", { children: Z(r.unknown) }), " unknown"] })
|
|
1843
|
+
]
|
|
1844
|
+
})
|
|
1845
|
+
]
|
|
1846
|
+
}),
|
|
1847
|
+
/* @__PURE__ */ A("section", {
|
|
1848
|
+
className: "overview-metric",
|
|
1849
|
+
children: [
|
|
1850
|
+
/* @__PURE__ */ k("h2", { children: "Requests" }),
|
|
1851
|
+
/* @__PURE__ */ A("div", {
|
|
1852
|
+
className: "overview-value",
|
|
1853
|
+
children: [/* @__PURE__ */ k("strong", {
|
|
1854
|
+
"aria-label": "Retained requests",
|
|
1855
|
+
children: Z(a?.count)
|
|
1856
|
+
}), /* @__PURE__ */ k("span", { children: H(n) })]
|
|
1857
|
+
}),
|
|
1858
|
+
/* @__PURE__ */ A("div", {
|
|
1859
|
+
className: "overview-health",
|
|
1860
|
+
children: [
|
|
1861
|
+
/* @__PURE__ */ A("span", { children: [/* @__PURE__ */ k(yt, {
|
|
1862
|
+
value: a?.success,
|
|
1863
|
+
kind: "success"
|
|
1864
|
+
}), " success"] }),
|
|
1865
|
+
/* @__PURE__ */ A("span", { children: [/* @__PURE__ */ k(yt, {
|
|
1866
|
+
value: a?.p95,
|
|
1867
|
+
kind: "latency"
|
|
1868
|
+
}), " p95 latency"] }),
|
|
1869
|
+
/* @__PURE__ */ A("span", { children: [/* @__PURE__ */ k("b", { children: Ct(a?.queueP95) }), " p95 queue wait"] })
|
|
1870
|
+
]
|
|
1871
|
+
})
|
|
1872
|
+
]
|
|
1873
|
+
}),
|
|
1874
|
+
/* @__PURE__ */ A("section", {
|
|
1875
|
+
className: "overview-metric",
|
|
1876
|
+
children: [
|
|
1877
|
+
/* @__PURE__ */ k("h2", { children: "WebSocket connections" }),
|
|
1878
|
+
/* @__PURE__ */ A("div", {
|
|
1879
|
+
className: "overview-value",
|
|
1880
|
+
children: [/* @__PURE__ */ k("strong", {
|
|
1881
|
+
"aria-label": "Open WebSocket connections",
|
|
1882
|
+
children: Z(r?.connections)
|
|
1883
|
+
}), /* @__PURE__ */ k("span", { children: "open" })]
|
|
1884
|
+
}),
|
|
1885
|
+
/* @__PURE__ */ A("div", {
|
|
1886
|
+
className: "overview-health",
|
|
1887
|
+
children: [/* @__PURE__ */ k("span", { children: "Current inventory snapshot" }), /* @__PURE__ */ k("span", { children: "Active sockets" })]
|
|
1888
|
+
})
|
|
1889
|
+
]
|
|
1890
|
+
})
|
|
1891
|
+
]
|
|
1892
|
+
});
|
|
1893
|
+
}
|
|
1894
|
+
function _t({ inventory: e, metrics: t, failed: n, onSelectActor: r }) {
|
|
1895
|
+
let [i, o] = a(""), [s, c] = a("all"), l = e?.actors.filter((e) => e.actorName.toLocaleLowerCase().includes(i.trim().toLocaleLowerCase()) && (s === "all" || e[s] > 0)).sort((e, t) => Number(t.live > 0) - Number(e.live > 0)) ?? [];
|
|
1896
|
+
return /* @__PURE__ */ A("section", {
|
|
1897
|
+
"aria-label": "Actor classes",
|
|
1898
|
+
children: [/* @__PURE__ */ A("div", {
|
|
1899
|
+
className: "overview-section-heading",
|
|
1900
|
+
children: [/* @__PURE__ */ A("h2", { children: ["Actor classes ", /* @__PURE__ */ k("span", { children: Z(e?.actors.length) })] }), /* @__PURE__ */ k(bt, {})]
|
|
1901
|
+
}), /* @__PURE__ */ A("div", {
|
|
1902
|
+
className: "overview-panel",
|
|
1903
|
+
children: [
|
|
1904
|
+
/* @__PURE__ */ A("div", {
|
|
1905
|
+
className: "overview-filterbar",
|
|
1906
|
+
children: [/* @__PURE__ */ A("div", {
|
|
1907
|
+
className: "overview-search",
|
|
1908
|
+
children: [/* @__PURE__ */ k(y, { "aria-hidden": "true" }), /* @__PURE__ */ k(R, {
|
|
1909
|
+
"aria-label": "Filter actor classes",
|
|
1910
|
+
placeholder: "Filter actor classes…",
|
|
1911
|
+
value: i,
|
|
1912
|
+
onInput: (e) => o(e.currentTarget.value)
|
|
1913
|
+
})]
|
|
1914
|
+
}), /* @__PURE__ */ A("select", {
|
|
1915
|
+
"aria-label": "Filter by residency",
|
|
1916
|
+
value: s,
|
|
1917
|
+
onChange: (e) => c(e.target.value),
|
|
1918
|
+
children: [
|
|
1919
|
+
/* @__PURE__ */ k("option", {
|
|
1920
|
+
value: "all",
|
|
1921
|
+
children: "All states"
|
|
1922
|
+
}),
|
|
1923
|
+
/* @__PURE__ */ k("option", {
|
|
1924
|
+
value: "live",
|
|
1925
|
+
children: "Live instances"
|
|
1926
|
+
}),
|
|
1927
|
+
/* @__PURE__ */ k("option", {
|
|
1928
|
+
value: "dormant",
|
|
1929
|
+
children: "Dormant instances"
|
|
1930
|
+
}),
|
|
1931
|
+
/* @__PURE__ */ k("option", {
|
|
1932
|
+
value: "unknown",
|
|
1933
|
+
children: "Unknown residency"
|
|
1934
|
+
})
|
|
1935
|
+
]
|
|
1936
|
+
})]
|
|
1937
|
+
}),
|
|
1938
|
+
/* @__PURE__ */ k("div", {
|
|
1939
|
+
className: "overview-table-scroll",
|
|
1940
|
+
role: "region",
|
|
1941
|
+
"aria-label": "Actor class metrics",
|
|
1942
|
+
tabIndex: 0,
|
|
1943
|
+
children: /* @__PURE__ */ A("table", {
|
|
1944
|
+
className: "overview-table",
|
|
1945
|
+
children: [
|
|
1946
|
+
/* @__PURE__ */ A("colgroup", { children: [/* @__PURE__ */ k("col", { className: "overview-class-column" }), /* @__PURE__ */ k("col", { span: 6 })] }),
|
|
1947
|
+
/* @__PURE__ */ A("thead", { children: [/* @__PURE__ */ A("tr", {
|
|
1948
|
+
className: "overview-groups",
|
|
1949
|
+
children: [
|
|
1950
|
+
/* @__PURE__ */ k("th", {
|
|
1951
|
+
scope: "colgroup",
|
|
1952
|
+
colSpan: 2,
|
|
1953
|
+
children: "Actors"
|
|
1954
|
+
}),
|
|
1955
|
+
/* @__PURE__ */ k("th", {
|
|
1956
|
+
scope: "colgroup",
|
|
1957
|
+
colSpan: 4,
|
|
1958
|
+
children: "Requests"
|
|
1959
|
+
}),
|
|
1960
|
+
/* @__PURE__ */ k("th", {
|
|
1961
|
+
scope: "colgroup",
|
|
1962
|
+
children: "WebSockets"
|
|
1963
|
+
})
|
|
1964
|
+
]
|
|
1965
|
+
}), /* @__PURE__ */ A("tr", { children: [
|
|
1966
|
+
/* @__PURE__ */ k("th", {
|
|
1967
|
+
scope: "col",
|
|
1968
|
+
children: "Class"
|
|
1969
|
+
}),
|
|
1970
|
+
/* @__PURE__ */ k("th", {
|
|
1971
|
+
scope: "col",
|
|
1972
|
+
children: "Instances"
|
|
1973
|
+
}),
|
|
1974
|
+
/* @__PURE__ */ k("th", {
|
|
1975
|
+
scope: "col",
|
|
1976
|
+
children: "Total"
|
|
1977
|
+
}),
|
|
1978
|
+
/* @__PURE__ */ k("th", {
|
|
1979
|
+
scope: "col",
|
|
1980
|
+
children: "Success"
|
|
1981
|
+
}),
|
|
1982
|
+
/* @__PURE__ */ k("th", {
|
|
1983
|
+
scope: "col",
|
|
1984
|
+
children: "p95 latency"
|
|
1985
|
+
}),
|
|
1986
|
+
/* @__PURE__ */ k("th", {
|
|
1987
|
+
scope: "col",
|
|
1988
|
+
children: "p95 queue wait"
|
|
1989
|
+
}),
|
|
1990
|
+
/* @__PURE__ */ k("th", {
|
|
1991
|
+
scope: "col",
|
|
1992
|
+
children: "Connected"
|
|
1993
|
+
})
|
|
1994
|
+
] })] }),
|
|
1995
|
+
/* @__PURE__ */ k("tbody", { children: l.map((e) => /* @__PURE__ */ k(vt, {
|
|
1996
|
+
actor: e,
|
|
1997
|
+
metrics: t && (t.classes.find((t) => t.actorName === e.actorName) ?? St(e.actorName)),
|
|
1998
|
+
onSelectActor: r
|
|
1999
|
+
}, e.actorName)) })
|
|
2000
|
+
]
|
|
2001
|
+
})
|
|
2002
|
+
}),
|
|
2003
|
+
!l.length && /* @__PURE__ */ A("div", {
|
|
2004
|
+
className: "overview-empty",
|
|
2005
|
+
role: "status",
|
|
2006
|
+
children: [
|
|
2007
|
+
/* @__PURE__ */ k("strong", { children: e ? e.actors.length ? "No matching actor classes" : "No actors yet" : n ? "Inventory unavailable" : "Loading actor classes…" }),
|
|
2008
|
+
/* @__PURE__ */ k("p", { children: e?.actors.length ? "Try another class name or residency state." : "Actor classes appear after deployment." }),
|
|
2009
|
+
!!e?.actors.length && /* @__PURE__ */ k(L, {
|
|
2010
|
+
variant: "outline",
|
|
2011
|
+
onClick: () => {
|
|
2012
|
+
o(""), c("all");
|
|
2013
|
+
},
|
|
2014
|
+
children: "Clear filters"
|
|
2015
|
+
})
|
|
2016
|
+
]
|
|
2017
|
+
})
|
|
2018
|
+
]
|
|
2019
|
+
})]
|
|
2020
|
+
});
|
|
2021
|
+
}
|
|
2022
|
+
function vt({ actor: e, metrics: t, onSelectActor: n }) {
|
|
2023
|
+
return /* @__PURE__ */ A("tr", {
|
|
2024
|
+
className: "la-clickable-row",
|
|
2025
|
+
onClick: () => n(e.actorName),
|
|
2026
|
+
children: [
|
|
2027
|
+
/* @__PURE__ */ k("td", { children: /* @__PURE__ */ k(L, {
|
|
2028
|
+
variant: "ghost",
|
|
2029
|
+
type: "button",
|
|
2030
|
+
className: "overview-class-link",
|
|
2031
|
+
"aria-label": `Inspect ${e.actorName}`,
|
|
2032
|
+
children: /* @__PURE__ */ k("span", {
|
|
2033
|
+
title: e.actorName,
|
|
2034
|
+
children: e.actorName
|
|
2035
|
+
})
|
|
2036
|
+
}) }),
|
|
2037
|
+
/* @__PURE__ */ k("td", { children: Z(e.live + e.dormant + e.unknown) }),
|
|
2038
|
+
/* @__PURE__ */ k("td", { children: Z(t?.count) }),
|
|
2039
|
+
/* @__PURE__ */ k("td", { children: /* @__PURE__ */ k(yt, {
|
|
2040
|
+
value: t?.success,
|
|
2041
|
+
kind: "success"
|
|
2042
|
+
}) }),
|
|
2043
|
+
/* @__PURE__ */ k("td", { children: /* @__PURE__ */ k(yt, {
|
|
2044
|
+
value: t?.p95,
|
|
2045
|
+
kind: "latency"
|
|
2046
|
+
}) }),
|
|
2047
|
+
/* @__PURE__ */ k("td", { children: Ct(t?.queueP95) }),
|
|
2048
|
+
/* @__PURE__ */ k("td", { children: Z(e.instances.reduce((e, t) => e + t.connections.length, 0)) })
|
|
2049
|
+
]
|
|
2050
|
+
});
|
|
2051
|
+
}
|
|
2052
|
+
function yt({ value: e, kind: t }) {
|
|
2053
|
+
if (e == null) return /* @__PURE__ */ k("span", {
|
|
2054
|
+
title: "No retained execution attempts",
|
|
2055
|
+
children: "—"
|
|
2056
|
+
});
|
|
2057
|
+
let n = t === "success" ? e < 95 ? "bad" : e < 99 ? "warn" : "good" : e > 100 ? "bad" : "good";
|
|
2058
|
+
return /* @__PURE__ */ A("span", {
|
|
2059
|
+
className: `overview-signal signal-${n}`,
|
|
2060
|
+
title: n === "bad" ? "Critical threshold breached" : n === "warn" ? "Warning threshold breached" : "Within threshold",
|
|
2061
|
+
children: [n !== "good" && /* @__PURE__ */ k("span", {
|
|
2062
|
+
"aria-hidden": "true",
|
|
2063
|
+
children: n === "warn" ? "!" : "×"
|
|
2064
|
+
}), t === "success" ? `${e.toLocaleString(void 0, { maximumFractionDigits: 2 })}%` : Ct(e)]
|
|
2065
|
+
});
|
|
2066
|
+
}
|
|
2067
|
+
function bt() {
|
|
2068
|
+
return /* @__PURE__ */ A("details", {
|
|
2069
|
+
className: "overview-thresholds",
|
|
2070
|
+
children: [/* @__PURE__ */ A("summary", { children: [/* @__PURE__ */ A("span", {
|
|
2071
|
+
className: "threshold-dots",
|
|
2072
|
+
"aria-hidden": "true",
|
|
2073
|
+
children: [
|
|
2074
|
+
/* @__PURE__ */ k("i", {}),
|
|
2075
|
+
/* @__PURE__ */ k("i", {}),
|
|
2076
|
+
/* @__PURE__ */ k("i", {})
|
|
2077
|
+
]
|
|
2078
|
+
}), "Thresholds"] }), /* @__PURE__ */ A("div", { children: [
|
|
2079
|
+
/* @__PURE__ */ k("strong", { children: "Display thresholds" }),
|
|
2080
|
+
/* @__PURE__ */ k("p", { children: "Success: warning below 99%; critical below 95%." }),
|
|
2081
|
+
/* @__PURE__ */ k("p", { children: "Latency: critical when p95 exceeds 100 ms." }),
|
|
2082
|
+
/* @__PURE__ */ k("p", { children: "Reroutes are excluded from success and latency. Queue wait has no health threshold." })
|
|
2083
|
+
] })]
|
|
2084
|
+
});
|
|
2085
|
+
}
|
|
2086
|
+
function xt({ page: e, range: t, saved: n }) {
|
|
2087
|
+
return /* @__PURE__ */ A("div", {
|
|
2088
|
+
className: "overview-data-scope",
|
|
2089
|
+
children: [
|
|
2090
|
+
/* @__PURE__ */ k("p", { children: n ? `Request metrics cover every retained request ${H(t)}${t.kind === "relative" ? " (refreshed every 10 seconds)" : ""}. Inventory counts are current snapshots.` : `Request metrics cover the latest ${e?.capacity ?? 500} retained traces within the selected window. Inventory counts are current snapshots.` }),
|
|
2091
|
+
!!e?.dropped && /* @__PURE__ */ A("p", {
|
|
2092
|
+
role: "alert",
|
|
2093
|
+
children: [Z(e.dropped), " traces were not delivered. Request metrics are incomplete."]
|
|
2094
|
+
}),
|
|
2095
|
+
e?.persistenceFailed && /* @__PURE__ */ k("p", {
|
|
2096
|
+
role: "alert",
|
|
2097
|
+
children: "Some request events could not be saved. This history may be incomplete."
|
|
2098
|
+
}),
|
|
2099
|
+
!!e?.evicted && /* @__PURE__ */ k("p", { children: "Earlier traces have expired; these metrics do not represent the full time window." })
|
|
2100
|
+
]
|
|
2101
|
+
});
|
|
2102
|
+
}
|
|
2103
|
+
function St(e) {
|
|
2104
|
+
return {
|
|
2105
|
+
actorName: e,
|
|
2106
|
+
count: 0,
|
|
2107
|
+
success: null,
|
|
2108
|
+
p95: null,
|
|
2109
|
+
queueP95: null
|
|
2110
|
+
};
|
|
2111
|
+
}
|
|
2112
|
+
function Z(e) {
|
|
2113
|
+
return e === void 0 ? "—" : e.toLocaleString();
|
|
2114
|
+
}
|
|
2115
|
+
function Ct(e) {
|
|
2116
|
+
return e == null ? "—" : `${e.toLocaleString(void 0, { maximumFractionDigits: 1 })} ms`;
|
|
2117
|
+
}
|
|
2118
|
+
//#endregion
|
|
2119
|
+
//#region src/components/ui/command.tsx
|
|
2120
|
+
function wt({ className: e, ...t }) {
|
|
2121
|
+
return /* @__PURE__ */ k(F, {
|
|
2122
|
+
"data-slot": "command",
|
|
2123
|
+
className: I("la:flex la:h-full la:w-full la:flex-col la:overflow-hidden la:rounded-md la:bg-popover la:text-popover-foreground", e),
|
|
2124
|
+
...t
|
|
2125
|
+
});
|
|
2126
|
+
}
|
|
2127
|
+
function Tt({ className: e, ...t }) {
|
|
2128
|
+
return /* @__PURE__ */ A("div", {
|
|
2129
|
+
"data-slot": "command-input-wrapper",
|
|
2130
|
+
className: "la:flex la:h-9 la:items-center la:gap-2 la:border-b la:px-3",
|
|
2131
|
+
children: [/* @__PURE__ */ k(b, { className: "la:size-4 la:shrink-0 la:opacity-50" }), /* @__PURE__ */ k(F.Input, {
|
|
2132
|
+
"data-slot": "command-input",
|
|
2133
|
+
className: I("la:flex la:h-10 la:w-full la:rounded-md la:bg-transparent la:py-3 la:text-sm la:outline-hidden la:placeholder:text-muted-foreground la:disabled:cursor-not-allowed la:disabled:opacity-50", e),
|
|
2134
|
+
...t
|
|
2135
|
+
})]
|
|
2136
|
+
});
|
|
2137
|
+
}
|
|
2138
|
+
function Et({ className: e, ...t }) {
|
|
2139
|
+
return /* @__PURE__ */ k(F.List, {
|
|
2140
|
+
"data-slot": "command-list",
|
|
2141
|
+
className: I("la:max-h-[300px] la:scroll-py-1 la:overflow-x-hidden la:overflow-y-auto", e),
|
|
2142
|
+
...t
|
|
2143
|
+
});
|
|
2144
|
+
}
|
|
2145
|
+
function Dt({ ...e }) {
|
|
2146
|
+
return /* @__PURE__ */ k(F.Empty, {
|
|
2147
|
+
"data-slot": "command-empty",
|
|
2148
|
+
className: "la:py-6 la:text-center la:text-sm",
|
|
2149
|
+
...e
|
|
2150
|
+
});
|
|
2151
|
+
}
|
|
2152
|
+
function Ot({ className: e, ...t }) {
|
|
2153
|
+
return /* @__PURE__ */ k(F.Group, {
|
|
2154
|
+
"data-slot": "command-group",
|
|
2155
|
+
className: I("la:overflow-hidden la:p-1 la:text-foreground la:[&_[cmdk-group-heading]]:px-2 la:[&_[cmdk-group-heading]]:py-1.5 la:[&_[cmdk-group-heading]]:text-xs la:[&_[cmdk-group-heading]]:font-medium la:[&_[cmdk-group-heading]]:text-muted-foreground", e),
|
|
2156
|
+
...t
|
|
2157
|
+
});
|
|
2158
|
+
}
|
|
2159
|
+
function kt({ className: e, ...t }) {
|
|
2160
|
+
return /* @__PURE__ */ k(F.Separator, {
|
|
2161
|
+
"data-slot": "command-separator",
|
|
2162
|
+
className: I("la:-mx-1 la:h-px la:bg-border", e),
|
|
2163
|
+
...t
|
|
2164
|
+
});
|
|
2165
|
+
}
|
|
2166
|
+
function At({ className: e, ...t }) {
|
|
2167
|
+
return /* @__PURE__ */ k(F.Item, {
|
|
2168
|
+
"data-slot": "command-item",
|
|
2169
|
+
className: I("la:relative la:flex la:cursor-default la:items-center la:gap-2 la:rounded-sm la:px-2 la:py-1.5 la:text-sm la:outline-hidden la:select-none la:data-[disabled=true]:pointer-events-none la:data-[disabled=true]:opacity-50 la:data-[selected=true]:bg-accent la:data-[selected=true]:text-accent-foreground la:[&_svg]:pointer-events-none la:[&_svg]:shrink-0 la:[&_svg:not([class*='size-'])]:size-4 la:[&_svg:not([class*='text-'])]:text-muted-foreground", e),
|
|
2170
|
+
...t
|
|
2171
|
+
});
|
|
2172
|
+
}
|
|
2173
|
+
function jt({ className: e, ...t }) {
|
|
2174
|
+
return /* @__PURE__ */ k("span", {
|
|
2175
|
+
"data-slot": "command-shortcut",
|
|
2176
|
+
className: I("la:ml-auto la:text-xs la:tracking-widest la:text-muted-foreground", e),
|
|
2177
|
+
...t
|
|
2178
|
+
});
|
|
2179
|
+
}
|
|
2180
|
+
//#endregion
|
|
2181
|
+
//#region src/FilterCombobox.tsx
|
|
2182
|
+
function Mt({ label: e, placeholder: t, value: n, onChange: r, suggestions: i, limit: o = 8 }) {
|
|
2183
|
+
let [s, c] = a(!1), l = Nt(i, n, o), u = l.reduce((e, t) => e.set(t.group, [...e.get(t.group) ?? [], t]), /* @__PURE__ */ new Map()), d = s && l.length > 0;
|
|
2184
|
+
return /* @__PURE__ */ A(wt, {
|
|
2185
|
+
label: e,
|
|
2186
|
+
shouldFilter: !1,
|
|
2187
|
+
loop: !0,
|
|
2188
|
+
className: "la-combobox la:relative la:overflow-visible la:bg-transparent",
|
|
2189
|
+
onKeyDown: (e) => {
|
|
2190
|
+
e.key === "Escape" && c(!1), e.key === "ArrowDown" && c(!0);
|
|
2191
|
+
},
|
|
2192
|
+
children: [/* @__PURE__ */ k(Tt, {
|
|
2193
|
+
placeholder: t,
|
|
2194
|
+
value: n,
|
|
2195
|
+
onValueChange: (e) => {
|
|
2196
|
+
r(e), c(!0);
|
|
2197
|
+
},
|
|
2198
|
+
onFocus: () => c(!0),
|
|
2199
|
+
onBlur: () => c(!1)
|
|
2200
|
+
}), d && /* @__PURE__ */ k(Et, {
|
|
2201
|
+
label: `${e} suggestions`,
|
|
2202
|
+
className: "la:absolute la:top-full la:right-0 la:left-0 la:z-20 la:mt-1.5 la:rounded-md la:border la:bg-popover la:text-popover-foreground la:shadow-md",
|
|
2203
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
2204
|
+
children: [...u].map(([e, t]) => /* @__PURE__ */ k(Ot, {
|
|
2205
|
+
heading: e,
|
|
2206
|
+
children: t.map((t) => /* @__PURE__ */ A(At, {
|
|
2207
|
+
value: `${e}:${t.value}`,
|
|
2208
|
+
onSelect: () => {
|
|
2209
|
+
r(t.value), c(!1);
|
|
2210
|
+
},
|
|
2211
|
+
children: [/* @__PURE__ */ k("span", {
|
|
2212
|
+
className: "la:truncate la:font-mono la:text-xs",
|
|
2213
|
+
children: t.value
|
|
2214
|
+
}), t.hint && /* @__PURE__ */ k("span", {
|
|
2215
|
+
className: "la:ml-auto la:text-xs la:text-muted-foreground",
|
|
2216
|
+
children: t.hint
|
|
2217
|
+
})]
|
|
2218
|
+
}, t.value))
|
|
2219
|
+
}, e))
|
|
2220
|
+
})]
|
|
2221
|
+
});
|
|
2222
|
+
}
|
|
2223
|
+
function Nt(e, t, n) {
|
|
2224
|
+
let r = t.trim().toLocaleLowerCase(), i = /* @__PURE__ */ new Set(), a = [];
|
|
2225
|
+
for (let t of e) {
|
|
2226
|
+
let e = `${t.group}:${t.value}`, n = t.value.toLocaleLowerCase();
|
|
2227
|
+
i.has(e) || n === r || r && !n.includes(r) || (i.add(e), a.push(t));
|
|
2228
|
+
}
|
|
2229
|
+
return a.sort((e, t) => Number(t.value.toLocaleLowerCase().startsWith(r)) - Number(e.value.toLocaleLowerCase().startsWith(r))).slice(0, n);
|
|
2230
|
+
}
|
|
2231
|
+
//#endregion
|
|
2232
|
+
//#region src/socket-sessions.ts
|
|
2233
|
+
function Pt(e) {
|
|
2234
|
+
if (!Array.isArray(e) || !e.every((e) => !!e && typeof e == "object" && Ht(e))) throw Error("Invalid WebSocket session response");
|
|
2235
|
+
return e;
|
|
2236
|
+
}
|
|
2237
|
+
function Ft(e, t, n) {
|
|
2238
|
+
return JSON.stringify([
|
|
2239
|
+
e,
|
|
2240
|
+
t,
|
|
2241
|
+
n
|
|
2242
|
+
]);
|
|
2243
|
+
}
|
|
2244
|
+
function It(e, t, n = /* @__PURE__ */ new Map()) {
|
|
2245
|
+
let r = /* @__PURE__ */ new Map();
|
|
2246
|
+
for (let e of t?.actors ?? []) for (let t of e.instances) for (let n of t.connections) r.set(JSON.stringify([
|
|
2247
|
+
e.actorName,
|
|
2248
|
+
t.actorId,
|
|
2249
|
+
n.id
|
|
2250
|
+
]), n.metadata);
|
|
2251
|
+
let i = e.map((e) => {
|
|
2252
|
+
let t = JSON.stringify([
|
|
2253
|
+
e.actorName,
|
|
2254
|
+
e.actorId,
|
|
2255
|
+
e.connectionId
|
|
2256
|
+
]), n = e.closedAtMs === null ? r.has(t) ? "open" : "lost" : "closed";
|
|
2257
|
+
return n === "open" ? {
|
|
2258
|
+
...e,
|
|
2259
|
+
status: n,
|
|
2260
|
+
metadata: r.get(t)
|
|
2261
|
+
} : {
|
|
2262
|
+
...e,
|
|
2263
|
+
status: n
|
|
2264
|
+
};
|
|
2265
|
+
}), a = new Set(i.map((e) => JSON.stringify([
|
|
2266
|
+
e.actorName,
|
|
2267
|
+
e.actorId,
|
|
2268
|
+
e.connectionId
|
|
2269
|
+
])));
|
|
2270
|
+
for (let e of t?.actors ?? []) for (let t of e.instances) for (let r of t.connections) {
|
|
2271
|
+
let o = Ft(e.actorName, t.actorId, r.id);
|
|
2272
|
+
if (a.has(o)) continue;
|
|
2273
|
+
let s = n.get(o);
|
|
2274
|
+
i.unshift({
|
|
2275
|
+
connectionId: r.id,
|
|
2276
|
+
actorName: e.actorName,
|
|
2277
|
+
actorId: t.actorId,
|
|
2278
|
+
hostId: null,
|
|
2279
|
+
openedAtMs: s ?? null,
|
|
2280
|
+
estimatedStart: s !== void 0,
|
|
2281
|
+
closedAtMs: null,
|
|
2282
|
+
lastSeenMs: null,
|
|
2283
|
+
messages: 0,
|
|
2284
|
+
failures: 0,
|
|
2285
|
+
status: "open",
|
|
2286
|
+
metadata: r.metadata
|
|
2287
|
+
});
|
|
2288
|
+
}
|
|
2289
|
+
return i;
|
|
2290
|
+
}
|
|
2291
|
+
function Lt(e, t) {
|
|
2292
|
+
if (e.openedAtMs === null) return null;
|
|
2293
|
+
let n = e.status === "closed" ? e.closedAtMs : e.status === "open" ? Math.max(t, e.openedAtMs) : e.lastSeenMs;
|
|
2294
|
+
return {
|
|
2295
|
+
ms: Math.max(0, n - e.openedAtMs),
|
|
2296
|
+
lowerBound: e.status === "lost"
|
|
2297
|
+
};
|
|
2298
|
+
}
|
|
2299
|
+
function Rt(e, t) {
|
|
2300
|
+
let n = e.map((e) => Lt(e, t)).filter((e) => e !== null && !e.lowerBound), r = e.reduce((e, t) => e + t.messages, 0);
|
|
2301
|
+
return {
|
|
2302
|
+
total: e.length,
|
|
2303
|
+
open: e.filter((e) => e.status === "open").length,
|
|
2304
|
+
lost: e.filter((e) => e.status === "lost").length,
|
|
2305
|
+
median: Vt(n.map((e) => e.ms), .5),
|
|
2306
|
+
p95: Vt(n.map((e) => e.ms), .95),
|
|
2307
|
+
messages: r,
|
|
2308
|
+
messagesPerSession: e.length ? r / e.length : null
|
|
2309
|
+
};
|
|
2310
|
+
}
|
|
2311
|
+
function zt(e) {
|
|
2312
|
+
if (e < 1e3) return `${e.toLocaleString(void 0, { maximumFractionDigits: 0 })} ms`;
|
|
2313
|
+
if (e < 6e4) return `${(e / 1e3).toLocaleString(void 0, { maximumFractionDigits: 1 })} s`;
|
|
2314
|
+
let t = Math.floor(e / 6e4);
|
|
2315
|
+
if (t < 60) return `${t}m ${Math.floor(e % 6e4 / 1e3)}s`;
|
|
2316
|
+
let n = Math.floor(t / 60);
|
|
2317
|
+
return n < 24 ? `${n}h ${t % 60}m` : `${Math.floor(n / 24)}d ${n % 24}h`;
|
|
2318
|
+
}
|
|
2319
|
+
function Bt(e, t = 3) {
|
|
2320
|
+
if (e == null) return null;
|
|
2321
|
+
if (typeof e != "object") return String(e);
|
|
2322
|
+
let n = Array.isArray(e) ? e.map((e, t) => [String(t), e]) : Object.entries(e);
|
|
2323
|
+
if (!n.length) return null;
|
|
2324
|
+
let r = n.slice(0, t).map(([e, t]) => `${e}: ${typeof t == "string" ? t : JSON.stringify(t)}`);
|
|
2325
|
+
return n.length > t ? `${r.join(" · ")} · +${n.length - t}` : r.join(" · ");
|
|
2326
|
+
}
|
|
2327
|
+
function Vt(e, t) {
|
|
2328
|
+
return e.length ? e.sort((e, t) => e - t)[Math.max(0, Math.ceil(e.length * t) - 1)] : null;
|
|
2329
|
+
}
|
|
2330
|
+
function Ht(e) {
|
|
2331
|
+
return typeof e.connectionId == "string" && typeof e.actorName == "string" && typeof e.actorId == "string" && (e.hostId === null || typeof e.hostId == "string") && [
|
|
2332
|
+
e.openedAtMs,
|
|
2333
|
+
e.closedAtMs,
|
|
2334
|
+
e.lastSeenMs
|
|
2335
|
+
].every((e) => e === null || Number.isSafeInteger(e) && Number(e) >= 0) && [e.messages, e.failures].every((e) => Number.isSafeInteger(e) && Number(e) >= 0) && (e.openedAtMs !== null || e.lastSeenMs !== null);
|
|
2336
|
+
}
|
|
2337
|
+
//#endregion
|
|
2338
|
+
//#region src/SocketTimeline.tsx
|
|
2339
|
+
var Ut = 18, Wt = 8, Gt = 40, Q = 6e4, $ = 60 * Q, Kt = 24 * $, qt = [
|
|
2340
|
+
1e3,
|
|
2341
|
+
2e3,
|
|
2342
|
+
5e3,
|
|
2343
|
+
1e4,
|
|
2344
|
+
15e3,
|
|
2345
|
+
3e4,
|
|
2346
|
+
Q,
|
|
2347
|
+
2 * Q,
|
|
2348
|
+
5 * Q,
|
|
2349
|
+
10 * Q,
|
|
2350
|
+
15 * Q,
|
|
2351
|
+
30 * Q,
|
|
2352
|
+
$,
|
|
2353
|
+
2 * $,
|
|
2354
|
+
3 * $,
|
|
2355
|
+
6 * $,
|
|
2356
|
+
12 * $,
|
|
2357
|
+
Kt,
|
|
2358
|
+
2 * Kt,
|
|
2359
|
+
7 * Kt
|
|
2360
|
+
];
|
|
2361
|
+
function Jt({ sessions: e, start: t, end: n, endLabel: r = "now", selected: i, onSelect: o }) {
|
|
2362
|
+
let [s, c] = a(), l = Zt(e, t, n), u = l.slice(0, Gt), d = Math.max(1, n - t), f = tn(t, n), p = nn(d), m = (e) => `${(Math.min(Math.max(e, t), n) - t) / d * 100}%`, h = (e, t) => {
|
|
2363
|
+
let n = t.getBoundingClientRect(), r = t.closest(".socket-timeline").getBoundingClientRect(), i = n.top - r.top < 150;
|
|
2364
|
+
c({
|
|
2365
|
+
session: e,
|
|
2366
|
+
left: Math.min(Math.max(n.left - r.left + n.width / 2, 120), r.width - 120),
|
|
2367
|
+
top: i ? n.bottom - r.top : n.top - r.top,
|
|
2368
|
+
below: i
|
|
2369
|
+
});
|
|
2370
|
+
};
|
|
2371
|
+
return /* @__PURE__ */ A("div", {
|
|
2372
|
+
className: "socket-timeline",
|
|
2373
|
+
role: "group",
|
|
2374
|
+
"aria-label": "Connection timeline",
|
|
2375
|
+
onMouseLeave: () => c(void 0),
|
|
2376
|
+
children: [
|
|
2377
|
+
/* @__PURE__ */ A("div", {
|
|
2378
|
+
className: "socket-timeline-axis",
|
|
2379
|
+
"aria-hidden": "true",
|
|
2380
|
+
children: [/* @__PURE__ */ k("span", {}), /* @__PURE__ */ A("div", { children: [f.map((e) => /* @__PURE__ */ k("span", {
|
|
2381
|
+
style: { left: m(e) },
|
|
2382
|
+
children: rn(e, p)
|
|
2383
|
+
}, e)), /* @__PURE__ */ k("span", {
|
|
2384
|
+
className: "socket-timeline-now",
|
|
2385
|
+
children: r
|
|
2386
|
+
})] })]
|
|
2387
|
+
}),
|
|
2388
|
+
/* @__PURE__ */ A("div", {
|
|
2389
|
+
className: "socket-timeline-body",
|
|
2390
|
+
children: [
|
|
2391
|
+
/* @__PURE__ */ k("div", {
|
|
2392
|
+
className: "socket-timeline-grid",
|
|
2393
|
+
"aria-hidden": "true",
|
|
2394
|
+
children: f.map((e) => /* @__PURE__ */ k("i", { style: { left: m(e) } }, e))
|
|
2395
|
+
}),
|
|
2396
|
+
u.map((e) => /* @__PURE__ */ A("div", {
|
|
2397
|
+
className: "socket-timeline-row",
|
|
2398
|
+
children: [/* @__PURE__ */ A("div", {
|
|
2399
|
+
className: "socket-timeline-label",
|
|
2400
|
+
title: `${e.actorName} / ${e.actorId}`,
|
|
2401
|
+
children: [/* @__PURE__ */ k("span", { children: e.actorName }), /* @__PURE__ */ k("strong", { children: e.actorId })]
|
|
2402
|
+
}), /* @__PURE__ */ k("div", {
|
|
2403
|
+
className: "socket-timeline-lanes",
|
|
2404
|
+
style: { height: e.rows.length * Ut + 16 },
|
|
2405
|
+
children: e.rows.flatMap((e, t) => e.map((e) => /* @__PURE__ */ k("button", {
|
|
2406
|
+
type: "button",
|
|
2407
|
+
className: `socket-bar socket-bar-${e.session.status}${e.openEnded ? " socket-bar-open-ended" : ""}${e.unknownStart ? " socket-bar-unknown-start" : ""}`,
|
|
2408
|
+
"data-state": i === e.session ? "selected" : void 0,
|
|
2409
|
+
style: {
|
|
2410
|
+
left: m(e.from),
|
|
2411
|
+
width: `${(e.to - e.from) / d * 100}%`,
|
|
2412
|
+
top: Wt + t * Ut
|
|
2413
|
+
},
|
|
2414
|
+
"aria-label": cn(e.session, n),
|
|
2415
|
+
onClick: (t) => o(e.session, t.currentTarget),
|
|
2416
|
+
onMouseEnter: (t) => h(e.session, t.currentTarget),
|
|
2417
|
+
onFocus: (t) => h(e.session, t.currentTarget),
|
|
2418
|
+
onBlur: () => c(void 0)
|
|
2419
|
+
}, e.session.connectionId)))
|
|
2420
|
+
})]
|
|
2421
|
+
}, e.key)),
|
|
2422
|
+
l.length > Gt && /* @__PURE__ */ A("p", {
|
|
2423
|
+
className: "socket-timeline-more",
|
|
2424
|
+
children: [
|
|
2425
|
+
(l.length - Gt).toLocaleString(),
|
|
2426
|
+
" more ",
|
|
2427
|
+
l.length - Gt === 1 ? "instance is" : "instances are",
|
|
2428
|
+
" listed in the table below."
|
|
2429
|
+
]
|
|
2430
|
+
})
|
|
2431
|
+
]
|
|
2432
|
+
}),
|
|
2433
|
+
s && /* @__PURE__ */ A("div", {
|
|
2434
|
+
role: "tooltip",
|
|
2435
|
+
className: `socket-tooltip${s.below ? " socket-tooltip-below" : ""}`,
|
|
2436
|
+
style: {
|
|
2437
|
+
left: s.left,
|
|
2438
|
+
top: s.top
|
|
2439
|
+
},
|
|
2440
|
+
children: [/* @__PURE__ */ k(Xt, { metadata: s.session.metadata }), /* @__PURE__ */ A("dl", { children: [
|
|
2441
|
+
/* @__PURE__ */ k("dt", { children: "Connection" }),
|
|
2442
|
+
/* @__PURE__ */ k("dd", { children: sn(s.session.connectionId) }),
|
|
2443
|
+
/* @__PURE__ */ k("dt", { children: "Instance" }),
|
|
2444
|
+
/* @__PURE__ */ A("dd", { children: [
|
|
2445
|
+
s.session.actorName,
|
|
2446
|
+
" / ",
|
|
2447
|
+
s.session.actorId
|
|
2448
|
+
] }),
|
|
2449
|
+
/* @__PURE__ */ k("dt", { children: "Status" }),
|
|
2450
|
+
/* @__PURE__ */ k("dd", { children: an(s.session.status) }),
|
|
2451
|
+
/* @__PURE__ */ k("dt", { children: "Opened" }),
|
|
2452
|
+
/* @__PURE__ */ k("dd", { children: s.session.openedAtMs === null ? "Before retained history" : `${s.session.estimatedStart ? "≈ " : ""}${new Date(s.session.openedAtMs).toLocaleTimeString([], { hour12: !1 })}` }),
|
|
2453
|
+
/* @__PURE__ */ k("dt", { children: "Duration" }),
|
|
2454
|
+
/* @__PURE__ */ k("dd", { children: on(s.session, n) }),
|
|
2455
|
+
/* @__PURE__ */ k("dt", { children: "Messages" }),
|
|
2456
|
+
/* @__PURE__ */ k("dd", { children: s.session.messages.toLocaleString() })
|
|
2457
|
+
] })]
|
|
2458
|
+
})
|
|
2459
|
+
]
|
|
2460
|
+
});
|
|
2461
|
+
}
|
|
2462
|
+
var Yt = 4;
|
|
2463
|
+
function Xt({ metadata: e }) {
|
|
2464
|
+
if (e == null) return null;
|
|
2465
|
+
let t = typeof e == "object" ? Array.isArray(e) ? e.map((e, t) => [String(t), e]) : Object.entries(e) : [["value", e]];
|
|
2466
|
+
return t.length ? /* @__PURE__ */ A("dl", {
|
|
2467
|
+
className: "socket-tooltip-metadata",
|
|
2468
|
+
"aria-label": "Connection metadata",
|
|
2469
|
+
children: [t.slice(0, Yt).map(([e, t]) => /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("dt", { children: e }), /* @__PURE__ */ k("dd", { children: typeof t == "string" ? t : JSON.stringify(t) })] }, e)), t.length > Yt && /* @__PURE__ */ A("p", { children: [
|
|
2470
|
+
"+",
|
|
2471
|
+
t.length - Yt,
|
|
2472
|
+
" more in details"
|
|
2473
|
+
] })]
|
|
2474
|
+
}) : null;
|
|
2475
|
+
}
|
|
2476
|
+
function Zt(e, t, n) {
|
|
2477
|
+
let r = /* @__PURE__ */ new Map(), i = e.map((e) => Qt(e, t, n)).filter((e) => e.to > t).sort((e, t) => e.from - t.from || e.to - t.to);
|
|
2478
|
+
for (let e of i) {
|
|
2479
|
+
let i = `${e.session.actorName}${e.session.actorId}`, a = r.get(i) ?? {
|
|
2480
|
+
key: i,
|
|
2481
|
+
actorName: e.session.actorName,
|
|
2482
|
+
actorId: e.session.actorId,
|
|
2483
|
+
rows: []
|
|
2484
|
+
};
|
|
2485
|
+
r.set(i, a);
|
|
2486
|
+
let o = a.rows.find((r) => r.at(-1).to + $t(t, n) <= e.from);
|
|
2487
|
+
o ? o.push(e) : a.rows.push([e]);
|
|
2488
|
+
}
|
|
2489
|
+
return [...r.values()].sort((e, t) => en(t) - en(e));
|
|
2490
|
+
}
|
|
2491
|
+
function Qt(e, t, n) {
|
|
2492
|
+
let r = e.openedAtMs ?? (e.status === "open" ? t : e.lastSeenMs ?? t), i = e.status === "closed" ? e.closedAtMs : e.status === "open" ? n : e.lastSeenMs ?? r;
|
|
2493
|
+
return {
|
|
2494
|
+
session: e,
|
|
2495
|
+
from: Math.max(t, r),
|
|
2496
|
+
to: Math.max(Math.max(t, r) + $t(t, n), Math.min(n, i)),
|
|
2497
|
+
openEnded: e.status !== "closed",
|
|
2498
|
+
unknownStart: e.openedAtMs === null
|
|
2499
|
+
};
|
|
2500
|
+
}
|
|
2501
|
+
function $t(e, t) {
|
|
2502
|
+
return Math.max(1, (t - e) / 160);
|
|
2503
|
+
}
|
|
2504
|
+
function en(e) {
|
|
2505
|
+
return Math.max(...e.rows.flat().map((e) => e.to));
|
|
2506
|
+
}
|
|
2507
|
+
function tn(e, t) {
|
|
2508
|
+
let n = nn(Math.max(1, t - e)), r = [];
|
|
2509
|
+
for (let i = Math.floor(e / n) * n + n; i < t - n * .35; i += n) r.push(i);
|
|
2510
|
+
return r;
|
|
2511
|
+
}
|
|
2512
|
+
function nn(e) {
|
|
2513
|
+
return qt.find((t) => e / t <= 9) ?? qt.at(-1);
|
|
2514
|
+
}
|
|
2515
|
+
function rn(e, t) {
|
|
2516
|
+
let n = new Date(e);
|
|
2517
|
+
return t >= Kt ? n.toLocaleDateString([], {
|
|
2518
|
+
month: "short",
|
|
2519
|
+
day: "numeric"
|
|
2520
|
+
}) : t >= Q ? n.toLocaleTimeString([], {
|
|
2521
|
+
hour: "2-digit",
|
|
2522
|
+
minute: "2-digit",
|
|
2523
|
+
hour12: !1
|
|
2524
|
+
}) : n.toLocaleTimeString([], { hour12: !1 });
|
|
2525
|
+
}
|
|
2526
|
+
function an(e) {
|
|
2527
|
+
return e === "open" ? "Open" : e === "closed" ? "Closed" : "Lost";
|
|
2528
|
+
}
|
|
2529
|
+
function on(e, t) {
|
|
2530
|
+
let n = Lt(e, t);
|
|
2531
|
+
return n ? `${n.lowerBound ? "≥ " : ""}${zt(n.ms)}` : "Unknown";
|
|
2532
|
+
}
|
|
2533
|
+
function sn(e) {
|
|
2534
|
+
return e.length > 14 ? `${e.slice(0, 8)}…${e.slice(-4)}` : e;
|
|
2535
|
+
}
|
|
2536
|
+
function cn(e, t) {
|
|
2537
|
+
let n = Bt(e.metadata);
|
|
2538
|
+
return `${an(e.status)} connection ${sn(e.connectionId)}${n === null ? "" : ` (${n})`} on ${e.actorName} ${e.actorId}, ${on(e, t)}`;
|
|
2539
|
+
}
|
|
2540
|
+
//#endregion
|
|
2541
|
+
//#region src/socket-history.ts
|
|
2542
|
+
function ln(e, t) {
|
|
2543
|
+
let n = Pe(e, t, e.listWebSockets, 5e3);
|
|
2544
|
+
return {
|
|
2545
|
+
...n,
|
|
2546
|
+
rows: n.value,
|
|
2547
|
+
capped: (n.value?.length ?? 0) >= 500
|
|
2548
|
+
};
|
|
2549
|
+
}
|
|
2550
|
+
//#endregion
|
|
2551
|
+
//#region src/WebSocketObserver.tsx
|
|
2552
|
+
function un({ client: e, onSelectActor: n, timeRange: o, onTimeRangeChange: s }) {
|
|
2553
|
+
let { inventory: c, failed: l, retry: u } = je(e), [d, f] = a(z), p = o ?? d, m = s ?? f, [h, g] = a(Date.now), [_, v] = a(""), [ee, y] = a("all"), [b, x] = a(), S = i(null), C = i(null);
|
|
2554
|
+
t(() => {
|
|
2555
|
+
let e = setInterval(() => g(Date.now()), 5e3);
|
|
2556
|
+
return () => clearInterval(e);
|
|
2557
|
+
}, []);
|
|
2558
|
+
let w = B(p, h), T = w.toMs ?? h, E = ln(e, w), D = hn(c, E.retry), j = r(() => It(E.rows ?? [], c, D), [
|
|
2559
|
+
E.rows,
|
|
2560
|
+
c,
|
|
2561
|
+
D
|
|
2562
|
+
]), M = !!c || l, N = _.trim().toLocaleLowerCase(), P = j.filter((e) => (ee === "all" || e.status === ee) && (!N || `${e.connectionId} ${e.actorName} ${e.actorId} ${e.hostId ?? ""}`.toLocaleLowerCase().includes(N))).sort((e, t) => Number(t.status === "open") - Number(e.status === "open") || (t.openedAtMs ?? t.lastSeenMs ?? Infinity) - (e.openedAtMs ?? e.lastSeenMs ?? Infinity)), F = Rt(j, h), ne = Math.max(0, ...j.filter((e) => e.status !== "open").map((e) => Lt(e, h)?.ms ?? 0)) || F.p95, re = mn(P, w.fromMs, T), I = r(() => gn(j, c), [j, c]);
|
|
2563
|
+
return t(() => x(void 0), [e, p]), /* @__PURE__ */ A("section", {
|
|
2564
|
+
ref: S,
|
|
2565
|
+
className: "la-observer overview websockets",
|
|
2566
|
+
"aria-label": "WebSocket observer",
|
|
2567
|
+
children: [
|
|
2568
|
+
/* @__PURE__ */ A("div", {
|
|
2569
|
+
className: "overview-heading",
|
|
2570
|
+
children: [/* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("h1", { children: "WebSockets" }), /* @__PURE__ */ k("p", { children: M ? `${F.open.toLocaleString()} open now${E.supported ? ` · ${F.total.toLocaleString()} ${F.total === 1 ? "session" : "sessions"} ${H(p)}` : ""}` : "Connecting to inventory…" })] }), /* @__PURE__ */ A("div", {
|
|
2571
|
+
className: "overview-controls",
|
|
2572
|
+
children: [
|
|
2573
|
+
/* @__PURE__ */ k("span", {
|
|
2574
|
+
className: "overview-updated",
|
|
2575
|
+
children: E.failed ? "History reconnecting…" : E.updatedAt ? /* @__PURE__ */ A(O, { children: ["Updated ", /* @__PURE__ */ k("time", {
|
|
2576
|
+
dateTime: new Date(E.updatedAt).toISOString(),
|
|
2577
|
+
children: new Date(E.updatedAt).toLocaleTimeString([], { hour12: !1 })
|
|
2578
|
+
})] }) : null
|
|
2579
|
+
}),
|
|
2580
|
+
E.supported && /* @__PURE__ */ k(_e, {
|
|
2581
|
+
value: p,
|
|
2582
|
+
onChange: m,
|
|
2583
|
+
className: "overview-range"
|
|
2584
|
+
}),
|
|
2585
|
+
/* @__PURE__ */ k(L, {
|
|
2586
|
+
variant: "outline",
|
|
2587
|
+
size: "icon",
|
|
2588
|
+
"aria-label": "Refresh connections",
|
|
2589
|
+
onClick: () => {
|
|
2590
|
+
u(), E.retry();
|
|
2591
|
+
},
|
|
2592
|
+
children: /* @__PURE__ */ k(te, { "aria-hidden": "true" })
|
|
2593
|
+
})
|
|
2594
|
+
]
|
|
2595
|
+
})]
|
|
2596
|
+
}),
|
|
2597
|
+
l && /* @__PURE__ */ A("p", {
|
|
2598
|
+
role: "alert",
|
|
2599
|
+
className: "overview-alert",
|
|
2600
|
+
children: [
|
|
2601
|
+
"Could not refresh connections.",
|
|
2602
|
+
" ",
|
|
2603
|
+
c ? "Showing the last received inventory; it may be out of date." : "Open connections cannot be confirmed, so unfinished sessions show as lost.",
|
|
2604
|
+
" Retrying automatically."
|
|
2605
|
+
]
|
|
2606
|
+
}),
|
|
2607
|
+
E.failed && /* @__PURE__ */ A("p", {
|
|
2608
|
+
role: "alert",
|
|
2609
|
+
className: "overview-alert",
|
|
2610
|
+
children: [
|
|
2611
|
+
"Connection history unavailable. ",
|
|
2612
|
+
E.rows ? "Showing the last loaded sessions." : "Only currently open connections are shown.",
|
|
2613
|
+
" Retrying automatically."
|
|
2614
|
+
]
|
|
2615
|
+
}),
|
|
2616
|
+
/* @__PURE__ */ k(dn, {
|
|
2617
|
+
summary: F,
|
|
2618
|
+
ready: M,
|
|
2619
|
+
history: E.supported && !!E.rows,
|
|
2620
|
+
range: p
|
|
2621
|
+
}),
|
|
2622
|
+
/* @__PURE__ */ A("div", {
|
|
2623
|
+
className: "socket-filterbar",
|
|
2624
|
+
children: [/* @__PURE__ */ k(Mt, {
|
|
2625
|
+
label: "Filter connections",
|
|
2626
|
+
placeholder: "Filter by connection, actor, instance, or host…",
|
|
2627
|
+
value: _,
|
|
2628
|
+
onChange: v,
|
|
2629
|
+
suggestions: I
|
|
2630
|
+
}), /* @__PURE__ */ A("select", {
|
|
2631
|
+
"aria-label": "Filter by status",
|
|
2632
|
+
value: ee,
|
|
2633
|
+
onChange: (e) => y(e.target.value),
|
|
2634
|
+
children: [
|
|
2635
|
+
/* @__PURE__ */ k("option", {
|
|
2636
|
+
value: "all",
|
|
2637
|
+
children: "All statuses"
|
|
2638
|
+
}),
|
|
2639
|
+
/* @__PURE__ */ k("option", {
|
|
2640
|
+
value: "open",
|
|
2641
|
+
children: "Open"
|
|
2642
|
+
}),
|
|
2643
|
+
/* @__PURE__ */ k("option", {
|
|
2644
|
+
value: "closed",
|
|
2645
|
+
children: "Closed"
|
|
2646
|
+
}),
|
|
2647
|
+
/* @__PURE__ */ k("option", {
|
|
2648
|
+
value: "lost",
|
|
2649
|
+
children: "Lost"
|
|
2650
|
+
})
|
|
2651
|
+
]
|
|
2652
|
+
})]
|
|
2653
|
+
}),
|
|
2654
|
+
E.supported && /* @__PURE__ */ A("section", {
|
|
2655
|
+
className: "overview-panel socket-timeline-panel",
|
|
2656
|
+
"aria-label": "Connection timeline",
|
|
2657
|
+
children: [/* @__PURE__ */ A("div", {
|
|
2658
|
+
className: "socket-panel-heading",
|
|
2659
|
+
children: [/* @__PURE__ */ A("h2", { children: ["Timeline ", /* @__PURE__ */ k("span", { children: P.length.toLocaleString() })] }), /* @__PURE__ */ A("ul", {
|
|
2660
|
+
className: "socket-legend",
|
|
2661
|
+
"aria-label": "Timeline legend",
|
|
2662
|
+
children: [
|
|
2663
|
+
/* @__PURE__ */ A("li", { children: [/* @__PURE__ */ k("i", { className: "socket-swatch socket-swatch-open" }), " Open"] }),
|
|
2664
|
+
/* @__PURE__ */ A("li", { children: [/* @__PURE__ */ k("i", { className: "socket-swatch socket-swatch-closed" }), " Closed"] }),
|
|
2665
|
+
/* @__PURE__ */ A("li", { children: [/* @__PURE__ */ k("i", { className: "socket-swatch socket-swatch-lost" }), " Lost · no disconnect recorded"] })
|
|
2666
|
+
]
|
|
2667
|
+
})]
|
|
2668
|
+
}), P.length ? /* @__PURE__ */ k(Jt, {
|
|
2669
|
+
sessions: P,
|
|
2670
|
+
start: re,
|
|
2671
|
+
end: T,
|
|
2672
|
+
endLabel: w.toMs === void 0 ? "now" : new Date(w.toMs).toLocaleTimeString([], {
|
|
2673
|
+
hour: "2-digit",
|
|
2674
|
+
minute: "2-digit",
|
|
2675
|
+
hour12: !1
|
|
2676
|
+
}),
|
|
2677
|
+
selected: b,
|
|
2678
|
+
onSelect: (e, t) => {
|
|
2679
|
+
C.current = t, x(e);
|
|
2680
|
+
}
|
|
2681
|
+
}) : /* @__PURE__ */ A("div", {
|
|
2682
|
+
className: "overview-empty socket-timeline-empty",
|
|
2683
|
+
role: "status",
|
|
2684
|
+
children: [/* @__PURE__ */ k("strong", { children: _n(M, E, j.length) }), /* @__PURE__ */ k("p", { children: j.length ? "Try another filter or a wider time window." : "Sessions appear here as clients connect to actors." })]
|
|
2685
|
+
})]
|
|
2686
|
+
}),
|
|
2687
|
+
/* @__PURE__ */ A("div", {
|
|
2688
|
+
className: "overview-panel",
|
|
2689
|
+
children: [/* @__PURE__ */ k("div", {
|
|
2690
|
+
className: "overview-table-scroll",
|
|
2691
|
+
role: "region",
|
|
2692
|
+
"aria-label": "WebSocket connections",
|
|
2693
|
+
tabIndex: 0,
|
|
2694
|
+
children: /* @__PURE__ */ A("table", {
|
|
2695
|
+
className: "overview-table socket-table",
|
|
2696
|
+
children: [/* @__PURE__ */ k("thead", { children: /* @__PURE__ */ A("tr", { children: [
|
|
2697
|
+
/* @__PURE__ */ k("th", {
|
|
2698
|
+
scope: "col",
|
|
2699
|
+
children: "Status"
|
|
2700
|
+
}),
|
|
2701
|
+
/* @__PURE__ */ k("th", {
|
|
2702
|
+
scope: "col",
|
|
2703
|
+
children: "Connection"
|
|
2704
|
+
}),
|
|
2705
|
+
/* @__PURE__ */ k("th", {
|
|
2706
|
+
scope: "col",
|
|
2707
|
+
children: "Actor class"
|
|
2708
|
+
}),
|
|
2709
|
+
/* @__PURE__ */ k("th", {
|
|
2710
|
+
scope: "col",
|
|
2711
|
+
children: "Instance"
|
|
2712
|
+
}),
|
|
2713
|
+
/* @__PURE__ */ k("th", {
|
|
2714
|
+
scope: "col",
|
|
2715
|
+
children: "Opened"
|
|
2716
|
+
}),
|
|
2717
|
+
/* @__PURE__ */ k("th", {
|
|
2718
|
+
scope: "col",
|
|
2719
|
+
children: "Duration"
|
|
2720
|
+
}),
|
|
2721
|
+
/* @__PURE__ */ k("th", {
|
|
2722
|
+
scope: "col",
|
|
2723
|
+
children: "Messages"
|
|
2724
|
+
}),
|
|
2725
|
+
/* @__PURE__ */ k("th", {
|
|
2726
|
+
scope: "col",
|
|
2727
|
+
children: "Metadata"
|
|
2728
|
+
})
|
|
2729
|
+
] }) }), /* @__PURE__ */ k("tbody", { children: P.map((e) => /* @__PURE__ */ k(fn, {
|
|
2730
|
+
session: e,
|
|
2731
|
+
now: h,
|
|
2732
|
+
longest: ne,
|
|
2733
|
+
selected: b === e,
|
|
2734
|
+
onSelect: (t) => {
|
|
2735
|
+
C.current = t, x(e);
|
|
2736
|
+
}
|
|
2737
|
+
}, JSON.stringify([
|
|
2738
|
+
e.actorName,
|
|
2739
|
+
e.actorId,
|
|
2740
|
+
e.connectionId
|
|
2741
|
+
]))) })]
|
|
2742
|
+
})
|
|
2743
|
+
}), !P.length && /* @__PURE__ */ A("div", {
|
|
2744
|
+
className: "overview-empty",
|
|
2745
|
+
role: "status",
|
|
2746
|
+
children: [
|
|
2747
|
+
/* @__PURE__ */ k("strong", { children: _n(M, E, j.length) }),
|
|
2748
|
+
/* @__PURE__ */ k("p", { children: j.length ? "Try another connection, actor, or status." : "Open an actor WebSocket to see its connection and metadata here." }),
|
|
2749
|
+
!!j.length && /* @__PURE__ */ k(L, {
|
|
2750
|
+
variant: "outline",
|
|
2751
|
+
onClick: () => {
|
|
2752
|
+
v(""), y("all");
|
|
2753
|
+
},
|
|
2754
|
+
children: "Clear filter"
|
|
2755
|
+
})
|
|
2756
|
+
]
|
|
2757
|
+
})]
|
|
2758
|
+
}),
|
|
2759
|
+
/* @__PURE__ */ k("div", {
|
|
2760
|
+
className: "overview-data-scope",
|
|
2761
|
+
children: /* @__PURE__ */ k("p", { children: E.supported ? `Sessions pair each connection’s onConnect and onDisconnect events from retained request history${E.capped ? "; only the 500 most recent sessions are shown" : ""}. Open connections follow the latest host report. Lost connections have no recorded disconnect and are no longer reported by a host, so their duration is a lower bound.` : "Connections are active WebSockets, not unique people. Counts follow the latest host report." })
|
|
2762
|
+
}),
|
|
2763
|
+
/* @__PURE__ */ k(Te, {
|
|
2764
|
+
open: !!b,
|
|
2765
|
+
onOpenChange: (e) => {
|
|
2766
|
+
e || x(void 0);
|
|
2767
|
+
},
|
|
2768
|
+
children: /* @__PURE__ */ A(Oe, {
|
|
2769
|
+
container: S.current,
|
|
2770
|
+
onCloseAutoFocus: (e) => {
|
|
2771
|
+
e.preventDefault(), C.current?.focus();
|
|
2772
|
+
},
|
|
2773
|
+
children: [
|
|
2774
|
+
/* @__PURE__ */ k(Ee, { children: "Connection details" }),
|
|
2775
|
+
/* @__PURE__ */ k(De, { children: "Identifiers, timings, and metadata for this WebSocket." }),
|
|
2776
|
+
b && /* @__PURE__ */ k(pn, {
|
|
2777
|
+
session: b,
|
|
2778
|
+
now: h,
|
|
2779
|
+
onSelectActor: n
|
|
2780
|
+
})
|
|
2781
|
+
]
|
|
2782
|
+
})
|
|
2783
|
+
})
|
|
2784
|
+
]
|
|
2785
|
+
});
|
|
2786
|
+
}
|
|
2787
|
+
function dn({ summary: e, ready: t, history: n, range: r }) {
|
|
2788
|
+
return /* @__PURE__ */ A("div", {
|
|
2789
|
+
className: "overview-metrics socket-metrics",
|
|
2790
|
+
children: [
|
|
2791
|
+
/* @__PURE__ */ A("section", {
|
|
2792
|
+
className: "overview-metric",
|
|
2793
|
+
children: [
|
|
2794
|
+
/* @__PURE__ */ k("h2", { children: "Open now" }),
|
|
2795
|
+
/* @__PURE__ */ A("div", {
|
|
2796
|
+
className: "overview-value",
|
|
2797
|
+
children: [/* @__PURE__ */ k("strong", {
|
|
2798
|
+
"aria-label": "Open WebSocket connections",
|
|
2799
|
+
children: t ? e.open.toLocaleString() : "—"
|
|
2800
|
+
}), /* @__PURE__ */ k("span", { children: "live connections" })]
|
|
2801
|
+
}),
|
|
2802
|
+
/* @__PURE__ */ k("div", {
|
|
2803
|
+
className: "overview-metric-foot",
|
|
2804
|
+
children: /* @__PURE__ */ k("span", { children: "Latest host report" })
|
|
2805
|
+
})
|
|
2806
|
+
]
|
|
2807
|
+
}),
|
|
2808
|
+
/* @__PURE__ */ A("section", {
|
|
2809
|
+
className: "overview-metric",
|
|
2810
|
+
children: [
|
|
2811
|
+
/* @__PURE__ */ k("h2", { children: "Sessions" }),
|
|
2812
|
+
/* @__PURE__ */ A("div", {
|
|
2813
|
+
className: "overview-value",
|
|
2814
|
+
children: [/* @__PURE__ */ k("strong", {
|
|
2815
|
+
"aria-label": "WebSocket sessions",
|
|
2816
|
+
children: n ? e.total.toLocaleString() : "—"
|
|
2817
|
+
}), /* @__PURE__ */ k("span", { children: r.kind === "absolute" ? V(r) : H(r) })]
|
|
2818
|
+
}),
|
|
2819
|
+
/* @__PURE__ */ A("div", {
|
|
2820
|
+
className: "overview-metric-foot",
|
|
2821
|
+
children: [/* @__PURE__ */ A("span", { children: [/* @__PURE__ */ k("b", { children: n ? (e.total - e.open - e.lost).toLocaleString() : "—" }), " closed"] }), /* @__PURE__ */ A("span", { children: [/* @__PURE__ */ k("b", { children: n ? e.lost.toLocaleString() : "—" }), " lost"] })]
|
|
2822
|
+
})
|
|
2823
|
+
]
|
|
2824
|
+
}),
|
|
2825
|
+
/* @__PURE__ */ A("section", {
|
|
2826
|
+
className: "overview-metric",
|
|
2827
|
+
children: [
|
|
2828
|
+
/* @__PURE__ */ k("h2", { children: "Session duration" }),
|
|
2829
|
+
/* @__PURE__ */ A("div", {
|
|
2830
|
+
className: "overview-value",
|
|
2831
|
+
children: [/* @__PURE__ */ k("strong", {
|
|
2832
|
+
"aria-label": "Median session duration",
|
|
2833
|
+
children: n && e.median !== null ? zt(e.median) : "—"
|
|
2834
|
+
}), /* @__PURE__ */ k("span", { children: "median" })]
|
|
2835
|
+
}),
|
|
2836
|
+
/* @__PURE__ */ A("div", {
|
|
2837
|
+
className: "overview-metric-foot",
|
|
2838
|
+
children: [/* @__PURE__ */ A("span", { children: [/* @__PURE__ */ k("b", { children: n && e.p95 !== null ? zt(e.p95) : "—" }), " p95"] }), /* @__PURE__ */ k("span", { children: "Open sessions count up to now" })]
|
|
2839
|
+
})
|
|
2840
|
+
]
|
|
2841
|
+
}),
|
|
2842
|
+
/* @__PURE__ */ A("section", {
|
|
2843
|
+
className: "overview-metric",
|
|
2844
|
+
children: [
|
|
2845
|
+
/* @__PURE__ */ k("h2", { children: "Messages" }),
|
|
2846
|
+
/* @__PURE__ */ A("div", {
|
|
2847
|
+
className: "overview-value",
|
|
2848
|
+
children: [/* @__PURE__ */ k("strong", {
|
|
2849
|
+
"aria-label": "WebSocket messages",
|
|
2850
|
+
children: n ? e.messages.toLocaleString() : "—"
|
|
2851
|
+
}), /* @__PURE__ */ k("span", { children: "received" })]
|
|
2852
|
+
}),
|
|
2853
|
+
/* @__PURE__ */ k("div", {
|
|
2854
|
+
className: "overview-metric-foot",
|
|
2855
|
+
children: /* @__PURE__ */ A("span", { children: [/* @__PURE__ */ k("b", { children: n && e.messagesPerSession !== null ? e.messagesPerSession.toLocaleString(void 0, { maximumFractionDigits: 1 }) : "—" }), " per session"] })
|
|
2856
|
+
})
|
|
2857
|
+
]
|
|
2858
|
+
})
|
|
2859
|
+
]
|
|
2860
|
+
});
|
|
2861
|
+
}
|
|
2862
|
+
function fn({ session: e, now: t, longest: n, selected: r, onSelect: i }) {
|
|
2863
|
+
let a = Lt(e, t), o = a && n ? Math.min(1, a.ms / n) : 0;
|
|
2864
|
+
return /* @__PURE__ */ A("tr", {
|
|
2865
|
+
className: "la-clickable-row",
|
|
2866
|
+
"data-state": r ? "selected" : void 0,
|
|
2867
|
+
onClick: (e) => i(e.currentTarget.querySelector("button") ?? e.currentTarget),
|
|
2868
|
+
children: [
|
|
2869
|
+
/* @__PURE__ */ k("td", { children: /* @__PURE__ */ A("span", {
|
|
2870
|
+
className: `socket-status socket-status-${e.status}`,
|
|
2871
|
+
children: [/* @__PURE__ */ k("i", {
|
|
2872
|
+
className: `socket-swatch socket-swatch-${e.status}`,
|
|
2873
|
+
"aria-hidden": "true"
|
|
2874
|
+
}), an(e.status)]
|
|
2875
|
+
}) }),
|
|
2876
|
+
/* @__PURE__ */ k("td", { children: /* @__PURE__ */ k("button", {
|
|
2877
|
+
type: "button",
|
|
2878
|
+
className: "socket-connection",
|
|
2879
|
+
title: e.connectionId,
|
|
2880
|
+
"aria-label": `Inspect connection ${e.connectionId}`,
|
|
2881
|
+
children: sn(e.connectionId)
|
|
2882
|
+
}) }),
|
|
2883
|
+
/* @__PURE__ */ k("td", {
|
|
2884
|
+
title: e.actorName,
|
|
2885
|
+
children: e.actorName
|
|
2886
|
+
}),
|
|
2887
|
+
/* @__PURE__ */ k("td", {
|
|
2888
|
+
title: e.actorId,
|
|
2889
|
+
children: e.actorId
|
|
2890
|
+
}),
|
|
2891
|
+
/* @__PURE__ */ k("td", { children: e.openedAtMs === null ? /* @__PURE__ */ k("span", {
|
|
2892
|
+
title: "The connect event is not in retained history",
|
|
2893
|
+
children: "—"
|
|
2894
|
+
}) : /* @__PURE__ */ A("time", {
|
|
2895
|
+
dateTime: new Date(e.openedAtMs).toISOString(),
|
|
2896
|
+
title: e.estimatedStart ? "Approximate: first reported by the host; the connect event has not been saved yet" : new Date(e.openedAtMs).toLocaleString(),
|
|
2897
|
+
children: [e.estimatedStart ? "≈ " : "", new Date(e.openedAtMs).toLocaleTimeString([], { hour12: !1 })]
|
|
2898
|
+
}) }),
|
|
2899
|
+
/* @__PURE__ */ k("td", { children: /* @__PURE__ */ A("span", {
|
|
2900
|
+
className: "socket-duration",
|
|
2901
|
+
children: [/* @__PURE__ */ k("span", { children: on(e, t) }), /* @__PURE__ */ k("i", {
|
|
2902
|
+
className: `socket-duration-bar socket-duration-${e.status}`,
|
|
2903
|
+
"aria-hidden": "true",
|
|
2904
|
+
children: /* @__PURE__ */ k("b", { style: { width: `${o * 100}%` } })
|
|
2905
|
+
})]
|
|
2906
|
+
}) }),
|
|
2907
|
+
/* @__PURE__ */ k("td", { children: e.messages.toLocaleString() }),
|
|
2908
|
+
/* @__PURE__ */ k("td", { children: e.metadata === void 0 ? /* @__PURE__ */ k("span", {
|
|
2909
|
+
title: "No metadata was recorded for this connection",
|
|
2910
|
+
children: "—"
|
|
2911
|
+
}) : /* @__PURE__ */ k("code", {
|
|
2912
|
+
className: "socket-metadata",
|
|
2913
|
+
title: JSON.stringify(e.metadata),
|
|
2914
|
+
children: JSON.stringify(e.metadata)
|
|
2915
|
+
}) })
|
|
2916
|
+
]
|
|
2917
|
+
});
|
|
2918
|
+
}
|
|
2919
|
+
function pn({ session: e, now: t, onSelectActor: n }) {
|
|
2920
|
+
let r = {
|
|
2921
|
+
Status: e.status === "lost" ? "Lost — no disconnect recorded" : an(e.status),
|
|
2922
|
+
Connection: e.connectionId,
|
|
2923
|
+
"Actor class": e.actorName,
|
|
2924
|
+
"Instance ID": e.actorId,
|
|
2925
|
+
Opened: e.openedAtMs === null ? "Before retained history" : `${e.estimatedStart ? "≈ " : ""}${new Date(e.openedAtMs).toLocaleString()}`,
|
|
2926
|
+
...e.closedAtMs === null ? {} : { Closed: new Date(e.closedAtMs).toLocaleString() },
|
|
2927
|
+
...e.status === "lost" && e.lastSeenMs !== null ? { "Last activity": new Date(e.lastSeenMs).toLocaleString() } : {},
|
|
2928
|
+
Duration: on(e, t),
|
|
2929
|
+
Messages: e.messages.toLocaleString(),
|
|
2930
|
+
Failures: e.failures.toLocaleString(),
|
|
2931
|
+
Host: e.hostId ?? "Unknown"
|
|
2932
|
+
};
|
|
2933
|
+
return /* @__PURE__ */ A(O, { children: [
|
|
2934
|
+
/* @__PURE__ */ k("dl", {
|
|
2935
|
+
className: "la-request-details",
|
|
2936
|
+
children: Object.entries(r).map(([e, t]) => /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("dt", { children: e }), /* @__PURE__ */ k("dd", { children: t })] }, e))
|
|
2937
|
+
}),
|
|
2938
|
+
e.metadata !== void 0 && /* @__PURE__ */ A("details", {
|
|
2939
|
+
className: "socket-metadata-details",
|
|
2940
|
+
open: !0,
|
|
2941
|
+
children: [/* @__PURE__ */ k("summary", { children: "Metadata" }), /* @__PURE__ */ k("pre", { children: JSON.stringify(e.metadata, null, 2) })]
|
|
2942
|
+
}),
|
|
2943
|
+
n && /* @__PURE__ */ A(L, {
|
|
2944
|
+
variant: "outline",
|
|
2945
|
+
onClick: () => n(e.actorName),
|
|
2946
|
+
children: ["Open ", e.actorName]
|
|
2947
|
+
})
|
|
2948
|
+
] });
|
|
2949
|
+
}
|
|
2950
|
+
function mn(e, t, n) {
|
|
2951
|
+
let r = Math.min(...e.map((e) => e.openedAtMs ?? e.lastSeenMs ?? n)), i = Number.isFinite(r) ? r - Math.max(5e3, (n - r) * .06) : n - 6e4;
|
|
2952
|
+
return Math.max(t ?? -Infinity, Math.min(i, n - 1e4));
|
|
2953
|
+
}
|
|
2954
|
+
function hn(e, n) {
|
|
2955
|
+
let [r, o] = a(/* @__PURE__ */ new Map()), s = i(void 0);
|
|
2956
|
+
return t(() => {
|
|
2957
|
+
if (!e) return;
|
|
2958
|
+
let t = new Set(e.actors.flatMap((e) => e.instances.flatMap((t) => t.connections.map((n) => Ft(e.actorName, t.actorId, n.id))))), r = s.current;
|
|
2959
|
+
if (s.current = t, !r) return;
|
|
2960
|
+
let i = [...t].filter((e) => !r.has(e)), a = [...r].filter((e) => !t.has(e));
|
|
2961
|
+
if (i.length || a.length) {
|
|
2962
|
+
if (i.length) {
|
|
2963
|
+
let e = Date.now();
|
|
2964
|
+
o((t) => new Map([...t, ...i.map((t) => [t, e])]));
|
|
2965
|
+
}
|
|
2966
|
+
n();
|
|
2967
|
+
}
|
|
2968
|
+
}, [e]), r;
|
|
2969
|
+
}
|
|
2970
|
+
function gn(e, t) {
|
|
2971
|
+
let n = /* @__PURE__ */ new Map();
|
|
2972
|
+
for (let e of t?.actors ?? []) n.set(e.actorName, new Set(e.instances.map((e) => e.actorId)));
|
|
2973
|
+
for (let t of e) {
|
|
2974
|
+
let e = n.get(t.actorName) ?? /* @__PURE__ */ new Set();
|
|
2975
|
+
n.set(t.actorName, e.add(t.actorId));
|
|
2976
|
+
}
|
|
2977
|
+
return [...[...n.keys()].map((e) => ({
|
|
2978
|
+
group: "Actor class",
|
|
2979
|
+
value: e,
|
|
2980
|
+
hint: `${n.get(e).size.toLocaleString()} ${n.get(e).size === 1 ? "instance" : "instances"}`
|
|
2981
|
+
})), ...[...n].flatMap(([e, t]) => [...t].map((t) => ({
|
|
2982
|
+
group: "Instances",
|
|
2983
|
+
value: t,
|
|
2984
|
+
hint: e
|
|
2985
|
+
})))];
|
|
2986
|
+
}
|
|
2987
|
+
function _n(e, t, n) {
|
|
2988
|
+
return !e && !t.rows ? t.failed ? "Connections unavailable" : "Loading connections…" : n ? "No matching connections" : t.supported ? "No WebSocket sessions" : "No active WebSockets";
|
|
2989
|
+
}
|
|
2990
|
+
//#endregion
|
|
2991
|
+
//#region src/ConsoleApp.tsx
|
|
2992
|
+
var vn = [
|
|
2993
|
+
{
|
|
2994
|
+
id: "overview",
|
|
2995
|
+
label: "Durable Actors",
|
|
2996
|
+
icon: _
|
|
2997
|
+
},
|
|
2998
|
+
{
|
|
2999
|
+
id: "actors",
|
|
3000
|
+
label: "Actors",
|
|
3001
|
+
icon: c
|
|
3002
|
+
},
|
|
3003
|
+
{
|
|
3004
|
+
id: "requests",
|
|
3005
|
+
label: "Requests",
|
|
3006
|
+
icon: o
|
|
3007
|
+
},
|
|
3008
|
+
{
|
|
3009
|
+
id: "websockets",
|
|
3010
|
+
label: "WebSockets",
|
|
3011
|
+
icon: l
|
|
3012
|
+
}
|
|
3013
|
+
];
|
|
3014
|
+
function yn({ client: e, toggleTheme: t }) {
|
|
3015
|
+
let [n, r] = a("overview"), [i, o] = a(), [l, u] = a(z), d = {
|
|
3016
|
+
timeRange: l,
|
|
3017
|
+
onTimeRangeChange: u
|
|
3018
|
+
};
|
|
3019
|
+
function f(e) {
|
|
3020
|
+
o(e), r("actors");
|
|
3021
|
+
}
|
|
3022
|
+
return /* @__PURE__ */ A("div", {
|
|
3023
|
+
className: "console-shell",
|
|
3024
|
+
children: [
|
|
3025
|
+
/* @__PURE__ */ k("a", {
|
|
3026
|
+
className: "skip-link",
|
|
3027
|
+
href: "#main",
|
|
3028
|
+
children: "Skip to content"
|
|
3029
|
+
}),
|
|
3030
|
+
/* @__PURE__ */ A("aside", {
|
|
3031
|
+
className: "console-sidebar",
|
|
3032
|
+
children: [
|
|
3033
|
+
/* @__PURE__ */ A("div", {
|
|
3034
|
+
className: "console-brand",
|
|
3035
|
+
children: [/* @__PURE__ */ k(g, { "aria-hidden": "true" }), /* @__PURE__ */ k("strong", { children: "Terse" })]
|
|
3036
|
+
}),
|
|
3037
|
+
/* @__PURE__ */ k("nav", {
|
|
3038
|
+
"aria-label": "Observability",
|
|
3039
|
+
children: vn.map((e) => /* @__PURE__ */ A("button", {
|
|
3040
|
+
type: "button",
|
|
3041
|
+
"aria-current": n === e.id ? "page" : void 0,
|
|
3042
|
+
onClick: () => {
|
|
3043
|
+
o(void 0), r(e.id);
|
|
3044
|
+
},
|
|
3045
|
+
children: [/* @__PURE__ */ k(e.icon, { "aria-hidden": "true" }), e.label]
|
|
3046
|
+
}, e.id))
|
|
3047
|
+
}),
|
|
3048
|
+
/* @__PURE__ */ A("div", {
|
|
3049
|
+
className: "console-sidebar-foot",
|
|
3050
|
+
children: [/* @__PURE__ */ k(c, { "aria-hidden": "true" }), /* @__PURE__ */ A("span", { children: ["Runtime inspector", /* @__PURE__ */ k("small", { children: "Read-only observability" })] })]
|
|
3051
|
+
})
|
|
3052
|
+
]
|
|
3053
|
+
}),
|
|
3054
|
+
/* @__PURE__ */ A("div", {
|
|
3055
|
+
className: "console-workspace",
|
|
3056
|
+
children: [/* @__PURE__ */ A("header", {
|
|
3057
|
+
className: "console-topbar",
|
|
3058
|
+
children: [/* @__PURE__ */ k("button", {
|
|
3059
|
+
className: "theme-toggle",
|
|
3060
|
+
type: "button",
|
|
3061
|
+
onClick: t,
|
|
3062
|
+
"aria-label": "Toggle color theme",
|
|
3063
|
+
children: /* @__PURE__ */ k(x, { "aria-hidden": "true" })
|
|
3064
|
+
}), /* @__PURE__ */ A("a", {
|
|
3065
|
+
href: "https://github.com/TerseAI/durable-actors#readme",
|
|
3066
|
+
target: "_blank",
|
|
3067
|
+
rel: "noopener noreferrer",
|
|
3068
|
+
children: ["Docs", /* @__PURE__ */ k(s, { "aria-hidden": "true" })]
|
|
3069
|
+
})]
|
|
3070
|
+
}), /* @__PURE__ */ A("main", {
|
|
3071
|
+
id: "main",
|
|
3072
|
+
tabIndex: -1,
|
|
3073
|
+
children: [
|
|
3074
|
+
n === "overview" && /* @__PURE__ */ k(ht, {
|
|
3075
|
+
client: e,
|
|
3076
|
+
onSelectActor: f,
|
|
3077
|
+
...d
|
|
3078
|
+
}),
|
|
3079
|
+
n === "actors" && /* @__PURE__ */ k(qe, {
|
|
3080
|
+
client: e,
|
|
3081
|
+
navigation: {
|
|
3082
|
+
actorName: i,
|
|
3083
|
+
onSelectActor: o
|
|
3084
|
+
},
|
|
3085
|
+
...d
|
|
3086
|
+
}),
|
|
3087
|
+
n === "requests" && /* @__PURE__ */ k(Ie, {
|
|
3088
|
+
client: e,
|
|
3089
|
+
...d
|
|
3090
|
+
}),
|
|
3091
|
+
n === "websockets" && /* @__PURE__ */ k(un, {
|
|
3092
|
+
client: e,
|
|
3093
|
+
onSelectActor: f,
|
|
3094
|
+
...d
|
|
3095
|
+
})
|
|
3096
|
+
]
|
|
3097
|
+
})]
|
|
3098
|
+
})
|
|
3099
|
+
]
|
|
3100
|
+
});
|
|
3101
|
+
}
|
|
3102
|
+
//#endregion
|
|
3103
|
+
//#region src/client.ts
|
|
3104
|
+
var bn = class {
|
|
3105
|
+
baseUrl;
|
|
3106
|
+
request;
|
|
3107
|
+
constructor(e = "/api/observe", t = globalThis.fetch.bind(globalThis)) {
|
|
3108
|
+
this.baseUrl = e, this.request = t;
|
|
3109
|
+
}
|
|
3110
|
+
async getMetrics(e, t) {
|
|
3111
|
+
return ft(await this.get(`metrics${xn(e)}`, t));
|
|
3112
|
+
}
|
|
3113
|
+
async listQueueWaits(e, t) {
|
|
3114
|
+
return Ve(await this.get(`queue-waits${xn(e)}`, t));
|
|
3115
|
+
}
|
|
3116
|
+
async listWebSockets(e, t) {
|
|
3117
|
+
return Pt(await this.get(`websockets${xn(e)}`, t));
|
|
3118
|
+
}
|
|
3119
|
+
async listActors(e) {
|
|
3120
|
+
let t = await this.get("actors", e);
|
|
3121
|
+
if (!Sn(t)) throw Error("Invalid actor inventory response.");
|
|
3122
|
+
return t;
|
|
3123
|
+
}
|
|
3124
|
+
async watchActors(e, t) {
|
|
3125
|
+
return this.watch("events", "inventory", Sn, e, t);
|
|
3126
|
+
}
|
|
3127
|
+
async watchRequests(e, t, n) {
|
|
3128
|
+
let r = n ? `?${new URLSearchParams({ after: n })}` : "";
|
|
3129
|
+
return this.watch(`requests/events${r}`, "requests", Tn, e, t);
|
|
3130
|
+
}
|
|
3131
|
+
async listRequests(e, t) {
|
|
3132
|
+
let n = await this.get(`requests${xn(e)}`, t);
|
|
3133
|
+
if (!Tn(n)) throw Error("Invalid request history response");
|
|
3134
|
+
return n;
|
|
3135
|
+
}
|
|
3136
|
+
async watch(e, t, n, r, i) {
|
|
3137
|
+
let a = await this.request(`${this.baseUrl.replace(/\/$/u, "")}/${e}`, {
|
|
3138
|
+
signal: i,
|
|
3139
|
+
credentials: "same-origin",
|
|
3140
|
+
redirect: "error",
|
|
3141
|
+
headers: { accept: "text/event-stream" }
|
|
3142
|
+
});
|
|
3143
|
+
if (!a.ok || !a.headers.get("content-type")?.startsWith("text/event-stream") || !a.body) throw await a.body?.cancel(), Error("Live inventory is unavailable");
|
|
3144
|
+
let o = a.body.getReader(), s = new TextDecoder(), c = ne({ onEvent(e) {
|
|
3145
|
+
if (i.aborted) return;
|
|
3146
|
+
if (e.event === "error") throw Error("Live inventory is unavailable");
|
|
3147
|
+
if (e.event !== t) return;
|
|
3148
|
+
let a = JSON.parse(e.data);
|
|
3149
|
+
if (!n(a)) throw Error("Invalid observer response");
|
|
3150
|
+
r(a);
|
|
3151
|
+
} }), l = () => {
|
|
3152
|
+
o.cancel().catch(() => {});
|
|
3153
|
+
};
|
|
3154
|
+
i.addEventListener("abort", l, { once: !0 });
|
|
3155
|
+
try {
|
|
3156
|
+
for (; !i.aborted;) {
|
|
3157
|
+
let { value: e, done: t } = await o.read();
|
|
3158
|
+
if (t) break;
|
|
3159
|
+
c.feed(s.decode(e, { stream: !0 }));
|
|
3160
|
+
}
|
|
3161
|
+
if (!i.aborted) throw Error("Live inventory disconnected");
|
|
3162
|
+
} finally {
|
|
3163
|
+
i.removeEventListener("abort", l), await o.cancel().catch(() => {}), o.releaseLock();
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
3166
|
+
async checkConnection(e) {
|
|
3167
|
+
let t = await this.get("connection", e);
|
|
3168
|
+
if (!t || typeof t != "object" || !("connected" in t) || t.connected !== !0) throw Error("Invalid connection response.");
|
|
3169
|
+
}
|
|
3170
|
+
async get(e, t) {
|
|
3171
|
+
let n = await this.request(`${this.baseUrl.replace(/\/$/u, "")}/${e}`, {
|
|
3172
|
+
method: "GET",
|
|
3173
|
+
credentials: "same-origin",
|
|
3174
|
+
redirect: "error",
|
|
3175
|
+
signal: t,
|
|
3176
|
+
headers: { accept: "application/json" }
|
|
3177
|
+
});
|
|
3178
|
+
if (!n.ok) throw Error(`Connection check failed (HTTP ${n.status}).`);
|
|
3179
|
+
return n.json();
|
|
3180
|
+
}
|
|
3181
|
+
};
|
|
3182
|
+
function xn(e) {
|
|
3183
|
+
let t = new URLSearchParams();
|
|
3184
|
+
for (let [n, r] of Object.entries(e)) r !== void 0 && t.set(n, String(r));
|
|
3185
|
+
return t.size ? `?${t}` : "";
|
|
3186
|
+
}
|
|
3187
|
+
function Sn(e) {
|
|
3188
|
+
return !e || typeof e != "object" || !("actors" in e) || !Array.isArray(e.actors) ? !1 : e.actors.every((e) => e && typeof e.actorName == "string" && [
|
|
3189
|
+
e.live,
|
|
3190
|
+
e.dormant,
|
|
3191
|
+
e.unknown
|
|
3192
|
+
].every((e) => Number.isSafeInteger(e) && e >= 0) && Array.isArray(e.instances) && e.instances.every(Cn));
|
|
3193
|
+
}
|
|
3194
|
+
function Cn(e) {
|
|
3195
|
+
return !!e && typeof e == "object" && "actorId" in e && typeof e.actorId == "string" && "status" in e && [
|
|
3196
|
+
"live",
|
|
3197
|
+
"dormant",
|
|
3198
|
+
"unknown"
|
|
3199
|
+
].includes(String(e.status)) && "connections" in e && Array.isArray(e.connections) && e.connections.every(wn) && (!("waiting" in e) || e.waiting == null || Array.isArray(e.waiting) && e.waiting.every((e) => !!e && typeof e == "object" && typeof e.id == "string" && typeof e.operation == "string"));
|
|
3200
|
+
}
|
|
3201
|
+
function wn(e) {
|
|
3202
|
+
return !!e && typeof e == "object" && "id" in e && typeof e.id == "string" && "metadata" in e;
|
|
3203
|
+
}
|
|
3204
|
+
function Tn(e) {
|
|
3205
|
+
if (!e || typeof e != "object") return !1;
|
|
3206
|
+
let t = e;
|
|
3207
|
+
return typeof t.epoch == "string" && [
|
|
3208
|
+
t.cursor,
|
|
3209
|
+
t.capacity,
|
|
3210
|
+
t.evicted,
|
|
3211
|
+
t.dropped
|
|
3212
|
+
].every(En) && (t.persistenceFailed === void 0 || typeof t.persistenceFailed == "boolean") && (t.nextCursor == null || typeof t.nextCursor == "string") && (t.resumeCursor === void 0 || typeof t.resumeCursor == "string") && (t.reset === void 0 || typeof t.reset == "boolean") && t.capacity > 0 && t.capacity <= 500 && Array.isArray(t.records) && t.records.length <= t.capacity && t.records.every((e) => Dn(e) && e.sequence <= t.cursor);
|
|
3213
|
+
}
|
|
3214
|
+
function En(e) {
|
|
3215
|
+
return Number.isSafeInteger(e) && Number(e) >= 0;
|
|
3216
|
+
}
|
|
3217
|
+
function Dn(e) {
|
|
3218
|
+
if (!e || typeof e != "object") return !1;
|
|
3219
|
+
let t = e;
|
|
3220
|
+
return typeof t.projectId == "string" && /^[A-Za-z0-9._-]{1,64}$/u.test(t.projectId) && [
|
|
3221
|
+
t.requestId,
|
|
3222
|
+
t.hostId,
|
|
3223
|
+
t.sessionId,
|
|
3224
|
+
t.actorName,
|
|
3225
|
+
t.actorId,
|
|
3226
|
+
t.operation
|
|
3227
|
+
].every((e) => typeof e == "string") && (t.eventId === void 0 || typeof t.eventId == "string" && t.eventId.length > 0) && En(t.sequence) && En(t.startedAtMs) && t.startedAtMs <= 864e13 && ["method", "websocket"].includes(t.kind) && [
|
|
3228
|
+
"completed",
|
|
3229
|
+
"failed",
|
|
3230
|
+
"rejected",
|
|
3231
|
+
"rerouted",
|
|
3232
|
+
"interrupted"
|
|
3233
|
+
].includes(t.outcome) && (t.connectionId === null || typeof t.connectionId == "string") && Number.isFinite(t.durationMs) && t.durationMs >= 0 && (t.queueWaitMs === null || Number.isFinite(t.queueWaitMs) && t.queueWaitMs >= 0 && t.queueWaitMs <= t.durationMs);
|
|
3234
|
+
}
|
|
3235
|
+
//#endregion
|
|
3236
|
+
export { qe as ActorObserver, U as Badge, L as Button, ae as Calendar, oe as CalendarDayButton, wt as Command, Dt as CommandEmpty, Ot as CommandGroup, Tt as CommandInput, At as CommandItem, Et as CommandList, kt as CommandSeparator, jt as CommandShortcut, yn as ConsoleApp, Mt as FilterCombobox, bn as HttpObserverClient, R as Input, ht as Overview, se as Popover, ue as PopoverAnchor, le as PopoverContent, pe as PopoverDescription, de as PopoverHeader, fe as PopoverTitle, ce as PopoverTrigger, Ie as RequestObserver, Te as Sheet, Oe as SheetContent, De as SheetDescription, Ee as SheetTitle, Jt as SocketTimeline, W as Table, K as TableBody, Ae as TableCaption, Y as TableCell, ke as TableFooter, J as TableHead, G as TableHeader, q as TableRow, _e as TimeRangePicker, un as WebSocketObserver, we as badgeVariants, ie as buttonVariants, z as defaultTimeRange, V as rangeLabel, B as resolveRange };
|