querysub 0.374.0 → 0.375.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 -4
- package/src/deployManager/components/MachineDetailPage.tsx +2 -5
- package/src/deployManager/components/ServiceDetailPage.tsx +2 -5
- package/src/deployManager/machineApplyMainCode.ts +7 -0
- package/src/diagnostics/NodeViewer.tsx +4 -5
- package/src/diagnostics/logs/IndexedLogs/BufferIndexHelpers.ts +1 -1
- package/src/diagnostics/logs/IndexedLogs/IndexedLogs.ts +7 -7
- package/src/diagnostics/logs/IndexedLogs/LogViewer3.tsx +221 -220
- package/src/diagnostics/logs/IndexedLogs/LogViewerParams.ts +21 -0
- package/src/diagnostics/logs/IndexedLogs/bufferMatcher.ts +3 -3
- package/src/diagnostics/logs/diskLogger.ts +0 -38
- package/src/diagnostics/logs/errorNotifications2/errorNotifications2.ts +3 -0
- package/src/diagnostics/logs/injectFileLocationToConsole.ts +3 -0
- package/src/diagnostics/logs/lifeCycleAnalysis/lifeCycles.tsx +32 -22
- package/src/diagnostics/managementPages.tsx +0 -18
- package/test.ts +0 -5
- package/bin/error-email.js +0 -8
- package/bin/error-im.js +0 -8
- package/src/diagnostics/logs/FastArchiveAppendable.ts +0 -843
- package/src/diagnostics/logs/FastArchiveController.ts +0 -573
- package/src/diagnostics/logs/FastArchiveViewer.tsx +0 -1090
- package/src/diagnostics/logs/LogViewer2.tsx +0 -552
- package/src/diagnostics/logs/errorNotifications/ErrorDigestPage.tsx +0 -409
- package/src/diagnostics/logs/errorNotifications/ErrorNotificationController.ts +0 -756
- package/src/diagnostics/logs/errorNotifications/ErrorSuppressionUI.tsx +0 -280
- package/src/diagnostics/logs/errorNotifications/ErrorWarning.tsx +0 -254
- package/src/diagnostics/logs/errorNotifications/errorDigestEmail.tsx +0 -233
- package/src/diagnostics/logs/errorNotifications/errorDigestEntry.tsx +0 -14
- package/src/diagnostics/logs/errorNotifications/errorDigests.tsx +0 -292
- package/src/diagnostics/logs/errorNotifications/errorWatchEntry.tsx +0 -209
- package/src/diagnostics/logs/importLogsEntry.ts +0 -38
- package/src/diagnostics/logs/lifeCycleAnalysis/LifeCyclePages.tsx +0 -150
- package/src/diagnostics/logs/logViewerExtractField.ts +0 -36
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { URLParam } from "../../../library-components/URLParam";
|
|
2
|
+
import { managementPageURL } from "../../managementPages";
|
|
3
|
+
import { LogDatum } from "../diskLogger";
|
|
4
|
+
|
|
5
|
+
export let searchTextURL = new URLParam("searchText", "");
|
|
6
|
+
export let readProductionLogsURL = new URLParam("readProductionLogs", false);
|
|
7
|
+
|
|
8
|
+
export function formatSearchString(obj: Record<string, unknown>): string {
|
|
9
|
+
return Object.entries(obj).map(([key, value]) => {
|
|
10
|
+
return `${JSON.stringify(key)}:${JSON.stringify(value)}`;
|
|
11
|
+
}).join("&");
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function getLogViewerParams(logObj: Partial<LogDatum>) {
|
|
15
|
+
return [
|
|
16
|
+
managementPageURL.getOverride("LogViewer3"),
|
|
17
|
+
searchTextURL.getOverride(formatSearchString(logObj)),
|
|
18
|
+
// If we're linking to the logs, it's almost certainly for production logs.
|
|
19
|
+
readProductionLogsURL.getOverride(true),
|
|
20
|
+
];
|
|
21
|
+
}
|
|
@@ -26,7 +26,7 @@ export type MatchStructure = {
|
|
|
26
26
|
function parseMatchStructure(pattern: Buffer): MatchStructure {
|
|
27
27
|
let text = pattern.toString("utf-8");
|
|
28
28
|
|
|
29
|
-
let orParts = text.split(SEARCH_OR_CHAR);
|
|
29
|
+
let orParts = text.split(SEARCH_OR_CHAR).map(x => x.trim()).filter(x => x.length > 0);
|
|
30
30
|
if (orParts.length > 1) {
|
|
31
31
|
return {
|
|
32
32
|
type: "or",
|
|
@@ -34,7 +34,7 @@ function parseMatchStructure(pattern: Buffer): MatchStructure {
|
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
let andParts = text.split(SEARCH_AND_CHAR);
|
|
37
|
+
let andParts = text.split(SEARCH_AND_CHAR).map(x => x.trim()).filter(x => x.length > 0);
|
|
38
38
|
if (andParts.length > 1) {
|
|
39
39
|
return {
|
|
40
40
|
type: "and",
|
|
@@ -42,7 +42,7 @@ function parseMatchStructure(pattern: Buffer): MatchStructure {
|
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
let wildcardParts = text.split(WILD_CARD_CHAR).filter(
|
|
45
|
+
let wildcardParts = text.split(WILD_CARD_CHAR).map(x => x.trim()).filter(x => x.length > 0);
|
|
46
46
|
if (wildcardParts.length > 1) {
|
|
47
47
|
return {
|
|
48
48
|
type: "wildcard",
|
|
@@ -5,7 +5,6 @@ import { lazy } from "socket-function/src/caching";
|
|
|
5
5
|
import { timeInMinute } from "socket-function/src/misc";
|
|
6
6
|
import { formatTime } from "socket-function/src/formatting/format";
|
|
7
7
|
import { addEpsilons } from "../../bits";
|
|
8
|
-
import { FileMetadata } from "./FastArchiveController";
|
|
9
8
|
import { getPathStr2 } from "../../path";
|
|
10
9
|
import { isPublic } from "../../config";
|
|
11
10
|
// IMPORTANT! We can't have any real imports here, because we are depended on so early in startup!
|
|
@@ -32,8 +31,6 @@ export type LogDatum = Record<string, unknown> & {
|
|
|
32
31
|
__DIR__?: string;
|
|
33
32
|
__NAME__?: string;
|
|
34
33
|
__LINE__?: string;
|
|
35
|
-
/** Dynamically set at runtime in the frontend. */
|
|
36
|
-
__metadata?: FileMetadata;
|
|
37
34
|
/** Dynamically set when matching recent errors only. */
|
|
38
35
|
__matchedOutdatedSuppressionKey?: string;
|
|
39
36
|
};
|
|
@@ -68,36 +65,6 @@ export const LOG_LINE_LIMIT_FLAG = String.fromCharCode(44534) + "LOGS_LINE_LIMIT
|
|
|
68
65
|
/** If this key exists in the logged object, as in a key in one of the objects logged, then we will use the value of it as the limit ID. This is useful as it allows us to either override a limit or limit something independently from other logs in the file. */
|
|
69
66
|
export const LOG_LINE_LIMIT_ID = "LIMIT_LINE_ID";
|
|
70
67
|
|
|
71
|
-
export const getLoggers = lazy(function () {
|
|
72
|
-
const { FastArchiveAppendable } = require("./FastArchiveAppendable") as typeof import("./FastArchiveAppendable");
|
|
73
|
-
if (!FastArchiveAppendable) {
|
|
74
|
-
setImmediate(() => {
|
|
75
|
-
getLoggers.reset();
|
|
76
|
-
});
|
|
77
|
-
return undefined;
|
|
78
|
-
}
|
|
79
|
-
return {
|
|
80
|
-
logLogs: new FastArchiveAppendable<LogDatum>("logs-log/"),
|
|
81
|
-
warnLogs: new FastArchiveAppendable<LogDatum>("logs-warn/"),
|
|
82
|
-
infoLogs: new FastArchiveAppendable<LogDatum>("logs-info/"),
|
|
83
|
-
errorLogs: new FastArchiveAppendable<LogDatum>("logs-error/"),
|
|
84
|
-
};
|
|
85
|
-
});
|
|
86
|
-
setImmediate(() => {
|
|
87
|
-
// If we don't import it at all, then it doesn't work client-side.
|
|
88
|
-
require("./FastArchiveAppendable") as typeof import("./FastArchiveAppendable");
|
|
89
|
-
});
|
|
90
|
-
const getNotifyErrors = lazy(function () {
|
|
91
|
-
const { notifyWatchersOfError: notifyErrors } = require("./errorNotifications/ErrorNotificationController") as typeof import("./errorNotifications/ErrorNotificationController");
|
|
92
|
-
if (typeof notifyErrors !== "function") {
|
|
93
|
-
setImmediate(() => {
|
|
94
|
-
getNotifyErrors.reset();
|
|
95
|
-
});
|
|
96
|
-
return undefined;
|
|
97
|
-
}
|
|
98
|
-
return notifyErrors;
|
|
99
|
-
});
|
|
100
|
-
|
|
101
68
|
export const getLoggers2 = lazy(function () {
|
|
102
69
|
const { IndexedLogs } = require("./IndexedLogs/IndexedLogs") as typeof import("./IndexedLogs/IndexedLogs");
|
|
103
70
|
|
|
@@ -189,11 +156,6 @@ export function logDisk(type: "log" | "warn" | "info" | "error", ...args: unknow
|
|
|
189
156
|
}
|
|
190
157
|
}
|
|
191
158
|
|
|
192
|
-
if (type === "warn" || type === "error") {
|
|
193
|
-
// Dropping notifies is fine, as long as they get added to the logs, we'll see them eventually...
|
|
194
|
-
void getNotifyErrors()?.(logObj);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
159
|
} catch (e: any) {
|
|
198
160
|
process.stdout.write(`Error writing to disk logs: ${e.stack || e}\n\t${String(args[0])}\n`);
|
|
199
161
|
}
|
|
@@ -41,4 +41,7 @@ if (isNode()) {
|
|
|
41
41
|
|
|
42
42
|
let diskShimConsoleLogs = require("./diskShimConsoleLogs") as typeof import("./diskShimConsoleLogs");
|
|
43
43
|
diskShimConsoleLogs.shimConsoleLogs();
|
|
44
|
+
} else {
|
|
45
|
+
// NOTE: Disable console.info, as serverside we use it for disk only logs
|
|
46
|
+
console.info = () => { };
|
|
44
47
|
}
|
|
@@ -20,16 +20,11 @@ IMPORTANT! Now I am properly calling shutdown, so none of the streamed logs shou
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
3) Ensure our moveloops are working correctly, on both dev and public
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
1) Fix missing __NAME__
|
|
27
|
-
"Received PathValue for path" misses name?
|
|
28
|
-
- Maybe the missing name only happens when we rate limit?
|
|
29
23
|
|
|
30
24
|
2) Create lot of remote server logs
|
|
31
25
|
- Via our refresh loop
|
|
32
26
|
|
|
27
|
+
|
|
33
28
|
3) Verify search is still fast, and works correctly!
|
|
34
29
|
- Try to get a rare value in that is in the logs, but is hard to find
|
|
35
30
|
Good rare search. Checks for sending emails, which we do very rarely. If we pack in 10GB of logs after this, it will really stress our indexing system.
|
|
@@ -37,25 +32,27 @@ IMPORTANT! Now I am properly calling shutdown, so none of the streamed logs shou
|
|
|
37
32
|
https://127-0-0-1.querysubtest.com:7007/?hot&readPublicLogs&showingmanagement&machineview=services&managementpage=LogViewer3&searchText=Sending%20email&selectedFields=%7B%22path%22%3Atrue%7D
|
|
38
33
|
|
|
39
34
|
|
|
35
|
+
|
|
36
|
+
Remove old error digest/notification code
|
|
37
|
+
- We don't need email digests anymore. I think discord messaging is enough
|
|
38
|
+
Remove all old LogViewer/FastArchiveAppendable code
|
|
39
|
+
- Make sure to find all links and update them as well
|
|
40
40
|
|
|
41
|
-
Rewrite error notification code
|
|
42
|
-
THINK about how to do a somewhat generic logs => derived thing, as... we will need the exact same thing for life cycles!
|
|
43
|
-
- Maybe make it generic immediately? Having it abstracted it kind of nice for development anyways...
|
|
44
|
-
- New service that manages it, instead of doing it on demand
|
|
45
|
-
- It asks everyone to send it error logs
|
|
46
|
-
- Stores cached error logs => { unsuppressed logs, suppressionSummary }
|
|
47
|
-
- Unsuppressed logs only for suppression which is old enough.
|
|
48
|
-
- Only when logs are old enough.
|
|
49
|
-
- Stores in memory with all suppressionSummaries
|
|
50
|
-
AND, the only watcher will be the watcher service. You can't get recent errors, or any errors, without going through one of those
|
|
51
|
-
NO dev errors. They are usually red-herrings anyways... and we should just be using public servers for regular usage
|
|
52
|
-
- And we still have dev logs we can check if to see if an error happened locally
|
|
53
|
-
ALSO owns the discord messaging code
|
|
54
41
|
|
|
55
42
|
|
|
43
|
+
Rewrite error notification code
|
|
44
|
+
- Single service, which talks to all machines
|
|
45
|
+
- We'll have a dev mode, mostly for testing, although we won't usually run it.
|
|
46
|
+
- BROADCASTS messages to all http servers so they show them
|
|
47
|
+
- Broadcast messages only has one type now "error notification", but add TODO for more types, which may display in different ways (via toast, etc)
|
|
48
|
+
- Maybe only streaming? We'll miss some, but... not that much...
|
|
49
|
+
- ALSO owns the discord messaging code
|
|
50
|
+
- Suppression... will work in the service itself. Because there shouldn't be THAT many errors happening!
|
|
51
|
+
- Suppression will use AI to group?
|
|
52
|
+
- BUT, we will still have page that shows suppression list, with counts and times
|
|
53
|
+
- Page links to search, which tries to find those errors (we should use the same format for suppression as search, so it should be fairly easy to do that)
|
|
54
|
+
|
|
56
55
|
|
|
57
|
-
Remove all old LogViewer/FastArchiveAppendable code
|
|
58
|
-
- Make sure to find all links and update them as well
|
|
59
56
|
|
|
60
57
|
|
|
61
58
|
0) Add LZ4 compression to socket-function by default
|
|
@@ -63,12 +60,25 @@ Remove all old LogViewer/FastArchiveAppendable code
|
|
|
63
60
|
- default is "lz4"
|
|
64
61
|
- REQUIRES feature checking the remote, to make sure it is new enough to accept this.
|
|
65
62
|
- A generic thing which gets the version is probably fine.
|
|
63
|
+
- When decoding, I think we should just check the first byte. It should be a magic number which tells us which compression it's using.
|
|
66
64
|
- LZ4 compression is fast enough that this should cause basically no overhead, and in many cases greatly reduce the bandwidth (which will increase the speed).
|
|
67
65
|
- We're gonna have to investigate how we're sending buffers anyway. I think this should be easy, but we
|
|
68
|
-
0.1) Verify the size
|
|
66
|
+
0.1) Verify the size difference with some local testing
|
|
69
67
|
- ALSO, verify the processing overhead is acceptable.
|
|
70
68
|
1) Deploy, which SHOULD be backwards compatible with everything?
|
|
71
69
|
|
|
70
|
+
|
|
71
|
+
-1) Change PathValueSerialize to use LZ4
|
|
72
|
+
- I think we already have a compression flag here, so it should be easy enough to just support it to change it to support LZ4.
|
|
73
|
+
- I think we want to disable the server, and then when we launch the server locally, it should have to read from disk.
|
|
74
|
+
-2) It would probably be valuable to test the synchronization speed between two different servers. It seems like when the remote is running and we start a local server, it really takes a long time for it to get ready. As in minutes.
|
|
75
|
+
- This might have already been fixed by us improving the compression speed to not use gzip, maybe, but we should test it again, and if not, we should see what's slow
|
|
76
|
+
- We might need to jump into the server and look at its profiles there by forcing them to omit, which isn't too hard, but it is kind of annoying.
|
|
77
|
+
|
|
78
|
+
-3) During server startup (when there is a remote server), we spend a lot of time in identityHook.
|
|
79
|
+
- BUT... Our check to see if the async call that we're doing underneath is taking more than 200 milliseconds, is never firing. Even though apparently plenty of calls are taking over a second in total, so what why is it slow? Are some of the synchronous functions we're calling slow?
|
|
80
|
+
- Basically, there's nowhere that could be slow, and we're timing it, and it times as being fast. However, in the profiles, it shows up as being slow.
|
|
81
|
+
- It could also be an asynchronous issue, so some other timing is getting alias to it. That is feasible...
|
|
72
82
|
*/
|
|
73
83
|
|
|
74
84
|
|
|
@@ -28,8 +28,6 @@ import { addComponentButton } from "../5-diagnostics/qreactDebug";
|
|
|
28
28
|
import { closeAllModals } from "../5-diagnostics/Modal";
|
|
29
29
|
import { delay } from "socket-function/src/batching";
|
|
30
30
|
|
|
31
|
-
const ErrorWarning = createLazyComponent(() => import("./logs/errorNotifications/ErrorWarning"))("ErrorWarning");
|
|
32
|
-
|
|
33
31
|
export const managementPageURL = new URLParam("managementpage", "");
|
|
34
32
|
export const showingManagementURL = new URLParam("showingmanagement", false);
|
|
35
33
|
|
|
@@ -86,26 +84,11 @@ export async function registerManagementPages2(config: {
|
|
|
86
84
|
controllerName: "NodeViewerController",
|
|
87
85
|
getModule: () => import("./NodeViewer"),
|
|
88
86
|
});
|
|
89
|
-
inputPages.push({
|
|
90
|
-
title: "Logs",
|
|
91
|
-
componentName: "LogViewer2",
|
|
92
|
-
getModule: () => import("./logs/LogViewer2"),
|
|
93
|
-
});
|
|
94
87
|
inputPages.push({
|
|
95
88
|
title: "Logs3",
|
|
96
89
|
componentName: "LogViewer3",
|
|
97
90
|
getModule: () => import("./logs/IndexedLogs/LogViewer3"),
|
|
98
91
|
});
|
|
99
|
-
inputPages.push({
|
|
100
|
-
title: "Life Cycles",
|
|
101
|
-
componentName: "LifeCyclePages",
|
|
102
|
-
getModule: () => import("./logs/lifeCycleAnalysis/LifeCyclePages"),
|
|
103
|
-
});
|
|
104
|
-
inputPages.push({
|
|
105
|
-
title: "Error Digests",
|
|
106
|
-
componentName: "ErrorDigestPage",
|
|
107
|
-
getModule: () => import("./logs/errorNotifications/ErrorDigestPage"),
|
|
108
|
-
});
|
|
109
92
|
inputPages.push({
|
|
110
93
|
title: "Security",
|
|
111
94
|
componentName: "SecurityPage",
|
|
@@ -339,7 +322,6 @@ class ManagementRoot extends qreact.Component {
|
|
|
339
322
|
`}
|
|
340
323
|
</style>
|
|
341
324
|
<div class={css.fillWidth.hbox(30, 10).wrap.hsl(245, 25, 60).pad2(10).pointerEvents("all")}>
|
|
342
|
-
<ErrorWarning />
|
|
343
325
|
{pages.map(page =>
|
|
344
326
|
<ATag values={[{ param: managementPageURL, value: page.componentName }]}>{page.title}</ATag>
|
|
345
327
|
)}
|
package/test.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { Querysub } from "./src/4-querysub/QuerysubController";
|
|
2
2
|
// Import querysub, so inject is run
|
|
3
3
|
Querysub;
|
|
4
|
-
import { formatTime } from "socket-function/src/formatting/format";
|
|
5
|
-
import { getMachineId, getOwnMachineId } from "./src/-a-auth/certs";
|
|
6
|
-
import { testLogs } from "./src/diagnostics/logs/LogViewer2";
|
|
7
|
-
import { shutdown } from "./src/diagnostics/periodic";
|
|
8
|
-
import crypto from "crypto";
|
|
9
4
|
import { testMain } from "./testEntry2";
|
|
10
5
|
|
|
11
6
|
testMain().catch(console.error).finally(() => {
|
package/bin/error-email.js
DELETED
package/bin/error-im.js
DELETED