sparkforensics-mcp 0.3.0 → 0.4.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/bin/sparkforensics-mcp.mjs +41 -10
- package/package.json +1 -1
- package/vendor-core/analyzer.js +156 -48
- package/vendor-core/check-coverage.js +88 -0
- package/vendor-core/cli/budgets.js +31 -18
- package/vendor-core/cli/collect-run.js +76 -31
- package/vendor-core/cli/threshold-config.js +28 -0
- package/vendor-core/comparison-verdict.js +177 -0
- package/vendor-core/core-source-hash.txt +1 -0
- package/vendor-core/core-usage-locality.js +56 -2
- package/vendor-core/detector-docs.js +58 -0
- package/vendor-core/detectors.js +918 -458
- package/vendor-core/docs-config.js +0 -36
- package/vendor-core/docs-content/chapters/nav-index.json +31 -0
- package/vendor-core/docs-content/detection/cstor.md +9 -0
- package/vendor-core/docs-site-config.js +3 -0
- package/vendor-core/event-handlers.js +170 -6
- package/vendor-core/event-schemas.js +21 -0
- package/vendor-core/evidence-report.js +421 -112
- package/vendor-core/export-data.js +79 -6
- package/vendor-core/finding-action-label.js +9 -88
- package/vendor-core/finding-filter-predicate.js +9 -0
- package/vendor-core/finding-generic-recommendation.js +6 -104
- package/vendor-core/finding-names.js +21 -45
- package/vendor-core/finding-presentation.js +333 -0
- package/vendor-core/finding-tag-help.js +110 -0
- package/vendor-core/finding-types.js +361 -0
- package/vendor-core/findings-of-type.js +11 -0
- package/vendor-core/format-utils.js +92 -27
- package/vendor-core/html-export.js +51 -0
- package/vendor-core/impact-band.js +21 -8
- package/vendor-core/impact-estimator.js +8 -521
- package/vendor-core/impact-format.js +114 -0
- package/vendor-core/impact-model.js +175 -0
- package/vendor-core/ingest.js +2 -0
- package/vendor-core/intervals.js +13 -0
- package/vendor-core/list-runs.js +2 -3
- package/vendor-core/load-vendored.js +70 -5
- package/vendor-core/mcp-server-factory.js +14 -10
- package/vendor-core/mcp-tools.js +105 -45
- package/vendor-core/model-assembler.js +12 -0
- package/vendor-core/occupancy.js +1 -1
- package/vendor-core/parser-worker.js +1 -1
- package/vendor-core/plan-graph-model.js +3 -2
- package/vendor-core/plan-node-detail.js +1 -1
- package/vendor-core/recommendation-rollup.js +63 -3
- package/vendor-core/redact.js +45 -27
- package/vendor-core/run-comparison.js +32 -7
- package/vendor-core/run-interpretation.js +290 -0
- package/vendor-core/run-outcome.js +74 -0
- package/vendor-core/run-payload.js +17 -0
- package/vendor-core/run-shape.js +40 -0
- package/vendor-core/run-verdict.js +353 -0
- package/vendor-core/scaling-sim.js +4 -5
- package/vendor-core/scorecard-estimates.js +62 -0
- package/vendor-core/sql-stages.js +11 -0
- package/vendor-core/stage-quantiles.js +2 -0
- package/vendor-core/threshold-overrides.js +160 -0
- package/vendor-core/threshold-summary.js +11 -33
- package/vendor-core/types.js +6 -42
- package/vendor-core/wall-clock.js +1 -12
- package/vendor-core/wasted-core-hours.js +2 -2
|
@@ -1,35 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
skew: 'task duration skew above the configured ratio',
|
|
5
|
-
gc: 'JVM GC time share above the configured ratio',
|
|
6
|
-
slowHost: 'a host running 2x+ slower than its peers by mean task duration (per-executor byte/time dimensions use a separate, narrower ratio ladder starting at 1.33x; only those can reach critical on ratio alone)',
|
|
7
|
-
stageSlowness: 'a stage running far longer than its peers, not attributable to a single slow host',
|
|
8
|
-
straggler: 'one or more tasks finishing far after the rest of their stage',
|
|
9
|
-
speculationWaste: 'speculative task attempts that completed after the original',
|
|
10
|
-
tinyTask: 'median task duration below the configured floor',
|
|
11
|
-
partitionSizing: 'partition byte size outside the configured target range',
|
|
12
|
-
stageShape: 'low parallelism, data explosion, or task-count skew relative to core count',
|
|
13
|
-
stageFailed: 'a stage that failed outright',
|
|
14
|
-
failures: 'task failures above the configured rate',
|
|
15
|
-
retryWaste: 'retried task attempts consuming executor time',
|
|
16
|
-
coldStart: 'executor startup time above the configured floor',
|
|
17
|
-
incompleteRun: 'an event log missing its terminal ApplicationEnd/job-completion event',
|
|
18
|
-
utilization: 'core occupancy below the configured floor across the run',
|
|
19
|
-
memoryUtilization: 'executor heap usage outside the configured band',
|
|
20
|
-
cacheUtilization: 'cached partitions evicted or spilled to disk',
|
|
21
|
-
coreLocality: 'task placement missing data-local core assignment',
|
|
22
|
-
cachingOpportunity: 'a dataset re-read from source multiple times with no cache/persist',
|
|
23
|
-
jobFailureRate: 'job failure rate above the configured threshold',
|
|
24
|
-
autoscalingChurn: 'executor add/remove churn above the configured rate',
|
|
25
|
-
configAudit: 'a Spark conf value outside the recommended range',
|
|
26
|
-
duplicatePlanSubtree: 'the same physical plan subtree executed more than once',
|
|
27
|
-
smallFiles: 'output files below the configured target size',
|
|
28
|
-
overBroadcast: 'a broadcast join above the configured size ceiling',
|
|
29
|
-
underBroadcast: 'a join below the configured size floor that skipped broadcast',
|
|
30
|
-
broadcastSizing: 'a broadcast join outside the configured size range in either direction',
|
|
31
|
-
};
|
|
1
|
+
import { ENTRY_BY_TYPE, } from './detectors.js';
|
|
2
|
+
import { presentationOf } from './finding-presentation.js';
|
|
3
|
+
import { effectiveThresholds } from './threshold-overrides.js';
|
|
32
4
|
|
|
33
|
-
|
|
34
|
-
|
|
5
|
+
/** The clean-check criterion for a finding type, built from the thresholds of the first DETECTORS
|
|
6
|
+
* entry that emits it (configAudit's four entries share one summary), with `overrides` merged in
|
|
7
|
+
* when the run was tuned. */
|
|
8
|
+
export function getThresholdSummary(type , overrides ) {
|
|
9
|
+
const presentation = presentationOf(type);
|
|
10
|
+
const entry = ENTRY_BY_TYPE.get(type);
|
|
11
|
+
if (!presentation || !entry) return 'criteria not met';
|
|
12
|
+
return presentation.thresholdSummary(effectiveThresholds(entry, overrides) );
|
|
35
13
|
}
|
package/vendor-core/types.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
1
4
|
|
|
2
5
|
|
|
3
6
|
|
|
@@ -287,48 +290,9 @@
|
|
|
287
290
|
|
|
288
291
|
|
|
289
292
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
293
|
+
// `Finding` is a union discriminated on `type`, one member per emitted finding type: see
|
|
294
|
+
// finding-types.ts for each detector's shape and which of its fields are public evidence.
|
|
295
|
+
|
|
332
296
|
|
|
333
297
|
|
|
334
298
|
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
if (intervals.length === 0) return [];
|
|
3
|
-
const sorted = [...intervals].sort((a, b) => a[0] - b[0]);
|
|
4
|
-
const out = [[sorted[0][0], sorted[0][1]]];
|
|
5
|
-
for (let i = 1; i < sorted.length; i++) {
|
|
6
|
-
const last = out[out.length - 1];
|
|
7
|
-
const cur = sorted[i];
|
|
8
|
-
if (cur[0] <= last[1]) last[1] = Math.max(last[1], cur[1]);
|
|
9
|
-
else out.push([cur[0], cur[1]]);
|
|
10
|
-
}
|
|
11
|
-
return out;
|
|
12
|
-
}
|
|
1
|
+
import { mergeIntervals } from './intervals.js';
|
|
13
2
|
|
|
14
3
|
export function computeWallClock(app , stages ) {
|
|
15
4
|
const start = app?.startTime ?? 0;
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
// core-time that actually ran tasks. Feeds a report widget only, no detector.
|
|
4
4
|
|
|
5
5
|
import { computeTotalCores } from './core-count.js';
|
|
6
|
+
import { MS_PER_CORE_HOUR } from './format-utils.js';
|
|
6
7
|
|
|
7
|
-
export const MS_PER_CORE_HOUR = 3.6e6;
|
|
8
8
|
const TOP_N = 5;
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|