querysub 0.43.0 → 0.45.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 +60 -60
- package/src/-a-archives/archivesBackBlaze.ts +3 -0
- package/src/-g-core-values/NodeCapabilities.ts +6 -4
- package/src/0-path-value-core/NodePathAuthorities.ts +24 -2
- package/src/0-path-value-core/pathValueCore.ts +2221 -2216
- package/src/2-proxy/PathValueProxyWatcher.ts +41 -3
- package/src/3-path-functions/PathFunctionRunner.ts +19 -6
- package/src/3-path-functions/pathFunctionLoader.ts +7 -1
- package/src/4-querysub/QuerysubController.ts +0 -10
- package/src/5-diagnostics/GenericFormat.tsx +3 -1
- package/src/5-diagnostics/TimeGrouper.tsx +2 -0
- package/src/5-diagnostics/nodeMetadata.ts +137 -11
- package/src/diagnostics/NodeViewer.tsx +19 -8
- package/src/diagnostics/logs/DiskLoggerPage.tsx +36 -16
- package/src/diagnostics/logs/diskLogger.ts +12 -1
- package/src/diagnostics/periodic.ts +2 -2
- package/src/diagnostics/trackResources.ts +4 -3
- package/src/diagnostics/watchdog.ts +20 -6
- package/src/library-components/Input.tsx +1 -1
- package/src/zip.ts +1 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { runInfinitePoll, runInfinitePollCallAtStart } from "socket-function/src/batching";
|
|
2
|
-
import { isNode } from "socket-function/src/misc";
|
|
2
|
+
import { isNode, timeInMinute } from "socket-function/src/misc";
|
|
3
3
|
import { logErrors } from "../errors";
|
|
4
4
|
import debugbreak from "debugbreak";
|
|
5
5
|
import { nodeDiscoveryShutdown } from "../-f-node-discovery/NodeDiscovery";
|
|
@@ -22,7 +22,7 @@ function logAll() {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
logErrors(runInfinitePollCallAtStart(
|
|
25
|
+
logErrors(runInfinitePollCallAtStart(timeInMinute * 5, logAll));
|
|
26
26
|
|
|
27
27
|
async function shutdown() {
|
|
28
28
|
const { authorityStorage } = await import("../0-path-value-core/pathValueCore");
|
|
@@ -64,6 +64,10 @@ function getBufferUsage() {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
registerDynamicResource("Heap", getUsedHeapSize);
|
|
68
|
+
registerDynamicResource("Buffers", getBufferUsage);
|
|
69
|
+
registerDynamicResource("All Memory", getHeapSize);
|
|
70
|
+
|
|
67
71
|
function logResourcesNow() {
|
|
68
72
|
let resourcesWithCounts = resources.map(resource => ({ ...resource, count: resource.getCount() }));
|
|
69
73
|
resourcesWithCounts.sort((a, b) => b.count - a.count);
|
|
@@ -74,9 +78,6 @@ function logResourcesNow() {
|
|
|
74
78
|
console.log(` ${resource.name}: ${formatNumber(resource.count)}`);
|
|
75
79
|
}
|
|
76
80
|
} else {
|
|
77
|
-
logNodeStateStats("Heap", formatNumber)(getUsedHeapSize());
|
|
78
|
-
logNodeStateStats("Buffers", formatNumber)(getBufferUsage());
|
|
79
|
-
logNodeStateStats("All Memory", formatNumber)(getHeapSize());
|
|
80
81
|
for (let resource of resourcesWithCounts) {
|
|
81
82
|
if (resource.count === 0) continue;
|
|
82
83
|
logNodeStateStats(resource.name, formatNumber)(resource.count);
|
|
@@ -7,20 +7,30 @@ import { registerPeriodic } from "./periodic";
|
|
|
7
7
|
import { getOwnMachineId } from "../-a-auth/certs";
|
|
8
8
|
import { SocketFunction } from "socket-function/SocketFunction";
|
|
9
9
|
import { logDisk } from "./logs/diskLogger";
|
|
10
|
-
import { registerNodeMetadata } from "../5-diagnostics/nodeMetadata";
|
|
11
|
-
import { formatPercent } from "socket-function/src/formatting/format";
|
|
10
|
+
import { addStatPeriodic, addStatSumPeriodic, addTimeProfileDistribution, registerNodeMetadata } from "../5-diagnostics/nodeMetadata";
|
|
11
|
+
import { formatPercent, formatTime } from "socket-function/src/formatting/format";
|
|
12
12
|
|
|
13
13
|
let lastProfile: MeasureProfile | undefined;
|
|
14
14
|
|
|
15
|
+
addStatPeriodic(
|
|
16
|
+
"% Profiled",
|
|
17
|
+
() => {
|
|
18
|
+
if (!lastProfile) return 0;
|
|
19
|
+
let entries = Object.values(lastProfile.entries);
|
|
20
|
+
if (entries.length === 0) return 0;
|
|
21
|
+
const timeProfiled = lastProfile.endTime - lastProfile.startTime;
|
|
22
|
+
let timeActive = entries.map(x => x.ownTime.sum).reduce((a, b) => a + b, 0);
|
|
23
|
+
return timeActive / timeProfiled;
|
|
24
|
+
},
|
|
25
|
+
formatPercent,
|
|
26
|
+
);
|
|
15
27
|
registerNodeMetadata({
|
|
16
|
-
columnName: "
|
|
28
|
+
columnName: "Top Profiled",
|
|
17
29
|
getValue() {
|
|
18
30
|
if (!lastProfile) return "";
|
|
19
31
|
let entries = Object.values(lastProfile.entries);
|
|
20
32
|
if (entries.length === 0) return "";
|
|
21
33
|
const timeProfiled = lastProfile.endTime - lastProfile.startTime;
|
|
22
|
-
let timeActive = entries.map(x => x.ownTime.sum).reduce((a, b) => a + b, 0);
|
|
23
|
-
let frac = timeActive / timeProfiled;
|
|
24
34
|
let rootSums = new Map<string, number>();
|
|
25
35
|
for (let entry of entries) {
|
|
26
36
|
let name = entry.name.split("|")[0];
|
|
@@ -28,9 +38,13 @@ registerNodeMetadata({
|
|
|
28
38
|
rootSums.set(name, sum + entry.ownTime.sum);
|
|
29
39
|
}
|
|
30
40
|
let most = sort(Array.from(rootSums.entries()), x => -x[1])[0];
|
|
31
|
-
return `${
|
|
41
|
+
return `${endEllipsis(most[0], 26)} = ${formatPercent(most[1] / timeProfiled)}`;
|
|
32
42
|
},
|
|
33
43
|
});
|
|
44
|
+
addTimeProfileDistribution("Network Calls", () => SocketFunction.harvestCallTimes());
|
|
45
|
+
addStatPeriodic("Pending Net Calls", () => SocketFunction.getPendingCallCount());
|
|
46
|
+
addStatSumPeriodic("Failed Net Calls", () => SocketFunction.harvestFailedCallCount());
|
|
47
|
+
|
|
34
48
|
function endEllipsis(str: string, maxLength: number) {
|
|
35
49
|
if (str.length <= maxLength) return str;
|
|
36
50
|
return "..." + str.slice(-(maxLength - 3));
|