claude-flow-novice 2.2.4 → 2.2.5
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 +9 -8
- package/scripts/.claude-flow/metrics/agent-metrics.json +1 -0
- package/scripts/.claude-flow/metrics/performance.json +9 -0
- package/scripts/.claude-flow/metrics/task-metrics.json +10 -0
- package/scripts/CLEANUP_OPTIMIZATION_REPORT.json +312 -0
- package/scripts/CLEANUP_PERFORMANCE_OPTIMIZATION.md +387 -0
- package/scripts/CLEANUP_QUICK_START.md +268 -0
- package/scripts/CLEANUP_TEST_RESULTS.md +205 -0
- package/scripts/README.md +339 -0
- package/scripts/ace-query.sh +384 -0
- package/scripts/agent-token-analysis.js +430 -0
- package/scripts/auto-setup.js +332 -0
- package/scripts/build/README.md +167 -0
- package/scripts/build/build-config.js +27 -0
- package/scripts/build/build-prompt-copier.sh +30 -0
- package/scripts/build/performance-monitor.js +869 -0
- package/scripts/build/prepare-publish.js +150 -0
- package/scripts/build/typescript-fixer.js +621 -0
- package/scripts/build/unified-builder.sh +428 -0
- package/scripts/build/update-bin-version.js +32 -0
- package/scripts/build/validate-agents.js +238 -0
- package/scripts/build-index.js +43 -0
- package/scripts/build-orchestrator.js +320 -0
- package/scripts/check-routing-stats.cjs +122 -0
- package/scripts/ci-validation.js +375 -0
- package/scripts/cleanup-blocking-coordination.sh +420 -0
- package/scripts/cleanup-idle-sessions.sh +59 -0
- package/scripts/collect-build-metrics.js +65 -0
- package/scripts/demo/README.md +79 -0
- package/scripts/demo/autoscaling-demo-simplified.js +963 -0
- package/scripts/demo/comprehensive-dashboard-test.js +693 -0
- package/scripts/demo/confidence-log.js +87 -0
- package/scripts/demo/confidence-report.js +82 -0
- package/scripts/demo/demo-multi-swarm-coordination.js +325 -0
- package/scripts/demo/demo-production-deployment.js +399 -0
- package/scripts/demo/demo-visualization-system.js +149 -0
- package/scripts/demo/performance-analysis.cjs +71 -0
- package/scripts/demo/performance-analysis.js +71 -0
- package/scripts/demo/test-autoscaling-demo.js +314 -0
- package/scripts/dependency-optimizer.js +349 -0
- package/scripts/dependency-security-assessment.js +331 -0
- package/scripts/deploy-sdk.sh +176 -0
- package/scripts/deployment-readiness-report.json +179 -0
- package/scripts/dev/README.md +264 -0
- package/scripts/dev/claude-flow-wrapper.sh +35 -0
- package/scripts/dev/claude-monitor.py +419 -0
- package/scripts/dev/claude-sparc.sh +562 -0
- package/scripts/dev/claude-wrapper.sh +17 -0
- package/scripts/dev/demo-phase3-compliance.js +172 -0
- package/scripts/dev/demo-task-system.ts +224 -0
- package/scripts/dev/deployment-validator.js +315 -0
- package/scripts/dev/spawn-claude-terminal.sh +32 -0
- package/scripts/dev/start-portal.sh +506 -0
- package/scripts/dev/start-web-ui.js +15 -0
- package/scripts/dev/stop-portal.sh +311 -0
- package/scripts/dev/validate-examples.ts +288 -0
- package/scripts/dev/validate-phase2.cjs +451 -0
- package/scripts/dev/validate-phase2.js +785 -0
- package/scripts/dev/validate-phase3.cjs +208 -0
- package/scripts/dev/validate-security-remediation.js +1 -0
- package/scripts/ecosystem.config.cjs +90 -0
- package/scripts/fix-js-extensions.js +167 -0
- package/scripts/generate-basic-types.js +73 -0
- package/scripts/generate-changelog.js +318 -0
- package/scripts/git-hooks/pre-commit.sh +143 -0
- package/scripts/health-checks.js +634 -0
- package/scripts/hook-wrapper.sh +54 -0
- package/scripts/install/README.md +375 -0
- package/scripts/install/REDIS_SETUP_VALIDATION.json +245 -0
- package/scripts/install/check-prerequisites.js +303 -0
- package/scripts/install/config-wizard.js +606 -0
- package/scripts/install/dependency-checker.js +385 -0
- package/scripts/install/health-check.js +765 -0
- package/scripts/install/install.js +256 -0
- package/scripts/install/installation-benchmark.js +461 -0
- package/scripts/install/quick-install.js +720 -0
- package/scripts/install/quick-start-wizard.js +295 -0
- package/scripts/install/redis-cli.js +289 -0
- package/scripts/install/redis-install-guides.md +407 -0
- package/scripts/install/redis-setup.js +559 -0
- package/scripts/install/redis-test.js +278 -0
- package/scripts/install/service-manager.js +672 -0
- package/scripts/install/setup.js +832 -0
- package/scripts/install/uninstall.js +526 -0
- package/scripts/install/update.js +461 -0
- package/scripts/install-pre-commit-hook.sh +127 -0
- package/scripts/legacy/README.md +272 -0
- package/scripts/legacy/batch-fix-ts.sh +54 -0
- package/scripts/legacy/build-migration.sh +105 -0
- package/scripts/legacy/build-monitor.js +209 -0
- package/scripts/legacy/build-with-filter.sh +84 -0
- package/scripts/legacy/build-workaround.sh +71 -0
- package/scripts/legacy/fix-ts-advanced.js +358 -0
- package/scripts/legacy/fix-ts-final.sh +50 -0
- package/scripts/legacy/fix-ts-targeted.sh +49 -0
- package/scripts/legacy/fix-typescript-errors.js +305 -0
- package/scripts/legacy/force-build.sh +63 -0
- package/scripts/legacy/optimize-performance.js +400 -0
- package/scripts/legacy/performance-monitor.js +263 -0
- package/scripts/legacy/performance-monitoring.js +532 -0
- package/scripts/legacy/performance-test-runner.js +645 -0
- package/scripts/legacy/quick-fix-ts.js +281 -0
- package/scripts/legacy/safe-build.sh +63 -0
- package/scripts/memory-monitor-coordinator.js +322 -0
- package/scripts/migrate-to-sdk.sh +520 -0
- package/scripts/migration/QUICK-START.md +189 -0
- package/scripts/migration/QUICK-START.md.backup-1760135091363 +189 -0
- package/scripts/migration/README.md +464 -0
- package/scripts/migration/TASK-1.3.2-COMPLETION-REPORT.md +500 -0
- package/scripts/migration/TASK-1.3.2-COMPLETION-REPORT.md.backup-1760135091348 +500 -0
- package/scripts/migration/UPDATE-PATHS-README.md +464 -0
- package/scripts/migration/UPDATE-PATHS-README.md.backup-1760135091337 +464 -0
- package/scripts/migration/example-patterns.json +19 -0
- package/scripts/migration/install-arm64.js +78 -0
- package/scripts/migration/install.js +83 -0
- package/scripts/migration/migrate-hooks.js +173 -0
- package/scripts/migration/migration-examples.ts +318 -0
- package/scripts/migration/reorganize-workspace.js +504 -0
- package/scripts/migration/test-update-paths.js +359 -0
- package/scripts/migration/update-paths.js +664 -0
- package/scripts/migration/validate-migration.js +647 -0
- package/scripts/monitor-loop.sh +65 -0
- package/scripts/monitor-memory.sh +47 -0
- package/scripts/monitor-migration.js +339 -0
- package/scripts/monitor.py +43 -0
- package/scripts/monitoring/README.md +178 -0
- package/scripts/monitoring/alert-monitor.sh +220 -0
- package/scripts/monitoring/analyze-resources.sh +199 -0
- package/scripts/monitoring/dashboards/rate-limiting-dashboard.json +211 -0
- package/scripts/monitoring/dynamic-monitor.sh +85 -0
- package/scripts/monitoring/launch-stability-test.sh +184 -0
- package/scripts/monitoring/monitor-test.sh +93 -0
- package/scripts/monitoring/pre-test-validation.sh +208 -0
- package/scripts/monitoring/quick-test-alerting.sh +118 -0
- package/scripts/monitoring/quick-test-rate-limiting.sh +206 -0
- package/scripts/monitoring/rate-limiting-monitor.sh +380 -0
- package/scripts/monitoring/resource-monitor.sh +126 -0
- package/scripts/monitoring/stability-monitor.js +429 -0
- package/scripts/monitoring/test-monitor-quick.sh +54 -0
- package/scripts/monitoring/view-alerts.sh +307 -0
- package/scripts/npm-metrics-collector.js +482 -0
- package/scripts/npm-package-validation.cjs +299 -0
- package/scripts/optimization/build-optimizer.js +438 -0
- package/scripts/optimization/config-validator.js +761 -0
- package/scripts/optimization/test-optimization.js +432 -0
- package/scripts/optimization/unified-activation.js +839 -0
- package/scripts/optimize-package-swarm.js +54 -0
- package/scripts/performance/ACTIVATION_COMMANDS.md +292 -0
- package/scripts/performance/sqlite-enhanced-activation.sh +583 -0
- package/scripts/performance/test-enhanced-backend.sh +504 -0
- package/scripts/performance-monitor.js +644 -0
- package/scripts/performance-test-runner.js +698 -0
- package/scripts/post-deployment-monitoring.js +350 -0
- package/scripts/post-edit-pipeline.js +2091 -0
- package/scripts/post-install-claude-md.js +78 -0
- package/scripts/postinstall.js +79 -0
- package/scripts/pre-publish-validation.cjs +212 -0
- package/scripts/pre-publish-validation.js +429 -0
- package/scripts/redis-lua/cleanup-blocking-coordination.lua +198 -0
- package/scripts/release-announcement.js +425 -0
- package/scripts/release-notification.js +248 -0
- package/scripts/release-rollback.js +376 -0
- package/scripts/release-validation.js +460 -0
- package/scripts/rollback-sdk.sh +66 -0
- package/scripts/run-production-validation.ts +590 -0
- package/scripts/run-stability-validation.sh +687 -0
- package/scripts/security/README.md +339 -0
- package/scripts/security/deployment-validation.cjs +279 -0
- package/scripts/security/envelope-encryption-confidence-report.cjs +422 -0
- package/scripts/security/install-git-hooks.sh +132 -0
- package/scripts/security/install-git-secrets.sh +295 -0
- package/scripts/security/rotate-api-keys.js +469 -0
- package/scripts/security/ruv-swarm-safe.js +74 -0
- package/scripts/security/security-audit.cjs +538 -0
- package/scripts/security/setup-redis-auth.sh +397 -0
- package/scripts/security/validate-envelope-encryption.cjs +340 -0
- package/scripts/security-scan.js +492 -0
- package/scripts/src/web/frontend/.claude-flow/metrics/agent-metrics.json +1 -0
- package/scripts/src/web/frontend/.claude-flow/metrics/performance.json +9 -0
- package/scripts/src/web/frontend/.claude-flow/metrics/task-metrics.json +10 -0
- package/scripts/switch-api.sh +158 -0
- package/scripts/sync-agents.js +290 -0
- package/scripts/test/50-agent-test.js +625 -0
- package/scripts/test/NEW_STABILITY_TEST_GUIDE.md +407 -0
- package/scripts/test/README.md +236 -0
- package/scripts/test/STABILITY_TEST_EXAMPLE.md +347 -0
- package/scripts/test/STABILITY_TEST_README.md +480 -0
- package/scripts/test/agent-worker.js +309 -0
- package/scripts/test/ai-coordination-test.js +650 -0
- package/scripts/test/ai-mesh-coordination-test.js +416 -0
- package/scripts/test/check-links.ts +274 -0
- package/scripts/test/check-performance-regression.ts +168 -0
- package/scripts/test/cli-agent-coordination-test.js +313 -0
- package/scripts/test/coordinator-multilingual-test.js +396 -0
- package/scripts/test/coordinator-transparency-demo.js +585 -0
- package/scripts/test/coverage-report.ts +692 -0
- package/scripts/test/generate-swarm-tests.js +633 -0
- package/scripts/test/integration-test-validation.cjs +253 -0
- package/scripts/test/load-test-swarm.js +576 -0
- package/scripts/test/mesh-coordination-zero-overlap-test.js +740 -0
- package/scripts/test/multilingual-hello-world-test.js +390 -0
- package/scripts/test/quick-multilingual-demo.js +464 -0
- package/scripts/test/real-agent-test.js +312 -0
- package/scripts/test/run-phase3-compliance-tests.js +427 -0
- package/scripts/test/run-stability-test-examples.sh +292 -0
- package/scripts/test/stability-results/stability-metrics.jsonl +83 -0
- package/scripts/test/stability-results/stability-test-report.json +128 -0
- package/scripts/test/stability-results/stability-test.log +1827 -0
- package/scripts/test/stability-test-50-agents.js +734 -0
- package/scripts/test/test-batch-tasks.ts +29 -0
- package/scripts/test/test-byzantine-resolution.js +246 -0
- package/scripts/test/test-claude-spawn-options.sh +63 -0
- package/scripts/test/test-cli-wizard.js +331 -0
- package/scripts/test/test-comprehensive.js +401 -0
- package/scripts/test/test-coordination-features.ts +238 -0
- package/scripts/test/test-fallback-systems.js +276 -0
- package/scripts/test/test-init-command.ts +302 -0
- package/scripts/test/test-mcp.ts +251 -0
- package/scripts/test/test-runner.ts +568 -0
- package/scripts/test/test-swarm-integration.sh +92 -0
- package/scripts/test/test-swarm.ts +142 -0
- package/scripts/test/validation-summary.ts +408 -0
- package/scripts/test-cleanup-performance.sh +416 -0
- package/scripts/test-dashboard-auth.cjs +203 -0
- package/scripts/test-docker-deployment.sh +207 -0
- package/scripts/test-npm-package.cjs +167 -0
- package/scripts/test-provider-routing.cjs +226 -0
- package/scripts/test-routing-telemetry.cjs +147 -0
- package/scripts/test-runner.cjs +154 -0
- package/scripts/test-zai-10k.cjs +81 -0
- package/scripts/test-zai-api.cjs +191 -0
- package/scripts/test-zai-diagnostic.cjs +151 -0
- package/scripts/test-zai-final.cjs +128 -0
- package/scripts/test-zai-with-env.cjs +85 -0
- package/scripts/utils/README.md +261 -0
- package/scripts/utils/clean-build-artifacts.sh +94 -0
- package/scripts/utils/cleanup-root.sh +69 -0
- package/scripts/utils/fix-cliffy-imports.js +307 -0
- package/scripts/utils/fix-duplicate-imports.js +114 -0
- package/scripts/utils/fix-error-handling.cjs +70 -0
- package/scripts/utils/fix-import-paths.js +104 -0
- package/scripts/utils/fix-imports.js +116 -0
- package/scripts/utils/fix-shebang.js +78 -0
- package/scripts/utils/fix-test-modules.js +27 -0
- package/scripts/utils/fix-timezone-issue-246.js +200 -0
- package/scripts/utils/fix-ts-comprehensive.py +182 -0
- package/scripts/utils/fix-ts-targeted-batch.js +250 -0
- package/scripts/utils/remove-benchmark-conflicts.sh +140 -0
- package/scripts/utils/simple-test-fixer.js +190 -0
- package/scripts/utils/validate-metrics-structure.cjs +144 -0
- package/scripts/validate-agent-hooks.js +506 -0
- package/scripts/validate-changelog.js +241 -0
- package/scripts/validate-coordination-cli.js +69 -0
- package/scripts/validate-coordination-toggle-integration.cjs +501 -0
- package/scripts/validate-docker-infrastructure.sh +502 -0
- package/scripts/validate-entry-points.js +300 -0
- package/scripts/validate-stage3-performance.ts +377 -0
- package/scripts/validate-template-bundling.js +180 -0
- package/scripts/validation/README.md +33 -0
- package/scripts/validation/acl-security-validation.cjs +214 -0
- package/scripts/validation/acl-security-validation.js +402 -0
- package/scripts/validation/byzantine-verification.js +407 -0
- package/scripts/validation/final-phase-2-consensus.cjs +219 -0
- package/scripts/validation/final-security-validation.js +791 -0
- package/scripts/validation/final-wasm-validation.cjs +840 -0
- package/scripts/validation/integration-test-analysis.js +105 -0
- package/scripts/validation/phase-0-comprehensive-validation.js +474 -0
- package/scripts/validation/phase-0-consensus-report.js +139 -0
- package/scripts/validation/phase-0-final-report.js +112 -0
- package/scripts/validation/phase-0-redis-consensus-report.js +129 -0
- package/scripts/validation/phase-0-validation-improved.js +490 -0
- package/scripts/validation/phase-0-validation-test.js +65 -0
- package/scripts/validation/phase-1-consensus-report.cjs +342 -0
- package/scripts/validation/phase-1-consensus-validation.cjs +551 -0
- package/scripts/validation/phase-1-consensus-validation.js +551 -0
- package/scripts/validation/phase-2-consensus-report.cjs +186 -0
- package/scripts/validation/phase-2-validation.cjs +171 -0
- package/scripts/validation/phase-2-validation.js +171 -0
- package/scripts/validation/phase-4-consensus-report.js +181 -0
- package/scripts/validation/phase-4-final-validation.js +351 -0
- package/scripts/validation/phase-5-consensus-report.cjs +113 -0
- package/scripts/validation/phase-5-consensus-report.js +113 -0
- package/scripts/validation/security-analysis.js +49 -0
- package/scripts/validation/security-validation.js +492 -0
- package/scripts/validation/simple-security-validation.js +464 -0
- package/scripts/verify-installation.js +112 -0
- package/scripts/verify-mcp-server.js +86 -0
- package/scripts/verify-sdk-phase1.cjs +293 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Memory monitoring script for agent swarms
|
|
3
|
+
|
|
4
|
+
LOG_FILE="memory-monitor.log"
|
|
5
|
+
INTERVAL=5 # seconds
|
|
6
|
+
|
|
7
|
+
echo "=== Memory Monitor Started ===" | tee -a "$LOG_FILE"
|
|
8
|
+
echo "Timestamp: $(date)" | tee -a "$LOG_FILE"
|
|
9
|
+
echo "" | tee -a "$LOG_FILE"
|
|
10
|
+
|
|
11
|
+
while true; do
|
|
12
|
+
TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S')
|
|
13
|
+
|
|
14
|
+
# Total memory usage
|
|
15
|
+
TOTAL_MEM=$(ps aux | grep -E "(claude|node)" | grep -v grep | awk '{sum+=$6} END {print sum/1024}')
|
|
16
|
+
|
|
17
|
+
# Node process count
|
|
18
|
+
NODE_COUNT=$(ps aux | grep node | grep -v grep | grep -v snapfuse | wc -l)
|
|
19
|
+
|
|
20
|
+
# Claude process count
|
|
21
|
+
CLAUDE_COUNT=$(ps aux | grep claude | grep -v grep | wc -l)
|
|
22
|
+
|
|
23
|
+
# Zombie processes
|
|
24
|
+
ZOMBIE_COUNT=$(ps aux | grep "<defunct>" | grep -v grep | wc -l)
|
|
25
|
+
|
|
26
|
+
# Find processes (stuck)
|
|
27
|
+
FIND_COUNT=$(ps aux | grep "find /mnt/c" | grep -v grep | wc -l)
|
|
28
|
+
|
|
29
|
+
echo "[$TIMESTAMP] MEM: ${TOTAL_MEM}MB | Node: $NODE_COUNT | Claude: $CLAUDE_COUNT | Zombies: $ZOMBIE_COUNT | Find: $FIND_COUNT" | tee -a "$LOG_FILE"
|
|
30
|
+
|
|
31
|
+
# Alert if memory exceeds 10GB
|
|
32
|
+
if (( $(echo "$TOTAL_MEM > 10000" | bc -l) )); then
|
|
33
|
+
echo "⚠️ WARNING: Memory usage exceeds 10GB!" | tee -a "$LOG_FILE"
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
# Alert if too many node processes
|
|
37
|
+
if [ "$NODE_COUNT" -gt 20 ]; then
|
|
38
|
+
echo "⚠️ WARNING: $NODE_COUNT node processes detected (orphaned agents?)" | tee -a "$LOG_FILE"
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
# Alert if find commands stuck
|
|
42
|
+
if [ "$FIND_COUNT" -gt 0 ]; then
|
|
43
|
+
echo "🔴 CRITICAL: $FIND_COUNT find commands running on /mnt/c (memory bomb!)" | tee -a "$LOG_FILE"
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
sleep $INTERVAL
|
|
47
|
+
done
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* SDK Migration Monitoring Script
|
|
5
|
+
* Provides real-time monitoring and alerting during migration
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const { MetricsCollector, SDKDashboard } = require('../src/sdk/dashboard');
|
|
9
|
+
const { defaultConfig } = require('../src/sdk/performance-config');
|
|
10
|
+
const fs = require('fs').promises;
|
|
11
|
+
const path = require('path');
|
|
12
|
+
|
|
13
|
+
class MigrationMonitor {
|
|
14
|
+
constructor(config = {}) {
|
|
15
|
+
this.config = {
|
|
16
|
+
checkInterval: config.checkInterval || 60000, // 1 minute
|
|
17
|
+
alertThresholds: {
|
|
18
|
+
errorRate: 0.05,
|
|
19
|
+
validationFailureRate: 0.2,
|
|
20
|
+
responseTimeP95: 10000,
|
|
21
|
+
cacheHitRate: 0.3
|
|
22
|
+
},
|
|
23
|
+
...config
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
this.collector = new MetricsCollector();
|
|
27
|
+
this.dashboard = new SDKDashboard(this.collector, {
|
|
28
|
+
port: config.dashboardPort || 3000,
|
|
29
|
+
updateInterval: 5000,
|
|
30
|
+
authentication: false
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
this.alerts = [];
|
|
34
|
+
this.metricsHistory = [];
|
|
35
|
+
this.isMonitoring = false;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async start() {
|
|
39
|
+
console.log('🚀 Starting SDK Migration Monitor...\n');
|
|
40
|
+
|
|
41
|
+
// Start dashboard
|
|
42
|
+
this.dashboard.start(() => {
|
|
43
|
+
console.log('✅ Dashboard started successfully\n');
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// Start metrics collection
|
|
47
|
+
this.isMonitoring = true;
|
|
48
|
+
this.startMetricsCollection();
|
|
49
|
+
|
|
50
|
+
// Set up graceful shutdown
|
|
51
|
+
process.on('SIGINT', () => this.stop());
|
|
52
|
+
process.on('SIGTERM', () => this.stop());
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async stop() {
|
|
56
|
+
console.log('\n🛑 Stopping migration monitor...');
|
|
57
|
+
this.isMonitoring = false;
|
|
58
|
+
|
|
59
|
+
// Save final metrics
|
|
60
|
+
await this.saveMetricsSnapshot();
|
|
61
|
+
|
|
62
|
+
// Stop dashboard
|
|
63
|
+
this.dashboard.stop();
|
|
64
|
+
|
|
65
|
+
console.log('✅ Monitor stopped');
|
|
66
|
+
process.exit(0);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
startMetricsCollection() {
|
|
70
|
+
// Simulate metrics collection (replace with actual implementation)
|
|
71
|
+
const collectMetrics = async () => {
|
|
72
|
+
if (!this.isMonitoring) return;
|
|
73
|
+
|
|
74
|
+
try {
|
|
75
|
+
// Collect system metrics
|
|
76
|
+
const systemMetrics = await this.collectSystemMetrics();
|
|
77
|
+
this.recordSystemMetrics(systemMetrics);
|
|
78
|
+
|
|
79
|
+
// Collect application metrics
|
|
80
|
+
const appMetrics = await this.collectApplicationMetrics();
|
|
81
|
+
this.recordApplicationMetrics(appMetrics);
|
|
82
|
+
|
|
83
|
+
// Check thresholds and trigger alerts
|
|
84
|
+
await this.checkThresholds();
|
|
85
|
+
|
|
86
|
+
// Store metrics history
|
|
87
|
+
this.metricsHistory.push({
|
|
88
|
+
timestamp: Date.now(),
|
|
89
|
+
system: systemMetrics,
|
|
90
|
+
application: appMetrics
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// Keep only last 1000 entries
|
|
94
|
+
if (this.metricsHistory.length > 1000) {
|
|
95
|
+
this.metricsHistory = this.metricsHistory.slice(-1000);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Save snapshot periodically
|
|
99
|
+
if (this.metricsHistory.length % 10 === 0) {
|
|
100
|
+
await this.saveMetricsSnapshot();
|
|
101
|
+
}
|
|
102
|
+
} catch (error) {
|
|
103
|
+
console.error('Error collecting metrics:', error);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Schedule next collection
|
|
107
|
+
setTimeout(collectMetrics, this.config.checkInterval);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
collectMetrics();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
async collectSystemMetrics() {
|
|
114
|
+
const os = require('os');
|
|
115
|
+
|
|
116
|
+
return {
|
|
117
|
+
cpu: this.getCPUUsage(),
|
|
118
|
+
memory: (1 - os.freemem() / os.totalmem()) * 100,
|
|
119
|
+
loadAverage: os.loadavg()[0],
|
|
120
|
+
uptime: os.uptime()
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
getCPUUsage() {
|
|
125
|
+
const cpus = require('os').cpus();
|
|
126
|
+
const totalIdle = cpus.reduce((acc, cpu) => acc + cpu.times.idle, 0);
|
|
127
|
+
const totalTick = cpus.reduce(
|
|
128
|
+
(acc, cpu) => acc + Object.values(cpu.times).reduce((a, b) => a + b, 0),
|
|
129
|
+
0
|
|
130
|
+
);
|
|
131
|
+
return ((1 - totalIdle / totalTick) * 100);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
async collectApplicationMetrics() {
|
|
135
|
+
// In real implementation, collect from actual application
|
|
136
|
+
// For now, generate simulated metrics
|
|
137
|
+
return {
|
|
138
|
+
responseTime: Math.random() * 1000 + 200,
|
|
139
|
+
throughput: Math.floor(Math.random() * 100) + 50,
|
|
140
|
+
errorRate: Math.random() * 0.02,
|
|
141
|
+
cacheHitRate: 0.6 + Math.random() * 0.3,
|
|
142
|
+
validationSuccess: 0.9 + Math.random() * 0.09,
|
|
143
|
+
testPassRate: 0.95 + Math.random() * 0.04,
|
|
144
|
+
coverage: 80 + Math.random() * 15,
|
|
145
|
+
activeAgents: Math.floor(Math.random() * 5) + 2,
|
|
146
|
+
queuedTasks: Math.floor(Math.random() * 10)
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
recordSystemMetrics(metrics) {
|
|
151
|
+
this.collector.recordMetric('system', 'cpuUsage', metrics.cpu);
|
|
152
|
+
this.collector.recordMetric('system', 'memoryUsage', metrics.memory);
|
|
153
|
+
this.collector.recordMetric('system', 'activeAgents', metrics.activeAgents || 0);
|
|
154
|
+
this.collector.recordMetric('system', 'queuedTasks', metrics.queuedTasks || 0);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
recordApplicationMetrics(metrics) {
|
|
158
|
+
this.collector.recordMetric('performance', 'responseTime', metrics.responseTime);
|
|
159
|
+
this.collector.recordMetric('performance', 'throughput', metrics.throughput);
|
|
160
|
+
this.collector.recordMetric('performance', 'errorRate', metrics.errorRate);
|
|
161
|
+
this.collector.recordMetric('performance', 'cacheHitRate', metrics.cacheHitRate);
|
|
162
|
+
|
|
163
|
+
this.collector.recordMetric('quality', 'validationSuccess', metrics.validationSuccess);
|
|
164
|
+
this.collector.recordMetric('quality', 'testPassRate', metrics.testPassRate);
|
|
165
|
+
this.collector.recordMetric('quality', 'coverageMetrics', metrics.coverage);
|
|
166
|
+
|
|
167
|
+
// Estimate token usage and cost
|
|
168
|
+
const estimatedTokens = metrics.throughput * 1000; // ~1k tokens per request
|
|
169
|
+
this.collector.recordMetric('cost', 'tokenUsage', estimatedTokens);
|
|
170
|
+
this.collector.metrics.cost.estimatedCost += estimatedTokens * 0.000003; // $3 per 1M tokens
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
async checkThresholds() {
|
|
174
|
+
const summary = this.collector.getSummary();
|
|
175
|
+
|
|
176
|
+
// Check error rate
|
|
177
|
+
if (summary.performance.errorRate > this.config.alertThresholds.errorRate) {
|
|
178
|
+
this.triggerAlert({
|
|
179
|
+
id: `error-rate-${Date.now()}`,
|
|
180
|
+
name: 'high-error-rate',
|
|
181
|
+
severity: 'critical',
|
|
182
|
+
message: `Error rate ${(summary.performance.errorRate * 100).toFixed(2)}% exceeds threshold ${(this.config.alertThresholds.errorRate * 100).toFixed(2)}%`,
|
|
183
|
+
metric: 'errorRate',
|
|
184
|
+
currentValue: summary.performance.errorRate,
|
|
185
|
+
threshold: this.config.alertThresholds.errorRate,
|
|
186
|
+
recommendation: 'Consider rolling back migration'
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Check validation failure rate
|
|
191
|
+
const validationFailureRate = 1 - summary.quality.validationSuccessRate;
|
|
192
|
+
if (validationFailureRate > this.config.alertThresholds.validationFailureRate) {
|
|
193
|
+
this.triggerAlert({
|
|
194
|
+
id: `validation-failure-${Date.now()}`,
|
|
195
|
+
name: 'validation-failure-spike',
|
|
196
|
+
severity: 'high',
|
|
197
|
+
message: `Validation failure rate ${(validationFailureRate * 100).toFixed(2)}% exceeds threshold`,
|
|
198
|
+
metric: 'validationFailureRate',
|
|
199
|
+
currentValue: validationFailureRate,
|
|
200
|
+
threshold: this.config.alertThresholds.validationFailureRate,
|
|
201
|
+
recommendation: 'Review validation configuration'
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// Check response time
|
|
206
|
+
if (summary.performance.responseTime.p95 > this.config.alertThresholds.responseTimeP95) {
|
|
207
|
+
this.triggerAlert({
|
|
208
|
+
id: `slow-response-${Date.now()}`,
|
|
209
|
+
name: 'slow-response-time',
|
|
210
|
+
severity: 'warning',
|
|
211
|
+
message: `P95 response time ${summary.performance.responseTime.p95.toFixed(0)}ms exceeds threshold`,
|
|
212
|
+
metric: 'responseTimeP95',
|
|
213
|
+
currentValue: summary.performance.responseTime.p95,
|
|
214
|
+
threshold: this.config.alertThresholds.responseTimeP95,
|
|
215
|
+
recommendation: 'Check for performance bottlenecks'
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Check cache hit rate
|
|
220
|
+
if (summary.performance.cacheHitRate < this.config.alertThresholds.cacheHitRate) {
|
|
221
|
+
this.triggerAlert({
|
|
222
|
+
id: `low-cache-${Date.now()}`,
|
|
223
|
+
name: 'low-cache-hit-rate',
|
|
224
|
+
severity: 'warning',
|
|
225
|
+
message: `Cache hit rate ${(summary.performance.cacheHitRate * 100).toFixed(1)}% below threshold`,
|
|
226
|
+
metric: 'cacheHitRate',
|
|
227
|
+
currentValue: summary.performance.cacheHitRate,
|
|
228
|
+
threshold: this.config.alertThresholds.cacheHitRate,
|
|
229
|
+
recommendation: 'Review cache configuration'
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
triggerAlert(alert) {
|
|
235
|
+
// Deduplicate alerts (don't trigger same alert multiple times)
|
|
236
|
+
const existingAlert = this.alerts.find(
|
|
237
|
+
a => a.name === alert.name && !a.resolved && Date.now() - a.timestamp < 300000
|
|
238
|
+
);
|
|
239
|
+
|
|
240
|
+
if (existingAlert) return;
|
|
241
|
+
|
|
242
|
+
// Add to collector
|
|
243
|
+
this.collector.addAlert(alert);
|
|
244
|
+
this.alerts.push(alert);
|
|
245
|
+
|
|
246
|
+
// Print to console
|
|
247
|
+
const icon = alert.severity === 'critical' ? '🚨' : alert.severity === 'high' ? '⚠️' : '⚡';
|
|
248
|
+
console.log(`\n${icon} ALERT: ${alert.name}`);
|
|
249
|
+
console.log(` ${alert.message}`);
|
|
250
|
+
console.log(` Recommendation: ${alert.recommendation}\n`);
|
|
251
|
+
|
|
252
|
+
// Write to file
|
|
253
|
+
this.saveAlert(alert);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
async saveAlert(alert) {
|
|
257
|
+
const alertsFile = path.join(__dirname, '../logs/alerts.json');
|
|
258
|
+
|
|
259
|
+
try {
|
|
260
|
+
let alerts = [];
|
|
261
|
+
try {
|
|
262
|
+
const content = await fs.readFile(alertsFile, 'utf8');
|
|
263
|
+
alerts = JSON.parse(content);
|
|
264
|
+
} catch (err) {
|
|
265
|
+
// File doesn't exist yet
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
alerts.push(alert);
|
|
269
|
+
|
|
270
|
+
await fs.writeFile(alertsFile, JSON.stringify(alerts, null, 2));
|
|
271
|
+
} catch (error) {
|
|
272
|
+
console.error('Error saving alert:', error);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
async saveMetricsSnapshot() {
|
|
277
|
+
const summary = this.collector.getSummary();
|
|
278
|
+
const snapshotFile = path.join(__dirname, '../.metrics-snapshot');
|
|
279
|
+
|
|
280
|
+
try {
|
|
281
|
+
await fs.writeFile(snapshotFile, JSON.stringify(summary, null, 2));
|
|
282
|
+
} catch (error) {
|
|
283
|
+
console.error('Error saving metrics snapshot:', error);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
generateReport() {
|
|
288
|
+
const summary = this.collector.getSummary();
|
|
289
|
+
|
|
290
|
+
console.log('\n' + '='.repeat(80));
|
|
291
|
+
console.log('SDK MIGRATION MONITORING REPORT');
|
|
292
|
+
console.log('='.repeat(80));
|
|
293
|
+
|
|
294
|
+
console.log('\n📊 Performance Metrics:');
|
|
295
|
+
console.log(` Response Time (Avg): ${summary.performance.responseTime.avg.toFixed(0)}ms`);
|
|
296
|
+
console.log(` Response Time (P95): ${summary.performance.responseTime.p95.toFixed(0)}ms`);
|
|
297
|
+
console.log(` Error Rate: ${(summary.performance.errorRate * 100).toFixed(2)}%`);
|
|
298
|
+
console.log(` Cache Hit Rate: ${(summary.performance.cacheHitRate * 100).toFixed(1)}%`);
|
|
299
|
+
|
|
300
|
+
console.log('\n💰 Cost Metrics:');
|
|
301
|
+
console.log(` Total Tokens: ${summary.cost.totalTokens.toLocaleString()}`);
|
|
302
|
+
console.log(` Estimated Cost: $${summary.cost.estimatedCost.toFixed(2)}`);
|
|
303
|
+
console.log(` Cache Savings: $${summary.cost.savingsFromCache.toFixed(2)}`);
|
|
304
|
+
|
|
305
|
+
console.log('\n✅ Quality Metrics:');
|
|
306
|
+
console.log(` Validation Success: ${(summary.quality.validationSuccessRate * 100).toFixed(1)}%`);
|
|
307
|
+
console.log(` Test Pass Rate: ${summary.quality.averageTestPassRate.toFixed(1)}%`);
|
|
308
|
+
console.log(` Coverage: ${summary.quality.averageCoverage.toFixed(1)}%`);
|
|
309
|
+
|
|
310
|
+
console.log('\n🔔 Alerts:');
|
|
311
|
+
console.log(` Active: ${summary.alerts.active}`);
|
|
312
|
+
console.log(` Total: ${summary.alerts.total}`);
|
|
313
|
+
|
|
314
|
+
console.log('\n' + '='.repeat(80));
|
|
315
|
+
console.log(`Uptime: ${summary.uptime.formatted}`);
|
|
316
|
+
console.log(`Dashboard: http://localhost:${this.dashboard.config.port}`);
|
|
317
|
+
console.log('='.repeat(80) + '\n');
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// CLI
|
|
322
|
+
if (require.main === module) {
|
|
323
|
+
const monitor = new MigrationMonitor({
|
|
324
|
+
checkInterval: process.env.CHECK_INTERVAL || 60000,
|
|
325
|
+
dashboardPort: process.env.DASHBOARD_PORT || 3000
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
monitor.start().catch(err => {
|
|
329
|
+
console.error('Failed to start monitor:', err);
|
|
330
|
+
process.exit(1);
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
// Generate report every 5 minutes
|
|
334
|
+
setInterval(() => {
|
|
335
|
+
monitor.generateReport();
|
|
336
|
+
}, 300000);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
module.exports = MigrationMonitor;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
import subprocess
|
|
3
|
+
import time
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
|
|
6
|
+
ITERATIONS = 20
|
|
7
|
+
INTERVAL = 30
|
|
8
|
+
|
|
9
|
+
print("=== Memory Monitor Started ===")
|
|
10
|
+
print(f"Monitoring for {ITERATIONS * INTERVAL} seconds ({ITERATIONS} checks)")
|
|
11
|
+
print(f"Timestamp: {datetime.now()}")
|
|
12
|
+
print()
|
|
13
|
+
|
|
14
|
+
for i in range(1, ITERATIONS + 1):
|
|
15
|
+
timestamp = datetime.now().strftime('%H:%M:%S')
|
|
16
|
+
|
|
17
|
+
# Total memory
|
|
18
|
+
mem_cmd = "ps aux | grep -E '(claude|node)' | grep -v grep | awk '{sum+=$6} END {printf \"%.1f\", sum/1024}'"
|
|
19
|
+
total_mem = subprocess.getoutput(mem_cmd)
|
|
20
|
+
|
|
21
|
+
# Process counts
|
|
22
|
+
node_count = subprocess.getoutput("ps aux | grep node | grep -v grep | grep -v snapfuse | wc -l").strip()
|
|
23
|
+
claude_count = subprocess.getoutput("ps aux | grep claude | grep -v grep | wc -l").strip()
|
|
24
|
+
zombie_count = subprocess.getoutput("ps aux | grep '<defunct>' | grep -v grep | wc -l").strip()
|
|
25
|
+
find_count = subprocess.getoutput("ps aux | grep 'find /mnt/c' | grep -v grep | wc -l").strip()
|
|
26
|
+
|
|
27
|
+
print(f"[{i}/{ITERATIONS}] [{timestamp}] MEM: {total_mem}MB | Node: {node_count} | Claude: {claude_count} | Zombies: {zombie_count} | Find: {find_count}")
|
|
28
|
+
|
|
29
|
+
# Alerts
|
|
30
|
+
if total_mem and float(total_mem) > 10000:
|
|
31
|
+
print(" ⚠️ WARNING: Memory usage exceeds 10GB!")
|
|
32
|
+
|
|
33
|
+
if find_count and int(find_count) > 0:
|
|
34
|
+
print(f" 🔴 CRITICAL: {find_count} find commands on /mnt/c (MEMORY BOMB!)")
|
|
35
|
+
|
|
36
|
+
if zombie_count and int(zombie_count) > 0:
|
|
37
|
+
print(f" 💀 ZOMBIE: {zombie_count} zombie processes detected")
|
|
38
|
+
|
|
39
|
+
if i < ITERATIONS:
|
|
40
|
+
time.sleep(INTERVAL)
|
|
41
|
+
|
|
42
|
+
print()
|
|
43
|
+
print("=== Monitoring Complete ===")
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# Resource Monitoring Scripts
|
|
2
|
+
|
|
3
|
+
Real-time system resource monitoring for agent coordination tests.
|
|
4
|
+
|
|
5
|
+
## Scripts
|
|
6
|
+
|
|
7
|
+
### resource-monitor.sh
|
|
8
|
+
Collects system metrics every 1 second during test execution.
|
|
9
|
+
|
|
10
|
+
**Metrics Tracked:**
|
|
11
|
+
- Memory: RSS, VSZ, shared memory (tmpfs)
|
|
12
|
+
- CPU: Total usage across all node processes
|
|
13
|
+
- File Descriptors: Count of open FDs
|
|
14
|
+
- Processes: Total node/npm process count
|
|
15
|
+
- Disk I/O: Read/write operations (if available)
|
|
16
|
+
|
|
17
|
+
**Output:** CSV file with timestamped metrics
|
|
18
|
+
|
|
19
|
+
**Usage:**
|
|
20
|
+
```bash
|
|
21
|
+
./resource-monitor.sh [output_dir]
|
|
22
|
+
|
|
23
|
+
# Example
|
|
24
|
+
./resource-monitor.sh ./reports/monitoring
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**CSV Format:**
|
|
28
|
+
```
|
|
29
|
+
timestamp,elapsed_sec,memory_rss_mb,memory_vsz_mb,memory_shm_mb,cpu_percent,fd_count,process_count,node_processes,io_read_mb,io_write_mb
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### analyze-resources.sh
|
|
33
|
+
Analyzes monitoring CSV and detects anomalies.
|
|
34
|
+
|
|
35
|
+
**Analysis:**
|
|
36
|
+
- Peak resource usage
|
|
37
|
+
- Growth rates and trends
|
|
38
|
+
- Memory leak detection (>1 MB/sec growth)
|
|
39
|
+
- CPU spike detection (>80% sustained)
|
|
40
|
+
- FD leak detection (unclosed descriptors)
|
|
41
|
+
- Process leak detection (orphaned processes)
|
|
42
|
+
|
|
43
|
+
**Usage:**
|
|
44
|
+
```bash
|
|
45
|
+
./analyze-resources.sh <csv_file>
|
|
46
|
+
|
|
47
|
+
# Example
|
|
48
|
+
./analyze-resources.sh ./reports/monitoring/resource-usage-20250106_120000.csv
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Output:** Text report with anomaly summary
|
|
52
|
+
|
|
53
|
+
### monitor-test.sh
|
|
54
|
+
Wrapper script that monitors a test command.
|
|
55
|
+
|
|
56
|
+
**Features:**
|
|
57
|
+
- Starts monitor before test
|
|
58
|
+
- Runs test command
|
|
59
|
+
- Stops monitor after test
|
|
60
|
+
- Auto-analyzes results
|
|
61
|
+
|
|
62
|
+
**Usage:**
|
|
63
|
+
```bash
|
|
64
|
+
./monitor-test.sh "<test_command>"
|
|
65
|
+
|
|
66
|
+
# Example - Monitor 100-agent coordination test
|
|
67
|
+
./monitor-test.sh "bash tests/integration/100-agent-coordination.test.sh"
|
|
68
|
+
|
|
69
|
+
# Example - Monitor with npm
|
|
70
|
+
./monitor-test.sh "npm test -- tests/integration/100-agent-coordination.test.sh"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Leak Detection Thresholds
|
|
74
|
+
|
|
75
|
+
### Memory Leak
|
|
76
|
+
- **Critical**: Growth rate >1.0 MB/sec
|
|
77
|
+
- **Warning**: Growth rate >0.1 MB/sec
|
|
78
|
+
- **OK**: Growth rate ≤0.1 MB/sec
|
|
79
|
+
|
|
80
|
+
### CPU Spike
|
|
81
|
+
- **Critical**: >5 samples above 80% CPU
|
|
82
|
+
- **OK**: ≤5 samples above 80%
|
|
83
|
+
|
|
84
|
+
### File Descriptor Leak
|
|
85
|
+
- **Critical**: Growth >100 FDs
|
|
86
|
+
- **Warning**: Growth >20 FDs
|
|
87
|
+
- **OK**: Growth ≤20 FDs
|
|
88
|
+
|
|
89
|
+
### Process Leak
|
|
90
|
+
- **Critical**: Growth >50 processes
|
|
91
|
+
- **Warning**: Growth >10 processes
|
|
92
|
+
- **OK**: Growth ≤10 processes
|
|
93
|
+
|
|
94
|
+
## Example Workflow
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# 1. Monitor the 100-agent coordination test
|
|
98
|
+
cd /mnt/c/Users/masha/Documents/claude-flow-novice
|
|
99
|
+
./scripts/monitoring/monitor-test.sh "bash tests/integration/100-agent-coordination.test.sh"
|
|
100
|
+
|
|
101
|
+
# 2. Review results
|
|
102
|
+
ls -lh reports/monitoring/
|
|
103
|
+
|
|
104
|
+
# Output files:
|
|
105
|
+
# - resource-usage-20250106_120000.csv (raw metrics)
|
|
106
|
+
# - analysis-report-20250106_120500.txt (anomaly report)
|
|
107
|
+
# - monitor-20250106_120000.log (event log)
|
|
108
|
+
|
|
109
|
+
# 3. Review analysis report
|
|
110
|
+
cat reports/monitoring/analysis-report-*.txt
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Interpreting Results
|
|
114
|
+
|
|
115
|
+
### Healthy System
|
|
116
|
+
```
|
|
117
|
+
Memory Growth: 0.05 MB/sec
|
|
118
|
+
CPU Spikes: 2 samples above 80%
|
|
119
|
+
FD Growth: 5
|
|
120
|
+
Process Growth: 2
|
|
121
|
+
Anomalies: 0
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Memory Leak Detected
|
|
125
|
+
```
|
|
126
|
+
Memory Growth: 2.3 MB/sec ⚠️
|
|
127
|
+
CPU Spikes: 1 sample above 80%
|
|
128
|
+
FD Growth: 8
|
|
129
|
+
Process Growth: 3
|
|
130
|
+
Anomalies: 1
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Multiple Issues
|
|
134
|
+
```
|
|
135
|
+
Memory Growth: 1.5 MB/sec ⚠️
|
|
136
|
+
CPU Spikes: 12 samples above 80% ⚠️
|
|
137
|
+
FD Growth: 150 ⚠️
|
|
138
|
+
Process Growth: 75 ⚠️
|
|
139
|
+
Anomalies: 4
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Troubleshooting
|
|
143
|
+
|
|
144
|
+
### Monitor doesn't start
|
|
145
|
+
```bash
|
|
146
|
+
# Check permissions
|
|
147
|
+
chmod +x scripts/monitoring/*.sh
|
|
148
|
+
|
|
149
|
+
# Check dependencies
|
|
150
|
+
which bc ps awk
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### No data in CSV
|
|
154
|
+
```bash
|
|
155
|
+
# Check if node processes exist
|
|
156
|
+
pgrep -f node
|
|
157
|
+
|
|
158
|
+
# Verify output directory
|
|
159
|
+
ls -la reports/monitoring/
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Analysis fails
|
|
163
|
+
```bash
|
|
164
|
+
# Verify CSV format
|
|
165
|
+
head -5 reports/monitoring/resource-usage-*.csv
|
|
166
|
+
|
|
167
|
+
# Check for bc utility
|
|
168
|
+
which bc || sudo apt-get install bc
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Integration with Tests
|
|
172
|
+
|
|
173
|
+
The monitoring scripts are designed to work with:
|
|
174
|
+
- `tests/integration/100-agent-coordination.test.sh`
|
|
175
|
+
- `tests/performance/phase1-overhead-benchmark.sh`
|
|
176
|
+
- Any long-running agent coordination tests
|
|
177
|
+
|
|
178
|
+
Monitor results should be reviewed for each major test run to ensure system stability.
|