proagents 1.6.17 → 1.6.19
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/.claude/settings.local.json +169 -0
- package/.proagents/AGENTS.md +2 -0
- package/.proagents/AI_INSTRUCTIONS.md +13 -0
- package/.proagents/ANTIGRAVITY.md +2 -0
- package/.proagents/BOLT.md +2 -0
- package/.proagents/CHATGPT.md +2 -0
- package/.proagents/CLAUDE.md +2 -0
- package/.proagents/GEMINI.md +2 -0
- package/.proagents/GROQ.md +2 -0
- package/.proagents/KIRO.md +2 -0
- package/.proagents/LOVABLE.md +2 -0
- package/.proagents/PROAGENTS.md +2 -0
- package/.proagents/REPLIT.md +2 -0
- package/.proagents/prompts/00-project-setup.md +878 -0
- package/.proagents/prompts/04-planning.md +38 -0
- package/.proagents/prompts/12-rnd.md +957 -0
- package/.proagents/workflow-modes/entry-modes.md +27 -0
- package/.proagents/worklog/_context.template.md +47 -0
- package/COMMANDS.md +654 -0
- package/README.md +16 -24
- package/package.json +2 -7
- package/.proagents/ai-models/README.md +0 -141
- package/.proagents/ai-models/cost-management.md +0 -362
- package/.proagents/ai-models/fallbacks.md +0 -342
- package/.proagents/ai-models/model-config.md +0 -318
- package/.proagents/ai-models/task-routing.md +0 -503
- package/.proagents/ai-training/README.md +0 -155
- package/.proagents/ai-training/continuous-learning.md +0 -413
- package/.proagents/ai-training/domain-knowledge.md +0 -378
- package/.proagents/ai-training/pattern-learning.md +0 -455
- package/.proagents/ai-training/training-data.md +0 -337
- package/.proagents/ai-training/user-preferences.md +0 -346
- package/.proagents/approval-workflows/README.md +0 -146
- package/.proagents/approval-workflows/approval-config.md +0 -332
- package/.proagents/approval-workflows/approval-stages.md +0 -503
- package/.proagents/approval-workflows/emergency-bypass.md +0 -351
- package/.proagents/approval-workflows/examples.md +0 -859
- package/.proagents/approval-workflows/notifications.md +0 -320
- package/.proagents/compliance/README.md +0 -206
- package/.proagents/compliance/access-control.md +0 -310
- package/.proagents/compliance/audit-logging.md +0 -444
- package/.proagents/compliance/compliance-frameworks.md +0 -429
- package/.proagents/compliance/reports.md +0 -491
- package/.proagents/compliance/retention-policies.md +0 -454
- package/.proagents/config-versioning/README.md +0 -120
- package/.proagents/config-versioning/changelog.md +0 -300
- package/.proagents/config-versioning/rollback.md +0 -283
- package/.proagents/config-versioning/versioning.md +0 -330
- package/.proagents/contract-testing/README.md +0 -223
- package/.proagents/contract-testing/contract-testing.md +0 -614
- package/.proagents/contract-testing/pact-integration.md +0 -507
- package/.proagents/contract-testing/schema-validation.md +0 -565
- package/.proagents/dependency-management/README.md +0 -140
- package/.proagents/dependency-management/automation.md +0 -363
- package/.proagents/dependency-management/compatibility.md +0 -319
- package/.proagents/dependency-management/security-scanning.md +0 -413
- package/.proagents/dependency-management/update-policies.md +0 -374
- package/.proagents/disaster-recovery/README.md +0 -247
- package/.proagents/disaster-recovery/automation.md +0 -366
- package/.proagents/disaster-recovery/backup-recovery.md +0 -571
- package/.proagents/disaster-recovery/incident-response.md +0 -565
- package/.proagents/disaster-recovery/rollback-procedures.md +0 -499
- package/.proagents/disaster-recovery/runbooks.md +0 -603
- package/.proagents/disaster-recovery/scenarios.md +0 -892
- package/.proagents/disaster-recovery/testing.md +0 -438
- package/.proagents/environments/README.md +0 -244
- package/.proagents/environments/configuration.md +0 -437
- package/.proagents/environments/promotion.md +0 -434
- package/.proagents/environments/setup.md +0 -420
- package/.proagents/examples/README.md +0 -55
- package/.proagents/examples/backend-nodejs/README.md +0 -188
- package/.proagents/examples/backend-nodejs/complete-conversation.md +0 -601
- package/.proagents/examples/backend-nodejs/proagents.config.yaml +0 -415
- package/.proagents/examples/backend-nodejs/workflow-example.md +0 -909
- package/.proagents/examples/fullstack-nextjs/README.md +0 -155
- package/.proagents/examples/fullstack-nextjs/complete-conversation.md +0 -604
- package/.proagents/examples/fullstack-nextjs/proagents.config.yaml +0 -287
- package/.proagents/examples/fullstack-nextjs/workflow-example.md +0 -553
- package/.proagents/examples/mobile-react-native/README.md +0 -171
- package/.proagents/examples/mobile-react-native/complete-conversation.md +0 -825
- package/.proagents/examples/mobile-react-native/proagents.config.yaml +0 -330
- package/.proagents/examples/mobile-react-native/workflow-example.md +0 -723
- package/.proagents/examples/web-frontend-react/README.md +0 -125
- package/.proagents/examples/web-frontend-react/complete-conversation.md +0 -556
- package/.proagents/examples/web-frontend-react/proagents.config.yaml +0 -183
- package/.proagents/examples/web-frontend-react/workflow-example.md +0 -603
- package/.proagents/existing-projects/README.md +0 -65
- package/.proagents/existing-projects/challenges.md +0 -861
- package/.proagents/existing-projects/coexistence-mode.md +0 -483
- package/.proagents/existing-projects/compatibility-assessment.md +0 -541
- package/.proagents/existing-projects/gradual-adoption.md +0 -515
- package/.proagents/existing-projects/migration-strategies.md +0 -788
- package/.proagents/existing-projects/pattern-reconciliation.md +0 -489
- package/.proagents/existing-projects/team-onboarding.md +0 -617
- package/.proagents/existing-projects/technical-debt-handling.md +0 -644
- package/.proagents/feature-flags/README.md +0 -263
- package/.proagents/feature-flags/ab-testing.md +0 -413
- package/.proagents/feature-flags/configuration.md +0 -420
- package/.proagents/feature-flags/kill-switches.md +0 -444
- package/.proagents/feature-flags/rollout-strategies.md +0 -392
- package/.proagents/history.log +0 -12
- package/.proagents/i18n/README.md +0 -133
- package/.proagents/i18n/extraction.md +0 -433
- package/.proagents/i18n/tms-integration.md +0 -332
- package/.proagents/i18n/translation-workflow.md +0 -413
- package/.proagents/i18n/validation.md +0 -355
- package/.proagents/logging/README.md +0 -276
- package/.proagents/logging/aggregation.md +0 -475
- package/.proagents/logging/log-levels.md +0 -376
- package/.proagents/logging/sensitive-data.md +0 -423
- package/.proagents/logging/structured-logging.md +0 -406
- package/.proagents/metrics/README.md +0 -69
- package/.proagents/metrics/code-quality-kpis.md +0 -461
- package/.proagents/metrics/deployment-metrics.md +0 -517
- package/.proagents/metrics/developer-productivity.md +0 -368
- package/.proagents/metrics/learning-effectiveness.md +0 -478
- package/.proagents/migrations/README.md +0 -77
- package/.proagents/migrations/from-claude-projects.md +0 -313
- package/.proagents/migrations/from-cursor-rules.md +0 -345
- package/.proagents/migrations/from-custom-workflows.md +0 -410
- package/.proagents/monitoring/README.md +0 -308
- package/.proagents/monitoring/alerting.md +0 -449
- package/.proagents/monitoring/dashboards.md +0 -454
- package/.proagents/monitoring/health-checks.md +0 -436
- package/.proagents/monitoring/metrics.md +0 -434
- package/.proagents/multi-project/README.md +0 -170
- package/.proagents/multi-project/coordinated-deploy.md +0 -510
- package/.proagents/multi-project/cross-project-deps.md +0 -395
- package/.proagents/multi-project/unified-changelog.md +0 -477
- package/.proagents/multi-project/walkthroughs/monorepo-setup.md +0 -787
- package/.proagents/multi-project/workspace-config.md +0 -408
- package/.proagents/notifications/README.md +0 -151
- package/.proagents/notifications/channels.md +0 -457
- package/.proagents/notifications/preferences.md +0 -415
- package/.proagents/notifications/routing.md +0 -449
- package/.proagents/notifications/scheduling.md +0 -425
- package/.proagents/notifications/templates.md +0 -446
- package/.proagents/offline-mode/README.md +0 -145
- package/.proagents/offline-mode/caching.md +0 -344
- package/.proagents/offline-mode/offline-operations.md +0 -312
- package/.proagents/offline-mode/queue-specifications.md +0 -679
- package/.proagents/offline-mode/sync.md +0 -475
- package/.proagents/parallel-features/README.md +0 -85
- package/.proagents/parallel-features/conflict-detection.md +0 -226
- package/.proagents/parallel-features/dependency-management.md +0 -392
- package/.proagents/parallel-features/merge-coordination.md +0 -506
- package/.proagents/parallel-features/tracking-system.md +0 -416
- package/.proagents/performance/README.md +0 -59
- package/.proagents/performance/bundle-analysis.md +0 -375
- package/.proagents/performance/load-testing.md +0 -563
- package/.proagents/performance/runtime-metrics.md +0 -489
- package/.proagents/performance/web-vitals.md +0 -425
- package/.proagents/plugins/README.md +0 -139
- package/.proagents/plugins/creating-plugins.md +0 -504
- package/.proagents/plugins/plugin-api.md +0 -467
- package/.proagents/plugins/plugin-registry.md +0 -276
- package/.proagents/reporting/README.md +0 -158
- package/.proagents/reporting/dashboards.md +0 -366
- package/.proagents/reporting/exports.md +0 -524
- package/.proagents/reporting/quality-metrics.md +0 -385
- package/.proagents/reporting/templates/README.md +0 -56
- package/.proagents/reporting/templates/dashboard-config.json +0 -187
- package/.proagents/reporting/templates/metrics-queries.md +0 -427
- package/.proagents/reporting/templates/react-dashboard.tsx +0 -544
- package/.proagents/reporting/templates/widgets.md +0 -451
- package/.proagents/reporting/velocity-metrics.md +0 -340
- package/.proagents/reverse-engineering/README.md +0 -151
- package/.proagents/reverse-engineering/architecture-extraction.md +0 -325
- package/.proagents/reverse-engineering/code-analysis.md +0 -377
- package/.proagents/reverse-engineering/dependency-mapping.md +0 -567
- package/.proagents/reverse-engineering/diagram-generation.md +0 -586
- package/.proagents/reverse-engineering/documentation-generation.md +0 -468
- package/.proagents/reverse-engineering/pattern-detection.md +0 -569
- package/.proagents/reverse-engineering/quality-assessment.md +0 -733
- package/.proagents/secrets/README.md +0 -278
- package/.proagents/secrets/access-control.md +0 -443
- package/.proagents/secrets/rotation.md +0 -403
- package/.proagents/secrets/scanning.md +0 -487
- package/.proagents/secrets/storage.md +0 -394
- package/.proagents/webhooks/README.md +0 -126
- package/.proagents/webhooks/endpoints.md +0 -298
- package/.proagents/webhooks/events.md +0 -316
- package/.proagents/webhooks/payloads.md +0 -325
- package/.proagents/webhooks/reliability.md +0 -363
- package/.proagents/webhooks/security.md +0 -380
|
@@ -1,489 +0,0 @@
|
|
|
1
|
-
# Runtime Performance Metrics
|
|
2
|
-
|
|
3
|
-
Monitor and measure application performance during execution.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Overview
|
|
8
|
-
|
|
9
|
-
Runtime metrics help:
|
|
10
|
-
- Identify performance bottlenecks
|
|
11
|
-
- Track performance over time
|
|
12
|
-
- Alert on degradation
|
|
13
|
-
- Guide optimization efforts
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## Key Metrics Categories
|
|
18
|
-
|
|
19
|
-
### 1. Response Time Metrics
|
|
20
|
-
|
|
21
|
-
```yaml
|
|
22
|
-
response_time:
|
|
23
|
-
targets:
|
|
24
|
-
p50: 100ms # 50th percentile (median)
|
|
25
|
-
p95: 300ms # 95th percentile
|
|
26
|
-
p99: 500ms # 99th percentile
|
|
27
|
-
max: 2000ms # Maximum acceptable
|
|
28
|
-
|
|
29
|
-
by_endpoint:
|
|
30
|
-
"/api/users":
|
|
31
|
-
p50: 45ms
|
|
32
|
-
p95: 120ms
|
|
33
|
-
p99: 250ms
|
|
34
|
-
status: "healthy"
|
|
35
|
-
|
|
36
|
-
"/api/users/:id":
|
|
37
|
-
p50: 35ms
|
|
38
|
-
p95: 80ms
|
|
39
|
-
p99: 150ms
|
|
40
|
-
status: "healthy"
|
|
41
|
-
|
|
42
|
-
"/api/reports/generate":
|
|
43
|
-
p50: 1200ms
|
|
44
|
-
p95: 3500ms
|
|
45
|
-
p99: 8000ms
|
|
46
|
-
status: "needs_optimization"
|
|
47
|
-
|
|
48
|
-
alerts:
|
|
49
|
-
warning_threshold: "p95 > 500ms"
|
|
50
|
-
critical_threshold: "p99 > 2000ms"
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### 2. Throughput Metrics
|
|
54
|
-
|
|
55
|
-
```yaml
|
|
56
|
-
throughput:
|
|
57
|
-
requests_per_second:
|
|
58
|
-
current: 450
|
|
59
|
-
peak: 1200
|
|
60
|
-
target: 1000
|
|
61
|
-
|
|
62
|
-
by_endpoint:
|
|
63
|
-
"/api/users": 150 rps
|
|
64
|
-
"/api/auth/login": 50 rps
|
|
65
|
-
"/api/posts": 200 rps
|
|
66
|
-
|
|
67
|
-
capacity:
|
|
68
|
-
current_utilization: 45%
|
|
69
|
-
headroom: 55%
|
|
70
|
-
estimated_max: 1000 rps
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
### 3. Error Rate Metrics
|
|
74
|
-
|
|
75
|
-
```yaml
|
|
76
|
-
error_rates:
|
|
77
|
-
overall: 0.5%
|
|
78
|
-
target: "<1%"
|
|
79
|
-
|
|
80
|
-
by_type:
|
|
81
|
-
"4xx": 0.3%
|
|
82
|
-
"5xx": 0.2%
|
|
83
|
-
|
|
84
|
-
by_endpoint:
|
|
85
|
-
"/api/users":
|
|
86
|
-
error_rate: 0.1%
|
|
87
|
-
status: "healthy"
|
|
88
|
-
|
|
89
|
-
"/api/payments":
|
|
90
|
-
error_rate: 1.5%
|
|
91
|
-
status: "needs_attention"
|
|
92
|
-
top_errors:
|
|
93
|
-
- "Payment gateway timeout": 45%
|
|
94
|
-
- "Invalid card": 30%
|
|
95
|
-
- "Internal error": 25%
|
|
96
|
-
|
|
97
|
-
alerts:
|
|
98
|
-
warning: ">1%"
|
|
99
|
-
critical: ">5%"
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### 4. Resource Utilization
|
|
103
|
-
|
|
104
|
-
```yaml
|
|
105
|
-
resources:
|
|
106
|
-
cpu:
|
|
107
|
-
average: 35%
|
|
108
|
-
peak: 75%
|
|
109
|
-
target: "<70%"
|
|
110
|
-
|
|
111
|
-
memory:
|
|
112
|
-
used: "2.1GB"
|
|
113
|
-
available: "4GB"
|
|
114
|
-
utilization: 52%
|
|
115
|
-
heap_used: "1.8GB"
|
|
116
|
-
heap_limit: "3GB"
|
|
117
|
-
|
|
118
|
-
connections:
|
|
119
|
-
database:
|
|
120
|
-
active: 25
|
|
121
|
-
idle: 5
|
|
122
|
-
max: 100
|
|
123
|
-
utilization: 25%
|
|
124
|
-
|
|
125
|
-
redis:
|
|
126
|
-
active: 10
|
|
127
|
-
max: 50
|
|
128
|
-
utilization: 20%
|
|
129
|
-
|
|
130
|
-
event_loop:
|
|
131
|
-
lag: "2ms"
|
|
132
|
-
target: "<10ms"
|
|
133
|
-
status: "healthy"
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
---
|
|
137
|
-
|
|
138
|
-
## Monitoring Implementation
|
|
139
|
-
|
|
140
|
-
### 1. Node.js Performance Monitoring
|
|
141
|
-
|
|
142
|
-
```typescript
|
|
143
|
-
// src/lib/metrics.ts
|
|
144
|
-
import { performance, PerformanceObserver } from 'perf_hooks';
|
|
145
|
-
import { Counter, Histogram, Gauge, Registry } from 'prom-client';
|
|
146
|
-
|
|
147
|
-
// Create metrics registry
|
|
148
|
-
const register = new Registry();
|
|
149
|
-
|
|
150
|
-
// HTTP request duration histogram
|
|
151
|
-
const httpRequestDuration = new Histogram({
|
|
152
|
-
name: 'http_request_duration_seconds',
|
|
153
|
-
help: 'Duration of HTTP requests in seconds',
|
|
154
|
-
labelNames: ['method', 'route', 'status_code'],
|
|
155
|
-
buckets: [0.01, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10],
|
|
156
|
-
registers: [register],
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
// Request counter
|
|
160
|
-
const httpRequestsTotal = new Counter({
|
|
161
|
-
name: 'http_requests_total',
|
|
162
|
-
help: 'Total number of HTTP requests',
|
|
163
|
-
labelNames: ['method', 'route', 'status_code'],
|
|
164
|
-
registers: [register],
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
// Active connections gauge
|
|
168
|
-
const activeConnections = new Gauge({
|
|
169
|
-
name: 'active_connections',
|
|
170
|
-
help: 'Number of active connections',
|
|
171
|
-
registers: [register],
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
// Error counter
|
|
175
|
-
const errorsTotal = new Counter({
|
|
176
|
-
name: 'errors_total',
|
|
177
|
-
help: 'Total number of errors',
|
|
178
|
-
labelNames: ['type', 'route'],
|
|
179
|
-
registers: [register],
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
// Middleware for Express
|
|
183
|
-
export function metricsMiddleware(req, res, next) {
|
|
184
|
-
const start = performance.now();
|
|
185
|
-
|
|
186
|
-
res.on('finish', () => {
|
|
187
|
-
const duration = (performance.now() - start) / 1000;
|
|
188
|
-
const route = req.route?.path || req.path;
|
|
189
|
-
|
|
190
|
-
httpRequestDuration.observe(
|
|
191
|
-
{ method: req.method, route, status_code: res.statusCode },
|
|
192
|
-
duration
|
|
193
|
-
);
|
|
194
|
-
|
|
195
|
-
httpRequestsTotal.inc({
|
|
196
|
-
method: req.method,
|
|
197
|
-
route,
|
|
198
|
-
status_code: res.statusCode,
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
if (res.statusCode >= 400) {
|
|
202
|
-
errorsTotal.inc({
|
|
203
|
-
type: res.statusCode >= 500 ? 'server' : 'client',
|
|
204
|
-
route,
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
next();
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
export { register, httpRequestDuration, httpRequestsTotal, activeConnections };
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
### 2. Database Query Monitoring
|
|
216
|
-
|
|
217
|
-
```typescript
|
|
218
|
-
// src/lib/db-metrics.ts
|
|
219
|
-
import { Histogram, Counter } from 'prom-client';
|
|
220
|
-
|
|
221
|
-
const queryDuration = new Histogram({
|
|
222
|
-
name: 'db_query_duration_seconds',
|
|
223
|
-
help: 'Duration of database queries',
|
|
224
|
-
labelNames: ['operation', 'table'],
|
|
225
|
-
buckets: [0.001, 0.005, 0.01, 0.05, 0.1, 0.5, 1, 5],
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
const slowQueries = new Counter({
|
|
229
|
-
name: 'db_slow_queries_total',
|
|
230
|
-
help: 'Number of slow queries (>100ms)',
|
|
231
|
-
labelNames: ['operation', 'table'],
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
// Prisma middleware for query monitoring
|
|
235
|
-
export const prismaMetrics = {
|
|
236
|
-
async $use(params, next) {
|
|
237
|
-
const start = performance.now();
|
|
238
|
-
const result = await next(params);
|
|
239
|
-
const duration = (performance.now() - start) / 1000;
|
|
240
|
-
|
|
241
|
-
queryDuration.observe(
|
|
242
|
-
{ operation: params.action, table: params.model },
|
|
243
|
-
duration
|
|
244
|
-
);
|
|
245
|
-
|
|
246
|
-
if (duration > 0.1) {
|
|
247
|
-
slowQueries.inc({ operation: params.action, table: params.model });
|
|
248
|
-
console.warn(`Slow query: ${params.model}.${params.action} took ${duration}s`);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
return result;
|
|
252
|
-
},
|
|
253
|
-
};
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
### 3. Memory Monitoring
|
|
257
|
-
|
|
258
|
-
```typescript
|
|
259
|
-
// src/lib/memory-metrics.ts
|
|
260
|
-
import { Gauge } from 'prom-client';
|
|
261
|
-
|
|
262
|
-
const memoryUsage = new Gauge({
|
|
263
|
-
name: 'nodejs_memory_usage_bytes',
|
|
264
|
-
help: 'Memory usage in bytes',
|
|
265
|
-
labelNames: ['type'],
|
|
266
|
-
});
|
|
267
|
-
|
|
268
|
-
const eventLoopLag = new Gauge({
|
|
269
|
-
name: 'nodejs_eventloop_lag_seconds',
|
|
270
|
-
help: 'Event loop lag in seconds',
|
|
271
|
-
});
|
|
272
|
-
|
|
273
|
-
// Collect memory metrics every 10 seconds
|
|
274
|
-
setInterval(() => {
|
|
275
|
-
const mem = process.memoryUsage();
|
|
276
|
-
memoryUsage.set({ type: 'heapUsed' }, mem.heapUsed);
|
|
277
|
-
memoryUsage.set({ type: 'heapTotal' }, mem.heapTotal);
|
|
278
|
-
memoryUsage.set({ type: 'rss' }, mem.rss);
|
|
279
|
-
memoryUsage.set({ type: 'external' }, mem.external);
|
|
280
|
-
}, 10000);
|
|
281
|
-
|
|
282
|
-
// Measure event loop lag
|
|
283
|
-
let lastCheck = process.hrtime.bigint();
|
|
284
|
-
setInterval(() => {
|
|
285
|
-
const now = process.hrtime.bigint();
|
|
286
|
-
const lag = Number(now - lastCheck) / 1e9 - 0.1; // Subtract expected 100ms
|
|
287
|
-
eventLoopLag.set(Math.max(0, lag));
|
|
288
|
-
lastCheck = now;
|
|
289
|
-
}, 100);
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
---
|
|
293
|
-
|
|
294
|
-
## Metrics Dashboard
|
|
295
|
-
|
|
296
|
-
```yaml
|
|
297
|
-
dashboard:
|
|
298
|
-
overview:
|
|
299
|
-
- metric: "Request Rate"
|
|
300
|
-
value: "450 req/s"
|
|
301
|
-
trend: "+5%"
|
|
302
|
-
status: "healthy"
|
|
303
|
-
|
|
304
|
-
- metric: "Error Rate"
|
|
305
|
-
value: "0.5%"
|
|
306
|
-
trend: "-10%"
|
|
307
|
-
status: "healthy"
|
|
308
|
-
|
|
309
|
-
- metric: "P95 Latency"
|
|
310
|
-
value: "120ms"
|
|
311
|
-
trend: "+15ms"
|
|
312
|
-
status: "warning"
|
|
313
|
-
|
|
314
|
-
- metric: "CPU Usage"
|
|
315
|
-
value: "35%"
|
|
316
|
-
trend: "stable"
|
|
317
|
-
status: "healthy"
|
|
318
|
-
|
|
319
|
-
charts:
|
|
320
|
-
- name: "Request Latency Distribution"
|
|
321
|
-
type: "histogram"
|
|
322
|
-
data: "http_request_duration_seconds"
|
|
323
|
-
|
|
324
|
-
- name: "Requests Over Time"
|
|
325
|
-
type: "line"
|
|
326
|
-
data: "rate(http_requests_total[5m])"
|
|
327
|
-
|
|
328
|
-
- name: "Error Rate"
|
|
329
|
-
type: "line"
|
|
330
|
-
data: "rate(errors_total[5m])"
|
|
331
|
-
|
|
332
|
-
- name: "Memory Usage"
|
|
333
|
-
type: "area"
|
|
334
|
-
data: "nodejs_memory_usage_bytes"
|
|
335
|
-
```
|
|
336
|
-
|
|
337
|
-
**Visual Dashboard:**
|
|
338
|
-
```
|
|
339
|
-
┌─────────────────────────────────────────────────────────────┐
|
|
340
|
-
│ Performance Dashboard │
|
|
341
|
-
├──────────────────┬──────────────────┬──────────────────────┤
|
|
342
|
-
│ Request Rate │ Error Rate │ P95 Latency │
|
|
343
|
-
│ 450 req/s │ 0.5% │ 120ms │
|
|
344
|
-
│ ↑ +5% │ ↓ -10% │ ↑ +15ms │
|
|
345
|
-
│ ✅ │ ✅ │ ⚠️ │
|
|
346
|
-
├──────────────────┴──────────────────┴──────────────────────┤
|
|
347
|
-
│ │
|
|
348
|
-
│ Request Latency (last hour) │
|
|
349
|
-
│ ┌─────────────────────────────────────────────────────┐ │
|
|
350
|
-
│ │ ╭──╮ ╭─╮ │ │
|
|
351
|
-
│ │ ╭╯ ╰╮ ╭╯ ╰╮ ╭──╮ │ │
|
|
352
|
-
│ │──╯ ╰────╯ ╰────╯ ╰────────────────────── │ │
|
|
353
|
-
│ │ │ │
|
|
354
|
-
│ └─────────────────────────────────────────────────────┘ │
|
|
355
|
-
│ │
|
|
356
|
-
│ Slowest Endpoints Error Distribution │
|
|
357
|
-
│ ┌───────────────────────┐ ┌──────────────────┐ │
|
|
358
|
-
│ │ /api/reports 1200ms │ │ 4xx ████████ 60% │ │
|
|
359
|
-
│ │ /api/search 450ms │ │ 5xx ████ 40% │ │
|
|
360
|
-
│ │ /api/export 380ms │ └──────────────────┘ │
|
|
361
|
-
│ └───────────────────────┘ │
|
|
362
|
-
└─────────────────────────────────────────────────────────────┘
|
|
363
|
-
```
|
|
364
|
-
|
|
365
|
-
---
|
|
366
|
-
|
|
367
|
-
## Alerting Rules
|
|
368
|
-
|
|
369
|
-
```yaml
|
|
370
|
-
# prometheus/alerts.yml
|
|
371
|
-
groups:
|
|
372
|
-
- name: performance
|
|
373
|
-
rules:
|
|
374
|
-
- alert: HighLatency
|
|
375
|
-
expr: histogram_quantile(0.95, http_request_duration_seconds) > 0.5
|
|
376
|
-
for: 5m
|
|
377
|
-
labels:
|
|
378
|
-
severity: warning
|
|
379
|
-
annotations:
|
|
380
|
-
summary: "High latency detected"
|
|
381
|
-
description: "P95 latency is above 500ms"
|
|
382
|
-
|
|
383
|
-
- alert: HighErrorRate
|
|
384
|
-
expr: rate(errors_total[5m]) / rate(http_requests_total[5m]) > 0.05
|
|
385
|
-
for: 2m
|
|
386
|
-
labels:
|
|
387
|
-
severity: critical
|
|
388
|
-
annotations:
|
|
389
|
-
summary: "High error rate"
|
|
390
|
-
description: "Error rate is above 5%"
|
|
391
|
-
|
|
392
|
-
- alert: HighMemoryUsage
|
|
393
|
-
expr: nodejs_memory_usage_bytes{type="heapUsed"} / nodejs_memory_usage_bytes{type="heapTotal"} > 0.9
|
|
394
|
-
for: 10m
|
|
395
|
-
labels:
|
|
396
|
-
severity: warning
|
|
397
|
-
annotations:
|
|
398
|
-
summary: "High memory usage"
|
|
399
|
-
description: "Heap usage is above 90%"
|
|
400
|
-
|
|
401
|
-
- alert: SlowQueries
|
|
402
|
-
expr: rate(db_slow_queries_total[5m]) > 10
|
|
403
|
-
for: 5m
|
|
404
|
-
labels:
|
|
405
|
-
severity: warning
|
|
406
|
-
annotations:
|
|
407
|
-
summary: "Slow database queries"
|
|
408
|
-
description: "More than 10 slow queries per minute"
|
|
409
|
-
```
|
|
410
|
-
|
|
411
|
-
---
|
|
412
|
-
|
|
413
|
-
## Performance Baseline
|
|
414
|
-
|
|
415
|
-
```yaml
|
|
416
|
-
baseline:
|
|
417
|
-
established: "2024-01-01"
|
|
418
|
-
environment: "production"
|
|
419
|
-
|
|
420
|
-
metrics:
|
|
421
|
-
response_time:
|
|
422
|
-
p50: 45ms
|
|
423
|
-
p95: 120ms
|
|
424
|
-
p99: 250ms
|
|
425
|
-
|
|
426
|
-
throughput:
|
|
427
|
-
average: 400 rps
|
|
428
|
-
peak: 1000 rps
|
|
429
|
-
|
|
430
|
-
error_rate: 0.3%
|
|
431
|
-
|
|
432
|
-
resources:
|
|
433
|
-
cpu_average: 30%
|
|
434
|
-
memory_average: 50%
|
|
435
|
-
|
|
436
|
-
comparison:
|
|
437
|
-
current_vs_baseline:
|
|
438
|
-
response_time_p95: "+8%" # 120ms → 130ms
|
|
439
|
-
throughput: "+12%" # 400 → 450 rps
|
|
440
|
-
error_rate: "+67%" # 0.3% → 0.5%
|
|
441
|
-
```
|
|
442
|
-
|
|
443
|
-
---
|
|
444
|
-
|
|
445
|
-
## Configuration
|
|
446
|
-
|
|
447
|
-
```yaml
|
|
448
|
-
# proagents.config.yaml
|
|
449
|
-
|
|
450
|
-
performance:
|
|
451
|
-
runtime_metrics:
|
|
452
|
-
enabled: true
|
|
453
|
-
|
|
454
|
-
collect:
|
|
455
|
-
- response_time
|
|
456
|
-
- throughput
|
|
457
|
-
- error_rate
|
|
458
|
-
- cpu_usage
|
|
459
|
-
- memory_usage
|
|
460
|
-
- database_queries
|
|
461
|
-
- event_loop_lag
|
|
462
|
-
|
|
463
|
-
endpoints:
|
|
464
|
-
metrics: "/metrics" # Prometheus format
|
|
465
|
-
health: "/health"
|
|
466
|
-
|
|
467
|
-
targets:
|
|
468
|
-
response_time_p95: 300ms
|
|
469
|
-
error_rate: 1%
|
|
470
|
-
cpu_usage: 70%
|
|
471
|
-
|
|
472
|
-
alerting:
|
|
473
|
-
enabled: true
|
|
474
|
-
channels:
|
|
475
|
-
- slack
|
|
476
|
-
- pagerduty
|
|
477
|
-
```
|
|
478
|
-
|
|
479
|
-
---
|
|
480
|
-
|
|
481
|
-
## Commands
|
|
482
|
-
|
|
483
|
-
| Command | Description |
|
|
484
|
-
|---------|-------------|
|
|
485
|
-
| `pa:perf-metrics` | View current metrics |
|
|
486
|
-
| `pa:perf-metrics --endpoint [path]` | Metrics for specific endpoint |
|
|
487
|
-
| `pa:perf-metrics --baseline` | Compare to baseline |
|
|
488
|
-
| `pa:perf-metrics --slow` | List slow endpoints |
|
|
489
|
-
| `pa:perf-metrics --alerts` | View active alerts |
|