querysub 0.372.0 → 0.373.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
CHANGED
|
@@ -25,6 +25,15 @@ export type FilePathsByMachine = {
|
|
|
25
25
|
errorCount: number;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
+
function getSourceColor(sourceName: string | undefined): string | undefined {
|
|
29
|
+
if (!sourceName) return undefined;
|
|
30
|
+
const lastPart = sourceName.split("/").pop()?.toLowerCase();
|
|
31
|
+
if (lastPart === "error") return css.colorhsl(0, 80, 40);
|
|
32
|
+
if (lastPart === "warn") return css.colorhsl(40, 80, 40);
|
|
33
|
+
if (lastPart === "info") return css.colorhsl(280, 80, 40);
|
|
34
|
+
if (lastPart === "log") return css.colorhsl(200, 80, 40);
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
28
37
|
|
|
29
38
|
export class FilePathSelector extends qreact.Component<{
|
|
30
39
|
paths: TimeFilePathWithSize[];
|
|
@@ -377,7 +386,7 @@ export class FilePathSelectorModal extends qreact.Component<{
|
|
|
377
386
|
</td>
|
|
378
387
|
<td className={css.pad2(2)}>{this.props.formatBytes(file.size)}</td>
|
|
379
388
|
<td className={css.pad2(2)}>{file.logCount !== undefined ? formatNumber(file.logCount) : <span className={css.colorhsl(40, 60, 40)}>pending</span>}</td>
|
|
380
|
-
<td className={css.pad2(2)}>{file.sourceName}</td>
|
|
389
|
+
<td className={css.pad2(2) + (getSourceColor(file.sourceName) || "")}>{file.sourceName}</td>
|
|
381
390
|
<td className={css.pad2(2)}>{file.dedupe}</td>
|
|
382
391
|
<td className={css.pad2(2)}>{formatDateTime(file.startTime)}</td>
|
|
383
392
|
<td className={css.pad2(2)}>
|
|
@@ -429,7 +438,7 @@ export class FilePathSelectorModal extends qreact.Component<{
|
|
|
429
438
|
<div className={css.vbox(5)}>
|
|
430
439
|
{Array.from(bySource.entries()).map(([sourceName, stats]) => (
|
|
431
440
|
<div key={sourceName} className={css.hbox(10)}>
|
|
432
|
-
<div className={css.minWidth(240)}>{sourceName}:</div>
|
|
441
|
+
<div className={css.minWidth(240) + (getSourceColor(sourceName) || "")}>{sourceName}:</div>
|
|
433
442
|
<div className={css.minWidth(140)}>Files: {formatNumber(stats.fileCount)} ({formatNumber(stats.pendingCount)} pending)</div>
|
|
434
443
|
<div className={css.minWidth(120)}>Size: {this.props.formatBytes(stats.size)}</div>
|
|
435
444
|
<div className={css.minWidth(100)}>Logs: {formatNumber(stats.logCount)}</div>
|
|
@@ -25,6 +25,7 @@ import { blue } from "socket-function/src/formatting/logColors";
|
|
|
25
25
|
import { LimitGroup } from "../../../functional/limitProcessing";
|
|
26
26
|
import { getAllNodeIds } from "../../../-f-node-discovery/NodeDiscovery";
|
|
27
27
|
import { NodeCapabilitiesController } from "../../../-g-core-values/NodeCapabilities";
|
|
28
|
+
import { getLoggers2Async } from "../diskLogger";
|
|
28
29
|
|
|
29
30
|
export type TimeFilePathWithSize = TimeFilePath & {
|
|
30
31
|
size: number;
|
|
@@ -40,7 +41,6 @@ export class IndexedLogs<T> {
|
|
|
40
41
|
name: string,
|
|
41
42
|
maxSingleFileData?: number;
|
|
42
43
|
maxCountPerFile?: number;
|
|
43
|
-
forceUsePublicLogs?: boolean;
|
|
44
44
|
getTime: (result: T) => number | undefined;
|
|
45
45
|
}) {
|
|
46
46
|
loggerByName.set(this.config.name, this as any);
|
|
@@ -48,9 +48,10 @@ export class IndexedLogs<T> {
|
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
private static shouldRunLoop = false;
|
|
51
|
-
public static runLogMoveLoop() {
|
|
51
|
+
public static async runLogMoveLoop() {
|
|
52
52
|
IndexedLogs.shouldRunLoop = true;
|
|
53
|
-
|
|
53
|
+
let allLoggers = await getLoggers2Async();
|
|
54
|
+
for (let indexedLogs of Object.values(allLoggers)) {
|
|
54
55
|
indexedLogs.runLogMoverLoop();
|
|
55
56
|
}
|
|
56
57
|
}
|
|
@@ -91,7 +92,7 @@ export class IndexedLogs<T> {
|
|
|
91
92
|
let basePublic: Archives = getArchivesHome(getDomain());
|
|
92
93
|
// NOTE: The local disk is so fast that reading in 10 megabytes is nothing, And if we read in too small of a value, the overhead per read ends up making this take forever.
|
|
93
94
|
let extraReadSize = 1024 * 1024 * 10;
|
|
94
|
-
if (
|
|
95
|
+
if (isPublic()) {
|
|
95
96
|
basePublic = getArchivesBackblaze(getDomain());
|
|
96
97
|
// NOTE: While the latency to back plays is high, now we're reading in parallel, so it shouldn't be as big of an issue.
|
|
97
98
|
extraReadSize = 1024 * 1024 * 1;
|
|
@@ -274,8 +275,16 @@ export class IndexedLogs<T> {
|
|
|
274
275
|
forceReadPublic?: boolean;
|
|
275
276
|
}): Promise<TimeFilePathWithSize[]> {
|
|
276
277
|
let finalPaths: TimeFilePathWithSize[] = [];
|
|
278
|
+
if (config.forceReadPublic && !isPublic()) {
|
|
279
|
+
let machineNodes = await this.getMachineNodes();
|
|
280
|
+
if (machineNodes.length === 0) throw new Error(`Cannot find any public nodes to read from`);
|
|
281
|
+
return await IndexedLogShimController.nodes[machineNodes[0]].getPaths({
|
|
282
|
+
...config,
|
|
283
|
+
indexedLogsName: this.config.name,
|
|
284
|
+
});
|
|
285
|
+
}
|
|
277
286
|
|
|
278
|
-
if (
|
|
287
|
+
if (config.only !== "local" && isPublic()) {
|
|
279
288
|
let machineNodes = await this.getMachineNodes();
|
|
280
289
|
await Promise.all(machineNodes.map(async (machineNode) => {
|
|
281
290
|
try {
|
|
@@ -291,11 +300,6 @@ export class IndexedLogs<T> {
|
|
|
291
300
|
}));
|
|
292
301
|
}
|
|
293
302
|
|
|
294
|
-
// If we're forcefully reading from the public server, but we're not public, the code above will be the only code which adds to results
|
|
295
|
-
if (!isPublic() && config.forceReadPublic) {
|
|
296
|
-
return finalPaths;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
303
|
let localLogs = this.getLocalLogs();
|
|
300
304
|
let backblazeLogs = this.getPublicLogs();
|
|
301
305
|
let paths: TimeFilePath[] = [];
|
|
@@ -347,6 +351,16 @@ export class IndexedLogs<T> {
|
|
|
347
351
|
onResult: (match: T) => void;
|
|
348
352
|
onResults?: (results: IndexedLogResults) => Promise<boolean>;
|
|
349
353
|
}): Promise<IndexedLogResults> {
|
|
354
|
+
|
|
355
|
+
if (config.params.forceReadPublic && !isPublic()) {
|
|
356
|
+
let machineNodes = await this.getMachineNodes();
|
|
357
|
+
if (machineNodes.length === 0) throw new Error(`Cannot find any public nodes to read from`);
|
|
358
|
+
return await this.clientFind({
|
|
359
|
+
...config,
|
|
360
|
+
nodeId: machineNodes[0],
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
|
|
350
364
|
let startTime = Date.now();
|
|
351
365
|
let interval: NodeJS.Timeout | undefined;
|
|
352
366
|
|
|
@@ -360,7 +374,8 @@ export class IndexedLogs<T> {
|
|
|
360
374
|
let allResults = new Map<string, IndexedLogResults>();
|
|
361
375
|
let allDone: Promise<void>[] = [];
|
|
362
376
|
|
|
363
|
-
|
|
377
|
+
// Read other nodes if on a public server
|
|
378
|
+
if (config.params.only !== "local" && isPublic()) {
|
|
364
379
|
let machineNodes = await this.getMachineNodes();
|
|
365
380
|
allDone.push(...machineNodes.map(async (machineNode) => {
|
|
366
381
|
try {
|
|
@@ -385,12 +400,6 @@ export class IndexedLogs<T> {
|
|
|
385
400
|
}));
|
|
386
401
|
}
|
|
387
402
|
|
|
388
|
-
// If we're forcefully reading from the public server, but we're not public, the code above will be the only code which adds to results
|
|
389
|
-
if (!isPublic() && config.params.forceReadPublic) {
|
|
390
|
-
await Promise.all(allDone);
|
|
391
|
-
return getFinalResults();
|
|
392
|
-
}
|
|
393
|
-
|
|
394
403
|
|
|
395
404
|
let results: IndexedLogResults = createEmptyIndexedLogResults();
|
|
396
405
|
allResults.set("", results);
|
|
@@ -686,6 +686,12 @@ export class LogViewer3 extends qreact.Component {
|
|
|
686
686
|
checkbox
|
|
687
687
|
label="Exclude Pending Results"
|
|
688
688
|
url={excludePendingResults}
|
|
689
|
+
onChangeValue={(newValue) => {
|
|
690
|
+
if (newValue) {
|
|
691
|
+
savedPathsURL.value = "";
|
|
692
|
+
void this.loadPaths();
|
|
693
|
+
}
|
|
694
|
+
}}
|
|
689
695
|
/>
|
|
690
696
|
{!isPublic() && <InputLabelURL
|
|
691
697
|
checkbox
|