querysub 0.518.0 → 0.520.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/-f-node-discovery/LatencyTracking.ts +116 -0
- package/src/-f-node-discovery/NodeDiscovery.ts +9 -1
- package/src/-f-node-discovery/TrafficTracking.ts +159 -0
- package/src/0-path-value-core/PathRouter.ts +53 -5
- package/src/0-path-value-core/PathValueController.ts +3 -0
- package/src/0-path-value-core/pathValueArchives.ts +2 -1
- package/src/0-path-value-core/startupAuthority.ts +2 -2
- package/src/3-path-functions/PathFunctionRunner.ts +2 -0
- package/src/4-querysub/FunctionRunnerTracking.ts +5 -8
- package/src/4-querysub/Querysub.ts +4 -2
- package/src/4-querysub/QuerysubController.ts +2 -0
- package/src/4-querysub/querysubPrediction.ts +12 -11
- package/src/deployManager/components/MachineDetailPage.tsx +2 -2
- package/src/deployManager/components/ServiceDetailPage.tsx +60 -9
- package/src/deployManager/components/ServicesListPage.tsx +2 -2
- package/src/deployManager/components/Tools.tsx +6 -10
- package/src/deployManager/machineApplyMainCode.ts +13 -11
- package/src/deployManager/machineSchema.ts +50 -6
- package/src/diagnostics/managementPages.tsx +3 -3
- package/src/diagnostics/misc-pages/RoutingTablePage.tsx +324 -0
- package/src/diagnostics/pathAuditer.ts +75 -40
- package/src/library-components/LatencyGraph.tsx +1450 -0
- package/src/src.d.ts +3 -1
- package/src/diagnostics/misc-pages/AuthoritySpecPage.tsx +0 -146
package/src/src.d.ts
CHANGED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
module.allowclient = true;
|
|
2
|
-
|
|
3
|
-
import { qreact } from "../../4-dom/qreact";
|
|
4
|
-
import { css } from "typesafecss";
|
|
5
|
-
import { SocketFunction } from "socket-function/SocketFunction";
|
|
6
|
-
import { getAllNodeIds, getBrowserUrlNode } from "../../-f-node-discovery/NodeDiscovery";
|
|
7
|
-
import { getSyncedController } from "../../library-components/SyncedController";
|
|
8
|
-
import { assertIsManagementUser } from "../managementPages";
|
|
9
|
-
import { NodeCapabilitiesController } from "../../-g-core-values/NodeCapabilities";
|
|
10
|
-
import { timeoutToUndefinedSilent } from "../../errors";
|
|
11
|
-
import { sort } from "socket-function/src/misc";
|
|
12
|
-
import type { AuthoritySpec } from "../../0-path-value-core/PathRouter";
|
|
13
|
-
import { getFunctionRunnerIndex } from "../../4-querysub/FunctionRunnerTracking";
|
|
14
|
-
import { formatTime } from "socket-function/src/formatting/format";
|
|
15
|
-
|
|
16
|
-
const PROBE_TIMEOUT_MS = 5000;
|
|
17
|
-
const RANGE_BAR_WIDTH_PX = 360;
|
|
18
|
-
const RANGE_BAR_HEIGHT_PX = 14;
|
|
19
|
-
|
|
20
|
-
type NodeAuthorityInfo = {
|
|
21
|
-
nodeId: string;
|
|
22
|
-
entryPoint?: string;
|
|
23
|
-
spec?: AuthoritySpec;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
class AuthoritySpecPageControllerBase {
|
|
27
|
-
public async getAllNodeAuthoritySpecs(): Promise<NodeAuthorityInfo[]> {
|
|
28
|
-
let nodes = await getAllNodeIds();
|
|
29
|
-
return Promise.all(nodes.map(async (nodeId): Promise<NodeAuthorityInfo> => {
|
|
30
|
-
let metadata = await timeoutToUndefinedSilent(PROBE_TIMEOUT_MS, NodeCapabilitiesController.nodes[nodeId].getMetadata());
|
|
31
|
-
return { nodeId, entryPoint: metadata?.entryPoint, spec: metadata?.authoritySpec };
|
|
32
|
-
}));
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export const AuthoritySpecPageController = SocketFunction.register(
|
|
37
|
-
"AuthoritySpecPageController-7b8c9d0e-1f2a-3b4c-5d6e-7f8090a1b2c3",
|
|
38
|
-
new AuthoritySpecPageControllerBase(),
|
|
39
|
-
() => ({
|
|
40
|
-
getAllNodeAuthoritySpecs: {},
|
|
41
|
-
}),
|
|
42
|
-
() => ({
|
|
43
|
-
hooks: [assertIsManagementUser],
|
|
44
|
-
}),
|
|
45
|
-
{
|
|
46
|
-
noAutoExpose: true,
|
|
47
|
-
}
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
const AuthoritySpecSynced = getSyncedController(AuthoritySpecPageController, {
|
|
51
|
-
reads: { getAllNodeAuthoritySpecs: ["nodeAuthoritySpecs"] },
|
|
52
|
-
writes: {},
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
class AuthorityRangeBar extends qreact.Component<{ start: number; end: number }> {
|
|
56
|
-
render() {
|
|
57
|
-
let startPct = this.props.start * 100;
|
|
58
|
-
let widthPct = (this.props.end - this.props.start) * 100;
|
|
59
|
-
return <div className={css.relative.size(RANGE_BAR_WIDTH_PX, RANGE_BAR_HEIGHT_PX).flexShrink0.hsl(0, 0, 92).bord2(0, 0, 75)}>
|
|
60
|
-
<div className={css.absolute.top(0).left(`${startPct}%`).size(`${widthPct}%`, "100%").hsl(210, 65, 50)} />
|
|
61
|
-
</div>;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
class AuthorityNodeRow extends qreact.Component<{ info: NodeAuthorityInfo }> {
|
|
66
|
-
state = {
|
|
67
|
-
expanded: false,
|
|
68
|
-
};
|
|
69
|
-
render() {
|
|
70
|
-
let info = this.props.info;
|
|
71
|
-
let spec = info.spec!;
|
|
72
|
-
let expanded = this.state.expanded;
|
|
73
|
-
return <div
|
|
74
|
-
className={css.button.vbox(6).pad2(10).fillWidth.bord2(0, 0, 85).hsl(0, 0, 99)}
|
|
75
|
-
onClick={() => this.state.expanded = !expanded}
|
|
76
|
-
>
|
|
77
|
-
<div className={css.hbox(10).fillWidth}>
|
|
78
|
-
<span>{expanded ? "▼" : "▶"}</span>
|
|
79
|
-
<span className={css.boldStyle}>{info.nodeId}</span>
|
|
80
|
-
<span>{spec.routeStart.toFixed(4)} - {spec.routeEnd.toFixed(4)}</span>
|
|
81
|
-
<AuthorityRangeBar start={spec.routeStart} end={spec.routeEnd} />
|
|
82
|
-
<span className={css.colorhsl(0, 0, 50)}>width {(spec.routeEnd - spec.routeStart).toFixed(4)}</span>
|
|
83
|
-
{spec.excludeDefault && <span className={css.colorhsl(0, 70, 35)}>(excludes default)</span>}
|
|
84
|
-
<span className={css.colorhsl(0, 0, 40).ellipsis.flexFillWidth}>{info.entryPoint || "(no entry point)"}</span>
|
|
85
|
-
</div>
|
|
86
|
-
{expanded &&
|
|
87
|
-
<div className={css.vbox(2)}>
|
|
88
|
-
<div className={css.boldStyle}>Prefixes ({spec.prefixes.length}):</div>
|
|
89
|
-
{spec.prefixes.length === 0 && <div className={css.colorhsl(0, 0, 50)}>(none)</div>}
|
|
90
|
-
{spec.prefixes.map(p =>
|
|
91
|
-
<div key={p.originalPrefix} className={css.colorhsl(0, 0, 25)}>{p.originalPrefix}</div>
|
|
92
|
-
)}
|
|
93
|
-
</div>
|
|
94
|
-
}
|
|
95
|
-
</div>;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
class FunctionRunnersSection extends qreact.Component {
|
|
100
|
-
render() {
|
|
101
|
-
let index = getFunctionRunnerIndex();
|
|
102
|
-
let nodes = index?.nodes || [];
|
|
103
|
-
return <div className={css.vbox(8).fillWidth}>
|
|
104
|
-
<h2>Function Runners ({nodes.length})</h2>
|
|
105
|
-
{nodes.length === 0 && <div className={css.colorhsl(0, 0, 50)}>(no function runners found yet)</div>}
|
|
106
|
-
{nodes.map(node =>
|
|
107
|
-
<div className={css.vbox(4).pad2(10).fillWidth.bord2(0, 0, 85).hsl(0, 0, 99)}>
|
|
108
|
-
<div className={css.hbox(10).fillWidth}>
|
|
109
|
-
<span className={css.boldStyle}>{node.nodeId}</span>
|
|
110
|
-
<span className={css.colorhsl(210, 60, 40)}>networks: {node.networks.join(", ")}</span>
|
|
111
|
-
{!node.isPublic && <span className={css.colorhsl(0, 70, 35)}>(non-public)</span>}
|
|
112
|
-
<span>latency {formatTime(node.averageLatency)}</span>
|
|
113
|
-
<span>up for {formatTime(Date.now() - node.startupTime)}</span>
|
|
114
|
-
<span className={css.colorhsl(0, 0, 40).ellipsis}>{node.entryPoint}</span>
|
|
115
|
-
</div>
|
|
116
|
-
{node.shards.map(shard =>
|
|
117
|
-
<div className={css.hbox(10).fillWidth}>
|
|
118
|
-
<span>{shard.shardRange.startFraction.toFixed(4)} - {shard.shardRange.endFraction.toFixed(4)}</span>
|
|
119
|
-
<AuthorityRangeBar start={shard.shardRange.startFraction} end={shard.shardRange.endFraction} />
|
|
120
|
-
{shard.secondaryShardRange && <span className={css.colorhsl(0, 0, 50)}>secondary {shard.secondaryShardRange.startFraction.toFixed(4)} - {shard.secondaryShardRange.endFraction.toFixed(4)}</span>}
|
|
121
|
-
</div>
|
|
122
|
-
)}
|
|
123
|
-
</div>
|
|
124
|
-
)}
|
|
125
|
-
</div>;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export class AuthoritySpecPage extends qreact.Component {
|
|
130
|
-
render() {
|
|
131
|
-
let infos = AuthoritySpecSynced(getBrowserUrlNode()).getAllNodeAuthoritySpecs();
|
|
132
|
-
if (!infos) {
|
|
133
|
-
return <div className={css.pad2(16)}>Loading routing table...</div>;
|
|
134
|
-
}
|
|
135
|
-
infos = infos.filter(x => x.spec && x.spec.routeStart >= 0 && x.spec.routeEnd >= 0);
|
|
136
|
-
sort(infos, x => x.spec!.routeStart);
|
|
137
|
-
|
|
138
|
-
return <div className={css.vbox(12).pad2(16).fillWidth}>
|
|
139
|
-
<h2>Routing Table ({infos.length})</h2>
|
|
140
|
-
<div className={css.vbox(8).fillWidth}>
|
|
141
|
-
{infos.map(info => <AuthorityNodeRow key={info.nodeId} info={info} />)}
|
|
142
|
-
</div>
|
|
143
|
-
<FunctionRunnersSection />
|
|
144
|
-
</div>;
|
|
145
|
-
}
|
|
146
|
-
}
|