querysub 0.462.0 → 0.464.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 +1 -1
- package/src/-d-trust/NetworkTrust2.ts +1 -1
- package/src/0-path-value-core/LockWatcher2.ts +2 -5
- package/src/0-path-value-core/PathRouter.ts +2 -3
- package/src/0-path-value-core/PathRouterConstants.ts +4 -0
- package/src/0-path-value-core/PathValueCommitter.ts +0 -1
- package/src/0-path-value-core/PathValueController.ts +1 -1
- package/src/0-path-value-core/PathWatcher.ts +14 -5
- package/src/0-path-value-core/ValidStateComputer.ts +234 -86
- package/src/0-path-value-core/pathValueCore.ts +57 -78
- package/src/1-path-client/RemoteWatcher.ts +3 -2
- package/src/1-path-client/pathValueClientWatcher.ts +28 -2
- package/src/2-proxy/PathValueProxyWatcher.ts +29 -24
- package/src/2-proxy/TransactionDelayer.ts +44 -22
- package/src/2-proxy/archiveMoveHarness.ts +2 -2
- package/src/3-path-functions/PathFunctionRunner.ts +30 -22
- package/src/3-path-functions/PathFunctionRunnerMain.ts +1 -3
- package/src/4-deploy/deployFunctions.ts +1 -1
- package/src/4-deploy/deployMain.ts +1 -1
- package/src/4-deploy/edgeClientWatcher.tsx +1 -1
- package/src/4-deploy/edgeNodes.ts +1 -1
- package/src/4-dom/qreactTest.tsx +1 -1
- package/src/4-querysub/Querysub.ts +8 -9
- package/src/4-querysub/QuerysubController.ts +19 -1
- package/src/4-querysub/permissions.ts +1 -1
- package/src/4-querysub/predictionQueue.tsx +1 -1
- package/src/4-querysub/querysubPrediction.ts +25 -12
- package/src/5-diagnostics/GenericFormat.tsx +1 -1
- package/src/5-diagnostics/qreactDebug.tsx +2 -2
- package/src/archiveapps/archiveGCEntry.tsx +1 -1
- package/src/archiveapps/archiveJoinEntry.ts +3 -3
- package/src/config.ts +5 -1
- package/src/config2.ts +9 -7
- package/src/deployManager/components/CommitModal.tsx +1 -1
- package/src/deployManager/components/DeployProgressView.tsx +1 -1
- package/src/deployManager/components/MachineDetailPage.tsx +1 -1
- package/src/deployManager/components/MachinesListPage.tsx +1 -1
- package/src/deployManager/components/ServiceDetailPage.tsx +1 -1
- package/src/deployManager/components/ServicesListPage.tsx +1 -1
- package/src/deployManager/components/Tools.tsx +1 -1
- package/src/deployManager/machineApplyMainCode.ts +1 -1
- package/src/deployManager/machineController.ts +1 -1
- package/src/deployManager/machineSchema.ts +1 -1
- package/src/deployManager/setupMachineMain.ts +1 -1
- package/src/diagnostics/FunctionCallInfoState.ts +6 -3
- package/src/diagnostics/MachineThreadInfo.tsx +1 -1
- package/src/diagnostics/NodeViewer.tsx +2 -1
- package/src/diagnostics/StatWarning.tsx +56 -0
- package/src/diagnostics/StatsHeader.tsx +248 -0
- package/src/diagnostics/StatsOverrides.ts +50 -0
- package/src/diagnostics/SyncTestPage.tsx +3 -3
- package/src/diagnostics/TimeDebug.tsx +1 -1
- package/src/diagnostics/debugger/mcp-server.ts +1 -1
- package/src/diagnostics/grossStats/GrossStatsPage.tsx +1 -1
- package/src/diagnostics/logs/IndexedLogs/LogViewer3.tsx +1 -1
- package/src/diagnostics/logs/IndexedLogs/MCPIndexedLogsEntry.ts +1 -1
- package/src/diagnostics/logs/TimeRangeSelector.tsx +1 -1
- package/src/diagnostics/logs/errorNotifications2/ErrorNotificationPage.tsx +1 -1
- package/src/diagnostics/logs/errorNotifications2/ErrorWarning.tsx +0 -1
- package/src/diagnostics/logs/errorNotifications2/errorNotifications.ts +1 -1
- package/src/diagnostics/logs/errorNotifications2/errorWatchEntry.ts +1 -1
- package/src/diagnostics/logs/errorNotifications2/errorWatcher.ts +1 -1
- package/src/diagnostics/logs/lifeCycleAnalysis/LifeCycleEntryEditor.tsx +1 -1
- package/src/diagnostics/logs/lifeCycleAnalysis/LifeCycleEntryReadMode.tsx +1 -1
- package/src/diagnostics/logs/lifeCycleAnalysis/LifeCyclePage.tsx +1 -1
- package/src/diagnostics/logs/lifeCycleAnalysis/LifeCycleRenderer.tsx +1 -1
- package/src/diagnostics/logs/lifeCycleAnalysis/lifeCycleSearch.tsx +1 -1
- package/src/diagnostics/managementPages.tsx +4 -9
- package/src/diagnostics/misc-pages/ArchiveViewer.tsx +1 -1
- package/src/diagnostics/misc-pages/ArchiveViewerTree.tsx +1 -1
- package/src/diagnostics/misc-pages/DNSPage.tsx +1 -1
- package/src/diagnostics/pathAuditer.ts +6 -6
- package/src/diagnostics/statsDefinitions.tsx +253 -0
- package/src/functional/throttleRender.ts +1 -1
- package/src/library-components/AspectSizedComponent.tsx +1 -1
- package/src/library-components/Button.tsx +1 -1
- package/src/library-components/ButtonSelector.tsx +1 -1
- package/src/library-components/DropdownCustom.tsx +1 -1
- package/src/library-components/DropdownSelector.tsx +1 -1
- package/src/library-components/Histogram.tsx +1 -1
- package/src/library-components/InlinePopup.tsx +1 -1
- package/src/library-components/LazyComponent.tsx +5 -1
- package/src/library-components/StickyBottomScroll.tsx +1 -1
- package/src/library-components/TypedConfigEditor.tsx +1 -1
- package/src/library-components/URLParam.ts +5 -9
- package/src/library-components/drag.ts +1 -1
- package/src/misc/formatJSX.tsx +1 -1
- package/src/user-implementation/userData.ts +1 -1
- package/test2.ts +1 -1
- package/testEntry2.ts +1 -1
- package/valid.md +205 -0
- package/src/deployManager/LaunchTrackingHeader.tsx +0 -65
- package/src/diagnostics/FunctionCallInfo.tsx +0 -141
- package/src/diagnostics/PathDistributionInfo.tsx +0 -110
- package/src/diagnostics/ValuePathWarning.tsx +0 -68
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Querysub } from "../../src/4-querysub/
|
|
1
|
+
import { Querysub } from "../../src/4-querysub/Querysub";
|
|
2
2
|
import { isClient, isServer } from "../../src/config2";
|
|
3
3
|
import { logErrors } from "../../src/errors";
|
|
4
4
|
import { SocketFunction } from "socket-function/SocketFunction";
|
|
@@ -27,10 +27,9 @@ import { addComponentButton } from "../5-diagnostics/qreactDebug";
|
|
|
27
27
|
import { closeAllModals } from "../5-diagnostics/Modal";
|
|
28
28
|
import { delay } from "socket-function/src/batching";
|
|
29
29
|
import { currentViewParam, selectedServiceIdParam } from "../deployManager/urlParams";
|
|
30
|
-
import { FunctionCallInfo } from "./FunctionCallInfo";
|
|
31
|
-
import { PathDistributionInfo } from "./PathDistributionInfo";
|
|
32
|
-
import { ValuePathWarning } from "./ValuePathWarning";
|
|
33
30
|
import { isCurrentUserSuperUser } from "../user-implementation/userData";
|
|
31
|
+
import { StatsHeader } from "./StatsHeader";
|
|
32
|
+
import { getQuerysubStatsSync } from "./statsDefinitions";
|
|
34
33
|
|
|
35
34
|
export const managementPageURL = new URLParam("managementpage", "");
|
|
36
35
|
export const showingManagementURL = new URLParam("showingmanagement", false);
|
|
@@ -318,7 +317,6 @@ export function renderIsManagementUser() {
|
|
|
318
317
|
}
|
|
319
318
|
|
|
320
319
|
const ErrorWarning = createLazyComponent(() => import("./logs/errorNotifications2/ErrorWarning"))("ErrorWarning");
|
|
321
|
-
const LaunchTrackingHeader = createLazyComponent(() => import("../deployManager/LaunchTrackingHeader"))("LaunchTrackingHeader");
|
|
322
320
|
const GrossStatsInfo = createLazyComponent(() => import("./grossStats/GrossStatsInfo"))("GrossStatsInfo");
|
|
323
321
|
|
|
324
322
|
class ManagementRoot extends qreact.Component {
|
|
@@ -388,11 +386,8 @@ class ManagementRoot extends qreact.Component {
|
|
|
388
386
|
{pages.map(page =>
|
|
389
387
|
<ATag values={[{ param: managementPageURL, value: page.componentName }]}>{page.title}</ATag>
|
|
390
388
|
)}
|
|
391
|
-
{isCurrentUserSuperUser() && <FunctionCallInfo />}
|
|
392
389
|
{isCurrentUserSuperUser() && <div className={css.vbox(4)}>
|
|
393
|
-
<
|
|
394
|
-
<ValuePathWarning />
|
|
395
|
-
<LaunchTrackingHeader />
|
|
390
|
+
<StatsHeader getStats={getQuerysubStatsSync} />
|
|
396
391
|
<GrossStatsInfo />
|
|
397
392
|
</div>}
|
|
398
393
|
</div>
|
|
@@ -7,7 +7,7 @@ import { rootPathStr } from "../../path";
|
|
|
7
7
|
import { css } from "typesafecss";
|
|
8
8
|
import { cacheArgsEqual, cacheLimited, cacheShallowConfigArgEqual, lazy } from "socket-function/src/caching";
|
|
9
9
|
import { atomic, atomicObjectWrite, atomicObjectWriteNoFreeze, doAtomicWrites, proxyWatcher } from "../../2-proxy/PathValueProxyWatcher";
|
|
10
|
-
import { Querysub } from "../../4-querysub/
|
|
10
|
+
import { Querysub } from "../../4-querysub/Querysub";
|
|
11
11
|
import { formatDate, formatDateTime, formatNumber, formatPercent, formatTime } from "socket-function/src/formatting/format";
|
|
12
12
|
import { Histogram, XYValue } from "../../library-components/Histogram";
|
|
13
13
|
import { Button } from "../../library-components/Button";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import preact from "preact";
|
|
2
2
|
import { PathValue } from "../../0-path-value-core/pathValueCore";
|
|
3
|
-
import { Querysub } from "../../4-querysub/
|
|
3
|
+
import { Querysub } from "../../4-querysub/Querysub";
|
|
4
4
|
import { createURLSync } from "../../library-components/URLParam";
|
|
5
5
|
import { appendToPathStr, getPathDepth, getPathFromStr, getPathIndex, getPathPrefix, getPathStr, getPathSuffix, rootPathStr } from "../../path";
|
|
6
6
|
import { cache, cacheArgsEqual, cacheLimited, cacheShallowConfigArgEqual } from "socket-function/src/caching";
|
|
@@ -7,7 +7,7 @@ import { getBrowserUrlNode } from "../../-f-node-discovery/NodeDiscovery";
|
|
|
7
7
|
import { getSyncedController } from "../../library-components/SyncedController";
|
|
8
8
|
import { assertIsManagementUser } from "../managementPages";
|
|
9
9
|
import { t } from "../../2-proxy/schema2";
|
|
10
|
-
import { Querysub } from "../../4-querysub/
|
|
10
|
+
import { Querysub } from "../../4-querysub/Querysub";
|
|
11
11
|
import { sort, timeInDay } from "socket-function/src/misc";
|
|
12
12
|
import { isNode } from "typesafecss";
|
|
13
13
|
import { formatDateJSX } from "../../misc/formatJSX";
|
|
@@ -206,7 +206,7 @@ async function processPendingValidityChecks(now: number) {
|
|
|
206
206
|
|
|
207
207
|
for (let i = 0; i < splitIndex; i++) {
|
|
208
208
|
let pendingCheck = pendingValidityChecks[i];
|
|
209
|
-
let currentValue = authorityStorage.
|
|
209
|
+
let currentValue = authorityStorage.getValueAtOrBeforeTime(pendingCheck.path);
|
|
210
210
|
if (currentValue && currentValue.valid && currentValue.time !== epochTime) {
|
|
211
211
|
trackSyncAge({
|
|
212
212
|
path: pendingCheck.path,
|
|
@@ -278,7 +278,7 @@ async function auditAuthority(nodeId: string, pathsToAudit: { path: string }[],
|
|
|
278
278
|
|
|
279
279
|
for (let pathObj of pathsToAudit) {
|
|
280
280
|
let path = pathObj.path;
|
|
281
|
-
let ourLatest = authorityStorage.
|
|
281
|
+
let ourLatest = authorityStorage.getValueAtOrBeforeTime(path);
|
|
282
282
|
if (ourLatest?.event) continue;
|
|
283
283
|
originalValues.set(path, ourLatest);
|
|
284
284
|
|
|
@@ -310,7 +310,7 @@ async function auditAuthority(nodeId: string, pathsToAudit: { path: string }[],
|
|
|
310
310
|
|
|
311
311
|
for (let response of responses) {
|
|
312
312
|
let originalValue = originalValues.get(response.path);
|
|
313
|
-
let ourValue = authorityStorage.
|
|
313
|
+
let ourValue = authorityStorage.getValueAtOrBeforeTime(response.path) || createMissingEpochValue(response.path);
|
|
314
314
|
|
|
315
315
|
if (ourValue.event || response.event) continue;
|
|
316
316
|
|
|
@@ -413,7 +413,7 @@ async function auditAuthority(nodeId: string, pathsToAudit: { path: string }[],
|
|
|
413
413
|
|
|
414
414
|
if (pathsToForceSync.size > 0) {
|
|
415
415
|
for (let path of pathsToForceSync) {
|
|
416
|
-
let valueToForce = authorityStorage.
|
|
416
|
+
let valueToForce = authorityStorage.getValueAtOrBeforeTime(path);
|
|
417
417
|
if (valueToForce) {
|
|
418
418
|
let allAuthorities = PathRouter.getAllAuthoritiesForValues([valueToForce]);
|
|
419
419
|
for (let [authorityNodeId, _] of allAuthorities.entries()) {
|
|
@@ -444,7 +444,7 @@ class PathAuditerService {
|
|
|
444
444
|
public async getValidStates(requests: PathTimeRequest[]): Promise<ValidStateResponse[]> {
|
|
445
445
|
let results: ValidStateResponse[] = [];
|
|
446
446
|
for (let request of requests) {
|
|
447
|
-
let value = authorityStorage.
|
|
447
|
+
let value = authorityStorage.getValueAtOrBeforeTime(request.path, request.time);
|
|
448
448
|
results.push({
|
|
449
449
|
path: request.path,
|
|
450
450
|
time: value?.time,
|
|
@@ -459,7 +459,7 @@ class PathAuditerService {
|
|
|
459
459
|
public async getPathValues(requests: PathTimeRequest[]): Promise<PathValue[]> {
|
|
460
460
|
let results: PathValue[] = [];
|
|
461
461
|
for (let request of requests) {
|
|
462
|
-
let value = authorityStorage.
|
|
462
|
+
let value = authorityStorage.getValueAtOrBeforeTime(request.path, request.time);
|
|
463
463
|
if (value) {
|
|
464
464
|
results.push(value);
|
|
465
465
|
}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { formatTime } from "socket-function/src/formatting/format";
|
|
2
|
+
import { lazy } from "socket-function/src/caching";
|
|
3
|
+
import { sort } from "socket-function/src/misc";
|
|
4
|
+
import { SocketFunction } from "socket-function/SocketFunction";
|
|
5
|
+
import { callState, ensureSubscribed } from "./FunctionCallInfoState";
|
|
6
|
+
import { StatDefinition } from "./StatsHeader";
|
|
7
|
+
import { getBrowserUrlNode } from "../-f-node-discovery/NodeDiscovery";
|
|
8
|
+
import { MachineServiceController } from "../deployManager/machineSchema";
|
|
9
|
+
import { QuerysubController } from "../4-querysub/QuerysubController";
|
|
10
|
+
import { getSyncedController } from "../library-components/SyncedController";
|
|
11
|
+
import { qreact } from "../4-dom/qreact";
|
|
12
|
+
import { getStatOverrideSync, statOffenderKey } from "./StatsOverrides";
|
|
13
|
+
|
|
14
|
+
// How often we force the cached debug controller calls (value path count, node specs, launches) to
|
|
15
|
+
// refetch, so the header doesn't show numbers that are hours stale.
|
|
16
|
+
const STALE_REFRESH_INTERVAL = 30 * 60 * 1000;
|
|
17
|
+
const LAUNCH_SINCE_DAYS = 2;
|
|
18
|
+
const DISTINCT_SOURCE_THRESHOLD = 100;
|
|
19
|
+
|
|
20
|
+
function makeDistinctSourceStatsSync(config: {
|
|
21
|
+
category: string;
|
|
22
|
+
label: string;
|
|
23
|
+
distinctEmoji: string;
|
|
24
|
+
aboveThresholdEmoji: string;
|
|
25
|
+
getEntries: () => [string, number][];
|
|
26
|
+
}): StatDefinition[] {
|
|
27
|
+
let formatBreakdown = (title: string, onlyAboveThreshold: boolean) => {
|
|
28
|
+
let entries = config.getEntries();
|
|
29
|
+
if (onlyAboveThreshold) {
|
|
30
|
+
entries = entries.filter(([, count]) => count > DISTINCT_SOURCE_THRESHOLD);
|
|
31
|
+
}
|
|
32
|
+
entries = sort(entries, ([, count]) => -count);
|
|
33
|
+
let counts = entries.map(([, count]) => count).join(" | ");
|
|
34
|
+
let detailed = entries.map(([source, count]) => `${source} (${count})`).join(" | ");
|
|
35
|
+
return <span title={`${title}: ${detailed}`}>{counts}</span>;
|
|
36
|
+
};
|
|
37
|
+
let distinctTitle = `Distinct ${config.label}`;
|
|
38
|
+
let aboveTitle = `Distinct ${config.label} above ${DISTINCT_SOURCE_THRESHOLD}`;
|
|
39
|
+
return [
|
|
40
|
+
{
|
|
41
|
+
category: config.category, title: distinctTitle, emoji: config.distinctEmoji,
|
|
42
|
+
threshold: config.label.includes("function") ? 5 : 10,
|
|
43
|
+
getValue: () => config.getEntries().length,
|
|
44
|
+
formatter: () => formatBreakdown(distinctTitle, false),
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
category: config.category, title: aboveTitle, emoji: config.aboveThresholdEmoji,
|
|
48
|
+
threshold: config.label.includes("function") ? 2 : 3,
|
|
49
|
+
getValue: () => config.getEntries().filter(([, count]) => count > DISTINCT_SOURCE_THRESHOLD).length,
|
|
50
|
+
formatter: () => formatBreakdown(aboveTitle, true),
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const TOP_FUNCTION_BREAKDOWN_COUNT = 3;
|
|
56
|
+
|
|
57
|
+
type PerFunctionStats = ReturnType<typeof callState>["perFunctionStats"][string];
|
|
58
|
+
|
|
59
|
+
function makeCallStatSync(config: {
|
|
60
|
+
perFn: { [id: string]: PerFunctionStats };
|
|
61
|
+
category: string;
|
|
62
|
+
title: string;
|
|
63
|
+
emoji: string;
|
|
64
|
+
threshold: number;
|
|
65
|
+
getFnValue: (fn: PerFunctionStats) => number;
|
|
66
|
+
formatValue?: (value: number) => string;
|
|
67
|
+
}): StatDefinition {
|
|
68
|
+
let formatValue = config.formatValue || ((value: number) => String(value));
|
|
69
|
+
let getFilteredEntries = () => {
|
|
70
|
+
let now = Date.now();
|
|
71
|
+
let entries: { fnId: string; value: number }[] = [];
|
|
72
|
+
for (let fnId of Object.keys(config.perFn)) {
|
|
73
|
+
let value = config.getFnValue(config.perFn[fnId]);
|
|
74
|
+
let override = getStatOverrideSync(statOffenderKey(config.title, fnId));
|
|
75
|
+
let ignoredUntil = override.ignoreUntilMs || 0;
|
|
76
|
+
if (ignoredUntil > now) continue;
|
|
77
|
+
let fnThresholdOverride = override.thresholdOverride || 0;
|
|
78
|
+
if (value < fnThresholdOverride) continue;
|
|
79
|
+
entries.push({ fnId, value });
|
|
80
|
+
}
|
|
81
|
+
return entries;
|
|
82
|
+
};
|
|
83
|
+
let getTopOffenders = () => {
|
|
84
|
+
let above = sort(
|
|
85
|
+
getFilteredEntries().filter(entry => entry.value >= config.threshold),
|
|
86
|
+
entry => -entry.value,
|
|
87
|
+
);
|
|
88
|
+
return above.slice(0, TOP_FUNCTION_BREAKDOWN_COUNT);
|
|
89
|
+
};
|
|
90
|
+
return {
|
|
91
|
+
category: config.category,
|
|
92
|
+
title: config.title,
|
|
93
|
+
emoji: config.emoji,
|
|
94
|
+
threshold: config.threshold,
|
|
95
|
+
getValue: () => {
|
|
96
|
+
let max = 0;
|
|
97
|
+
for (let entry of getFilteredEntries()) {
|
|
98
|
+
if (entry.value > max) {
|
|
99
|
+
max = entry.value;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return max;
|
|
103
|
+
},
|
|
104
|
+
formatter: () => {
|
|
105
|
+
let sorted = sort(getFilteredEntries(), entry => -entry.value);
|
|
106
|
+
let top = sorted.slice(0, TOP_FUNCTION_BREAKDOWN_COUNT);
|
|
107
|
+
let breakdown = top.map(entry => `${entry.fnId} (${formatValue(entry.value)})`).join(" | ");
|
|
108
|
+
let detailed = sorted.map(entry => `${entry.fnId} (${formatValue(entry.value)})`).join(" | ");
|
|
109
|
+
return <span title={`${config.title}: ${detailed}`}>{breakdown}</span>;
|
|
110
|
+
},
|
|
111
|
+
getOffenders: () => getTopOffenders().map(entry => ({ id: entry.fnId, value: entry.value })),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (!QuerysubController) {
|
|
116
|
+
require("debugbreak")(2);
|
|
117
|
+
debugger;
|
|
118
|
+
}
|
|
119
|
+
let querysubController = getSyncedController(QuerysubController);
|
|
120
|
+
|
|
121
|
+
let ensureRefreshInterval = lazy(() => {
|
|
122
|
+
setInterval(() => {
|
|
123
|
+
let nodeId = SocketFunction.browserNodeId();
|
|
124
|
+
querysubController(nodeId).debugGetValuePathCount.refresh();
|
|
125
|
+
querysubController(nodeId).debugGetDetailedSyncing.refresh();
|
|
126
|
+
MachineServiceController(getBrowserUrlNode()).getRecentLaunches.refresh(LAUNCH_SINCE_DAYS);
|
|
127
|
+
}, STALE_REFRESH_INTERVAL);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
export function getQuerysubStatsSync(): StatDefinition[] {
|
|
131
|
+
ensureSubscribed();
|
|
132
|
+
ensureRefreshInterval();
|
|
133
|
+
let state = callState();
|
|
134
|
+
|
|
135
|
+
let perFn = state.perFunctionStats;
|
|
136
|
+
let avgFn = (s: { count: number; sum: number }) => s.count && s.sum / s.count || 0;
|
|
137
|
+
|
|
138
|
+
let callStatDefs: StatDefinition[] = [
|
|
139
|
+
makeCallStatSync({
|
|
140
|
+
perFn, category: "Calls", title: "Committed synced calls", emoji: "⚡",
|
|
141
|
+
threshold: 50_000,
|
|
142
|
+
getFnValue: fn => fn.totalCalls,
|
|
143
|
+
}),
|
|
144
|
+
makeCallStatSync({
|
|
145
|
+
perFn, category: "Calls", title: "Rejected reruns", emoji: "⚠️",
|
|
146
|
+
threshold: 10,
|
|
147
|
+
getFnValue: fn => fn.totalFullReruns,
|
|
148
|
+
}),
|
|
149
|
+
makeCallStatSync({
|
|
150
|
+
perFn, category: "Calls", title: "Rerun to sync data", emoji: "♻️",
|
|
151
|
+
threshold: 10,
|
|
152
|
+
getFnValue: fn => fn.totalInternalReruns,
|
|
153
|
+
}),
|
|
154
|
+
makeCallStatSync({
|
|
155
|
+
perFn, category: "Calls", title: "Calls with multiple resyncs", emoji: "🔦",
|
|
156
|
+
threshold: 10,
|
|
157
|
+
getFnValue: fn => fn.callsWithMultipleInternalRuns,
|
|
158
|
+
}),
|
|
159
|
+
makeCallStatSync({
|
|
160
|
+
perFn, category: "Calls", title: "Calls with multiple rejections", emoji: "📈",
|
|
161
|
+
threshold: 10,
|
|
162
|
+
getFnValue: fn => fn.callsWithCascadingRuns,
|
|
163
|
+
}),
|
|
164
|
+
];
|
|
165
|
+
|
|
166
|
+
let timingStatDefs: StatDefinition[] = [
|
|
167
|
+
makeCallStatSync({
|
|
168
|
+
perFn, category: "Timing", title: "Average evaluation time", emoji: "💫",
|
|
169
|
+
threshold: 100,
|
|
170
|
+
getFnValue: fn => avgFn(fn.evalTimeStats),
|
|
171
|
+
formatValue: formatTime,
|
|
172
|
+
}),
|
|
173
|
+
makeCallStatSync({
|
|
174
|
+
perFn, category: "Timing", title: "Average full time (sync, etc)", emoji: "🕒",
|
|
175
|
+
threshold: 1000,
|
|
176
|
+
getFnValue: fn => avgFn(fn.totalTimeStats),
|
|
177
|
+
formatValue: formatTime,
|
|
178
|
+
}),
|
|
179
|
+
];
|
|
180
|
+
|
|
181
|
+
let callServerStats = makeDistinctSourceStatsSync({
|
|
182
|
+
category: "Servers",
|
|
183
|
+
label: "function call servers",
|
|
184
|
+
distinctEmoji: "⚡",
|
|
185
|
+
aboveThresholdEmoji: "⚡",
|
|
186
|
+
getEntries: () => Object.entries(state.callsByServer),
|
|
187
|
+
});
|
|
188
|
+
let valuePathServerStats = makeDistinctSourceStatsSync({
|
|
189
|
+
category: "Servers",
|
|
190
|
+
label: "value path servers",
|
|
191
|
+
distinctEmoji: "🗄️",
|
|
192
|
+
aboveThresholdEmoji: "🗄️",
|
|
193
|
+
getEntries: () => Array.from(querysubController(SocketFunction.browserNodeId()).debugGetDetailedSyncing()?.entries() ?? []),
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
let stats: StatDefinition[] = [
|
|
197
|
+
...callStatDefs,
|
|
198
|
+
...valuePathServerStats,
|
|
199
|
+
...callServerStats,
|
|
200
|
+
...timingStatDefs,
|
|
201
|
+
{
|
|
202
|
+
category: "Sync Footprint", title: "Remote watched paths", emoji: "🔥",
|
|
203
|
+
threshold: 1000,
|
|
204
|
+
dietThreshold: 200,
|
|
205
|
+
getValue: () => (state.remotePathCount),
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
category: "Sync Footprint", title: "Local watched paths", emoji: "🏠",
|
|
209
|
+
threshold: 5000,
|
|
210
|
+
dietThreshold: 500,
|
|
211
|
+
getValue: () => (state.localPathCount),
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
category: "Sync Footprint", title: "Total values in memory", emoji: "📦",
|
|
215
|
+
threshold: 25000,
|
|
216
|
+
getValue: () => (state.totalValueCount),
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
category: "Sync Footprint", title: "Active watchers", emoji: "🕵🏻♀️",
|
|
220
|
+
threshold: 1000,
|
|
221
|
+
dietThreshold: 100,
|
|
222
|
+
getValue: () => (state.proxyWatcherCount),
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
category: "Sync Footprint", title: "Stored value paths on node", emoji: "📄",
|
|
226
|
+
threshold: 1_000_000,
|
|
227
|
+
getValue: () => querysubController(SocketFunction.browserNodeId()).debugGetValuePathCount() || 0,
|
|
228
|
+
},
|
|
229
|
+
];
|
|
230
|
+
|
|
231
|
+
let summaries = MachineServiceController(getBrowserUrlNode()).getRecentLaunches(LAUNCH_SINCE_DAYS);
|
|
232
|
+
let crashes = 0;
|
|
233
|
+
let updates = 0;
|
|
234
|
+
for (let summary of summaries || []) {
|
|
235
|
+
if (summary.reason === "crashed") {
|
|
236
|
+
crashes++;
|
|
237
|
+
} else {
|
|
238
|
+
updates++;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
stats.push({
|
|
242
|
+
category: "Launches", title: `Crashes (last ${LAUNCH_SINCE_DAYS} days)`, emoji: "🚀",
|
|
243
|
+
getValue: () => crashes,
|
|
244
|
+
threshold: 1,
|
|
245
|
+
});
|
|
246
|
+
stats.push({
|
|
247
|
+
category: "Launches", title: `Updates (last ${LAUNCH_SINCE_DAYS} days)`, emoji: "🔄",
|
|
248
|
+
getValue: () => updates,
|
|
249
|
+
threshold: 100,
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
return stats;
|
|
253
|
+
}
|
|
@@ -6,7 +6,7 @@ import { cache, lazy } from "socket-function/src/caching";
|
|
|
6
6
|
import { proxyWatcher, SyncWatcher } from "../2-proxy/PathValueProxyWatcher";
|
|
7
7
|
import { qreact } from "../4-dom/qreact";
|
|
8
8
|
import { onNextPaint } from "./onNextPaint";
|
|
9
|
-
import { Querysub } from "../4-querysub/
|
|
9
|
+
import { Querysub } from "../4-querysub/Querysub";
|
|
10
10
|
|
|
11
11
|
let disabled = false;
|
|
12
12
|
export function setThrottleRenderDisabled(value: boolean) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import preact from "preact";
|
|
2
2
|
import { isNode, list, nextId } from "socket-function/src/misc";
|
|
3
3
|
import { css } from "typesafecss";
|
|
4
|
-
import { Querysub } from "../4-querysub/
|
|
4
|
+
import { Querysub } from "../4-querysub/Querysub";
|
|
5
5
|
import { qreact } from "../4-dom/qreact";
|
|
6
6
|
import { isShowingModal } from "../5-diagnostics/Modal";
|
|
7
7
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import preact from "preact"; import { qreact } from "../../src/4-dom/qreact";
|
|
2
|
-
import { Querysub } from "../../src/4-querysub/
|
|
2
|
+
import { Querysub } from "../../src/4-querysub/Querysub";
|
|
3
3
|
import { css } from "../../src/4-dom/css";
|
|
4
4
|
import { Button } from "../../src/library-components/Button";
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import preact from "preact"; import { qreact } from "../../src/4-dom/qreact";
|
|
2
2
|
|
|
3
|
-
import { Querysub } from "../../src/4-querysub/
|
|
3
|
+
import { Querysub } from "../../src/4-querysub/Querysub";
|
|
4
4
|
import { Icon } from "../../src/library-components/icons";
|
|
5
5
|
import { css } from "../../src/4-dom/css";
|
|
6
6
|
import { LengthOrPercentage } from "../../src/4-dom/cssTypes";
|
|
@@ -8,7 +8,7 @@ import { atomic, atomicObjectSymbol, atomicObjectWrite } from "../2-proxy/PathVa
|
|
|
8
8
|
import { getProxyPath } from "../2-proxy/pathValueProxy";
|
|
9
9
|
import { authorityStorage } from "../0-path-value-core/pathValueCore";
|
|
10
10
|
import { addEpsilons } from "../bits";
|
|
11
|
-
import { Querysub } from "../4-querysub/
|
|
11
|
+
import { Querysub } from "../4-querysub/Querysub";
|
|
12
12
|
import { MeasuredDiv } from "../library-components/MeasuredDiv";
|
|
13
13
|
|
|
14
14
|
export type ColumnDesc = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import preact from "preact";
|
|
2
|
-
import { Querysub } from "../4-querysub/
|
|
2
|
+
import { Querysub } from "../4-querysub/Querysub";
|
|
3
3
|
import { qreact } from "../4-dom/qreact";
|
|
4
4
|
import { Button } from "../library-components/Button";
|
|
5
5
|
import { Icon } from "../library-components/icons";
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import debugbreak from "debugbreak";
|
|
2
2
|
import { cache, lazy } from "socket-function/src/caching";
|
|
3
3
|
import { isNode, sort } from "socket-function/src/misc";
|
|
4
|
-
import { Querysub } from "../4-querysub/
|
|
4
|
+
import { Querysub } from "../4-querysub/Querysub";
|
|
5
5
|
import { qreact } from "../4-dom/qreact";
|
|
6
6
|
import { registerImportBlockers } from "../3-path-functions/pathFunctionLoader";
|
|
7
7
|
|
|
8
8
|
let nextSeqNum = 0;
|
|
9
|
+
if (!Querysub) {
|
|
10
|
+
require("debugbreak")(2);
|
|
11
|
+
debugger;
|
|
12
|
+
}
|
|
9
13
|
let schema = Querysub.createLocalSchema<{
|
|
10
14
|
loaded: { [seqNum: number]: true };
|
|
11
15
|
}>("LazyComponent");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css } from "../4-dom/css";
|
|
2
2
|
import { qreact } from "../4-dom/qreact";
|
|
3
|
-
import { Querysub } from "../4-querysub/
|
|
3
|
+
import { Querysub } from "../4-querysub/Querysub";
|
|
4
4
|
/** MOST of the time ScrollOnMount will work. But sometimes it won't, in which case this case work IF the holder size is fixed.
|
|
5
5
|
* - This also works well with cases where your content starts small, as this forces you to always have overflow, and also a bit of buffer at the bottom.
|
|
6
6
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { qreact } from "../4-dom/qreact";
|
|
2
2
|
import { t } from "../2-proxy/schema2";
|
|
3
3
|
import { css } from "typesafecss";
|
|
4
|
-
import { Querysub } from "../4-querysub/
|
|
4
|
+
import { Querysub } from "../4-querysub/Querysub";
|
|
5
5
|
|
|
6
6
|
// Type declarations for Monaco editor
|
|
7
7
|
declare global {
|
|
@@ -4,14 +4,13 @@ import { deepCloneJSON, throttleFunction, timeInMinute } from "socket-function/s
|
|
|
4
4
|
import { isNode } from "typesafecss";
|
|
5
5
|
import { atomicObjectRead, doAtomicWrites, noAtomicSchema, proxyWatcher } from "../2-proxy/PathValueProxyWatcher";
|
|
6
6
|
import { syncSchema } from "../3-path-functions/syncSchema";
|
|
7
|
-
import { Querysub } from "../4-querysub/
|
|
7
|
+
import { Querysub } from "../4-querysub/Querysub";
|
|
8
8
|
import { isDefined } from "../misc";
|
|
9
9
|
import { deserializeURLParam, serializeURLParam } from "./niceStringify";
|
|
10
10
|
import { logErrors } from "../errors";
|
|
11
11
|
import { canHaveChildren } from "socket-function/src/types";
|
|
12
12
|
import { URLOverride } from "./ATag";
|
|
13
|
-
import {
|
|
14
|
-
import { LOCAL_DOMAIN } from "../0-path-value-core/PathRouter";
|
|
13
|
+
import { LOCAL_DOMAIN } from "../0-path-value-core/PathRouterConstants";
|
|
15
14
|
|
|
16
15
|
export interface URLParam<T = unknown> {
|
|
17
16
|
value: T;
|
|
@@ -85,7 +84,8 @@ export function createURLSync<T>(urlKey: string, defaultValue: T, config?: URLPa
|
|
|
85
84
|
if (config?.storage === "localStorage") {
|
|
86
85
|
localStorageKeys.add(urlKey);
|
|
87
86
|
}
|
|
88
|
-
function setDefaults() {
|
|
87
|
+
async function setDefaults() {
|
|
88
|
+
let { Querysub } = await import("../4-querysub/Querysub");
|
|
89
89
|
Querysub.localCommit(() => {
|
|
90
90
|
data().defaults[urlKey] = defaultValue;
|
|
91
91
|
if (!(urlKey in loadSearchCache)) {
|
|
@@ -93,11 +93,7 @@ export function createURLSync<T>(urlKey: string, defaultValue: T, config?: URLPa
|
|
|
93
93
|
}
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
|
-
|
|
97
|
-
setImmediate(setDefaults);
|
|
98
|
-
} else {
|
|
99
|
-
setDefaults();
|
|
100
|
-
}
|
|
96
|
+
setTimeout(setDefaults);
|
|
101
97
|
function deleteKeys(obj: any) {
|
|
102
98
|
if (!canHaveChildren(obj)) return;
|
|
103
99
|
for (let key in obj) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { nextId, throttleFunction } from "socket-function/src/misc";
|
|
2
|
-
import { Querysub } from "../4-querysub/
|
|
2
|
+
import { Querysub } from "../4-querysub/Querysub";
|
|
3
3
|
import { throttleFunctionFast } from "../functional/onNextPaint";
|
|
4
4
|
|
|
5
5
|
export let dragCount = 0;
|
package/src/misc/formatJSX.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { qreact } from "../4-dom/qreact";
|
|
2
2
|
import { formatTime, formatVeryNiceDateTime } from "socket-function/src/formatting/format";
|
|
3
|
-
import { Querysub } from "../4-querysub/
|
|
3
|
+
import { Querysub } from "../4-querysub/Querysub";
|
|
4
4
|
|
|
5
5
|
export function formatDateJSX(time: number) {
|
|
6
6
|
let diff = time - Querysub.nowDelayed(10 * 1000);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { atomic, atomicObjectWrite } from "../2-proxy/PathValueProxyWatcher";
|
|
2
|
-
import { Querysub } from "../4-querysub/
|
|
2
|
+
import { Querysub } from "../4-querysub/Querysub";
|
|
3
3
|
import { red } from "socket-function/src/formatting/logColors";
|
|
4
4
|
import { isNode, sha256Hash, timeInHour } from "socket-function/src/misc";
|
|
5
5
|
import { registerAliveChecker } from "../2-proxy/garbageCollection";
|
package/test2.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { timeInSecond } from "socket-function/src/misc";
|
|
|
7
7
|
import { getErrorLogs, getLoggers2Async } from "./src/diagnostics/logs/diskLogger";
|
|
8
8
|
import { watchAllValues } from "./src/diagnostics/logs/errorNotifications2/logWatcher";
|
|
9
9
|
import { delay } from "socket-function/src/batching";
|
|
10
|
-
import { Querysub } from "./src/4-querysub/
|
|
10
|
+
import { Querysub } from "./src/4-querysub/Querysub";
|
|
11
11
|
|
|
12
12
|
async function main() {
|
|
13
13
|
await Querysub.hostService("test");
|
package/testEntry2.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { getOwnMachineId } from "./src/-a-auth/certs";
|
|
|
3
3
|
import { getOwnThreadId } from "./src/-f-node-discovery/NodeDiscovery";
|
|
4
4
|
import { shutdown } from "./src/diagnostics/periodic";
|
|
5
5
|
import { testTCPIsListening } from "socket-function/src/networking";
|
|
6
|
-
import { Querysub } from "./src/4-querysub/
|
|
6
|
+
import { Querysub } from "./src/4-querysub/Querysub";
|
|
7
7
|
import { timeInSecond } from "socket-function/src/misc";
|
|
8
8
|
import { waitForFirstTimeSync } from "socket-function/time/trueTimeShim";
|
|
9
9
|
|