Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 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 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | /**
* Admin Monitoring Endpoints
* Error tracking, alerts, performance metrics, and observability
*/
import type { ApiEndpoint } from '@/types/api-docs';
export const adminMonitoringEndpoints: ApiEndpoint[] = [
// Alerts
{
id: 'admin-monitoring-alerts-list',
method: 'GET',
path: '/api/admin/monitoring/alerts',
summary: 'List monitoring alerts',
description: 'Returns all monitoring alerts with optional filtering',
category: 'admin-monitoring',
requiresAuth: true,
adminOnly: true,
parameters: [
{ name: 'status', type: 'string', required: false, location: 'query', description: 'Filter by status', enum: ['active', 'acknowledged', 'resolved'] },
{ name: 'severity', type: 'string', required: false, location: 'query', description: 'Filter by severity', enum: ['critical', 'warning', 'info'] },
{ name: 'limit', type: 'number', required: false, location: 'query', description: 'Number of alerts to return' },
],
responses: [
{ status: 200, description: 'List of alerts', example: { success: true, data: { alerts: [], total: 0 } } },
{ status: 403, description: 'Admin access required' },
],
},
{
id: 'admin-monitoring-alerts-create',
method: 'POST',
path: '/api/admin/monitoring/alerts',
summary: 'Create monitoring alert rule',
description: 'Creates a new alert rule for monitoring',
category: 'admin-monitoring',
requiresAuth: true,
adminOnly: true,
requestBody: {
contentType: 'application/json',
fields: [
{ name: 'name', type: 'string', required: true, description: 'Alert name' },
{ name: 'metric', type: 'string', required: true, description: 'Metric to monitor' },
{ name: 'condition', type: 'string', required: true, description: 'Alert condition' },
{ name: 'threshold', type: 'number', required: true, description: 'Threshold value' },
{ name: 'severity', type: 'string', required: true, description: 'Alert severity' },
],
},
responses: [
{ status: 201, description: 'Alert created' },
{ status: 400, description: 'Invalid alert configuration' },
],
},
{
id: 'admin-monitoring-alerts-get',
method: 'GET',
path: '/api/admin/monitoring/alerts/{id}',
summary: 'Get alert details',
description: 'Returns details of a specific alert',
category: 'admin-monitoring',
requiresAuth: true,
adminOnly: true,
parameters: [
{ name: 'id', type: 'string', required: true, location: 'path', description: 'Alert ID' },
],
responses: [
{ status: 200, description: 'Alert details' },
{ status: 404, description: 'Alert not found' },
],
},
{
id: 'admin-monitoring-alerts-update',
method: 'PATCH',
path: '/api/admin/monitoring/alerts/{id}',
summary: 'Update alert',
description: 'Updates an existing alert configuration',
category: 'admin-monitoring',
requiresAuth: true,
adminOnly: true,
parameters: [
{ name: 'id', type: 'string', required: true, location: 'path', description: 'Alert ID' },
],
requestBody: {
contentType: 'application/json',
fields: [
{ name: 'name', type: 'string', required: false, description: 'Alert name' },
{ name: 'enabled', type: 'boolean', required: false, description: 'Enable/disable alert' },
{ name: 'threshold', type: 'number', required: false, description: 'Threshold value' },
],
},
responses: [
{ status: 200, description: 'Alert updated' },
{ status: 404, description: 'Alert not found' },
],
},
{
id: 'admin-monitoring-alerts-delete',
method: 'DELETE',
path: '/api/admin/monitoring/alerts/{id}',
summary: 'Delete alert',
description: 'Deletes an alert rule',
category: 'admin-monitoring',
requiresAuth: true,
adminOnly: true,
parameters: [
{ name: 'id', type: 'string', required: true, location: 'path', description: 'Alert ID' },
],
responses: [
{ status: 200, description: 'Alert deleted' },
{ status: 404, description: 'Alert not found' },
],
},
{
id: 'admin-monitoring-alerts-acknowledge',
method: 'POST',
path: '/api/admin/monitoring/alerts/{id}/acknowledge',
summary: 'Acknowledge alert',
description: 'Acknowledges an active alert',
category: 'admin-monitoring',
requiresAuth: true,
adminOnly: true,
parameters: [
{ name: 'id', type: 'string', required: true, location: 'path', description: 'Alert ID' },
],
requestBody: {
contentType: 'application/json',
fields: [
{ name: 'note', type: 'string', required: false, description: 'Acknowledgment note' },
],
},
responses: [
{ status: 200, description: 'Alert acknowledged' },
{ status: 404, description: 'Alert not found' },
],
},
{
id: 'admin-monitoring-alerts-resolve',
method: 'POST',
path: '/api/admin/monitoring/alerts/{id}/resolve',
summary: 'Resolve alert',
description: 'Marks an alert as resolved',
category: 'admin-monitoring',
requiresAuth: true,
adminOnly: true,
parameters: [
{ name: 'id', type: 'string', required: true, location: 'path', description: 'Alert ID' },
],
requestBody: {
contentType: 'application/json',
fields: [
{ name: 'resolution', type: 'string', required: false, description: 'Resolution notes' },
],
},
responses: [
{ status: 200, description: 'Alert resolved' },
{ status: 404, description: 'Alert not found' },
],
},
// Errors
{
id: 'admin-monitoring-errors-list',
method: 'GET',
path: '/api/admin/monitoring/errors',
summary: 'List application errors',
description: 'Returns grouped application errors with filtering',
category: 'admin-monitoring',
requiresAuth: true,
adminOnly: true,
parameters: [
{ name: 'status', type: 'string', required: false, location: 'query', description: 'Filter by status', enum: ['unresolved', 'resolved', 'ignored'] },
{ name: 'level', type: 'string', required: false, location: 'query', description: 'Filter by level', enum: ['error', 'warning'] },
{ name: 'startDate', type: 'string', required: false, location: 'query', description: 'Start date filter' },
{ name: 'endDate', type: 'string', required: false, location: 'query', description: 'End date filter' },
{ name: 'search', type: 'string', required: false, location: 'query', description: 'Search in error messages' },
],
responses: [
{ status: 200, description: 'List of errors', example: { success: true, data: { errors: [], total: 0 } } },
],
},
{
id: 'admin-monitoring-errors-get',
method: 'GET',
path: '/api/admin/monitoring/errors/{fingerprint}',
summary: 'Get error details',
description: 'Returns details and occurrences of a specific error',
category: 'admin-monitoring',
requiresAuth: true,
adminOnly: true,
parameters: [
{ name: 'fingerprint', type: 'string', required: true, location: 'path', description: 'Error fingerprint' },
],
responses: [
{ status: 200, description: 'Error details with occurrences' },
{ status: 404, description: 'Error not found' },
],
},
{
id: 'admin-monitoring-errors-update',
method: 'PATCH',
path: '/api/admin/monitoring/errors/{fingerprint}',
summary: 'Update error status',
description: 'Updates the status of an error group',
category: 'admin-monitoring',
requiresAuth: true,
adminOnly: true,
parameters: [
{ name: 'fingerprint', type: 'string', required: true, location: 'path', description: 'Error fingerprint' },
],
requestBody: {
contentType: 'application/json',
fields: [
{ name: 'status', type: 'string', required: true, description: 'New status', enum: ['unresolved', 'resolved', 'ignored'] },
{ name: 'assignedTo', type: 'string', required: false, description: 'Assigned user ID' },
],
},
responses: [
{ status: 200, description: 'Error updated' },
{ status: 404, description: 'Error not found' },
],
},
{
id: 'admin-monitoring-errors-comments',
method: 'GET',
path: '/api/admin/monitoring/errors/{fingerprint}/comments',
summary: 'Get error comments',
description: 'Returns comments on an error group',
category: 'admin-monitoring',
requiresAuth: true,
adminOnly: true,
parameters: [
{ name: 'fingerprint', type: 'string', required: true, location: 'path', description: 'Error fingerprint' },
],
responses: [
{ status: 200, description: 'List of comments' },
],
},
{
id: 'admin-monitoring-errors-comments-create',
method: 'POST',
path: '/api/admin/monitoring/errors/{fingerprint}/comments',
summary: 'Add error comment',
description: 'Adds a comment to an error group',
category: 'admin-monitoring',
requiresAuth: true,
adminOnly: true,
parameters: [
{ name: 'fingerprint', type: 'string', required: true, location: 'path', description: 'Error fingerprint' },
],
requestBody: {
contentType: 'application/json',
fields: [
{ name: 'content', type: 'string', required: true, description: 'Comment content' },
],
},
responses: [
{ status: 201, description: 'Comment added' },
],
},
{
id: 'admin-monitoring-errors-export',
method: 'GET',
path: '/api/admin/monitoring/errors/export',
summary: 'Export errors',
description: 'Exports errors to CSV or JSON format',
category: 'admin-monitoring',
requiresAuth: true,
adminOnly: true,
parameters: [
{ name: 'format', type: 'string', required: false, location: 'query', description: 'Export format', enum: ['csv', 'json'] },
{ name: 'status', type: 'string', required: false, location: 'query', description: 'Filter by status' },
],
responses: [
{ status: 200, description: 'Export file' },
],
},
{
id: 'admin-monitoring-errors-resolve',
method: 'POST',
path: '/api/admin/monitoring/errors/resolve',
summary: 'Resolve error',
description: 'Marks a single error as resolved',
category: 'admin-monitoring',
requiresAuth: true,
adminOnly: true,
requestBody: {
contentType: 'application/json',
fields: [
{ name: 'fingerprint', type: 'string', required: true, description: 'Error fingerprint' },
{ name: 'resolution', type: 'string', required: false, description: 'Resolution notes' },
],
},
responses: [
{ status: 200, description: 'Error resolved' },
],
},
{
id: 'admin-monitoring-errors-resolve-bulk',
method: 'POST',
path: '/api/admin/monitoring/errors/resolve-bulk',
summary: 'Bulk resolve errors',
description: 'Resolves multiple errors at once',
category: 'admin-monitoring',
requiresAuth: true,
adminOnly: true,
requestBody: {
contentType: 'application/json',
fields: [
{ name: 'fingerprints', type: 'array', required: true, description: 'Array of error fingerprints' },
{ name: 'status', type: 'string', required: true, description: 'New status', enum: ['resolved', 'ignored'] },
],
},
responses: [
{ status: 200, description: 'Errors resolved', example: { success: true, data: { updated: 5 } } },
],
},
{
id: 'admin-monitoring-errors-stats',
method: 'GET',
path: '/api/admin/monitoring/errors/stats',
summary: 'Get error statistics',
description: 'Returns aggregated error statistics including counts by type, trends, and top errors',
category: 'admin-monitoring',
requiresAuth: true,
adminOnly: true,
parameters: [
{ name: 'period', type: 'string', required: false, location: 'query', description: 'Time period', enum: ['1h', '24h', '7d', '30d'] },
],
responses: [
{
status: 200,
description: 'Error statistics',
example: {
success: true,
data: {
totalErrors: 150,
unresolvedCount: 45,
resolvedCount: 100,
ignoredCount: 5,
byType: { TypeError: 50, NetworkError: 30, ValidationError: 70 },
trend: [{ date: '2024-01-01', count: 10 }],
topErrors: [],
},
},
},
],
},
// Performance
{
id: 'admin-monitoring-performance',
method: 'GET',
path: '/api/admin/monitoring/performance',
summary: 'Get performance overview',
description: 'Returns overall system performance metrics',
category: 'admin-monitoring',
requiresAuth: true,
adminOnly: true,
parameters: [
{ name: 'period', type: 'string', required: false, location: 'query', description: 'Time period', enum: ['1h', '24h', '7d', '30d'] },
],
responses: [
{ status: 200, description: 'Performance metrics' },
],
},
{
id: 'admin-monitoring-performance-database',
method: 'GET',
path: '/api/admin/monitoring/performance/database',
summary: 'Get database performance',
description: 'Returns database query performance metrics',
category: 'admin-monitoring',
requiresAuth: true,
adminOnly: true,
parameters: [
{ name: 'period', type: 'string', required: false, location: 'query', description: 'Time period' },
],
responses: [
{ status: 200, description: 'Database performance metrics' },
],
},
{
id: 'admin-monitoring-performance-metrics',
method: 'GET',
path: '/api/admin/monitoring/performance/metrics',
summary: 'Get detailed metrics',
description: 'Returns detailed performance metrics',
category: 'admin-monitoring',
requiresAuth: true,
adminOnly: true,
parameters: [
{ name: 'metric', type: 'string', required: false, location: 'query', description: 'Specific metric to fetch' },
{ name: 'period', type: 'string', required: false, location: 'query', description: 'Time period' },
],
responses: [
{ status: 200, description: 'Detailed metrics' },
],
},
// SLO & Traces
{
id: 'admin-monitoring-slo-history',
method: 'GET',
path: '/api/admin/monitoring/slo-history',
summary: 'Get SLO history',
description: 'Returns historical SLO data and trends',
category: 'admin-monitoring',
requiresAuth: true,
adminOnly: true,
parameters: [
{ name: 'sloName', type: 'string', required: false, location: 'query', description: 'SLO name filter' },
{ name: 'startDate', type: 'string', required: false, location: 'query', description: 'Start date' },
{ name: 'endDate', type: 'string', required: false, location: 'query', description: 'End date' },
],
responses: [
{ status: 200, description: 'SLO history data' },
],
},
{
id: 'admin-monitoring-stream',
method: 'GET',
path: '/api/admin/monitoring/stream',
summary: 'Real-time monitoring stream',
description: 'Server-sent events stream for real-time monitoring data',
category: 'admin-monitoring',
requiresAuth: true,
adminOnly: true,
responses: [
{ status: 200, description: 'SSE stream of monitoring events' },
],
},
{
id: 'admin-monitoring-traces-list',
method: 'GET',
path: '/api/admin/monitoring/traces',
summary: 'List traces',
description: 'Returns distributed traces for request tracking',
category: 'admin-monitoring',
requiresAuth: true,
adminOnly: true,
parameters: [
{ name: 'service', type: 'string', required: false, location: 'query', description: 'Filter by service' },
{ name: 'minDuration', type: 'number', required: false, location: 'query', description: 'Minimum duration in ms' },
{ name: 'limit', type: 'number', required: false, location: 'query', description: 'Number of traces' },
],
responses: [
{ status: 200, description: 'List of traces' },
],
},
{
id: 'admin-monitoring-traces-get',
method: 'GET',
path: '/api/admin/monitoring/traces/{id}',
summary: 'Get trace details',
description: 'Returns detailed trace with all spans',
category: 'admin-monitoring',
requiresAuth: true,
adminOnly: true,
parameters: [
{ name: 'id', type: 'string', required: true, location: 'path', description: 'Trace ID' },
],
responses: [
{ status: 200, description: 'Trace details with spans' },
{ status: 404, description: 'Trace not found' },
],
},
{
id: 'admin-monitoring-web-vitals',
method: 'GET',
path: '/api/admin/monitoring/web-vitals',
summary: 'Get Web Vitals',
description: 'Returns Core Web Vitals metrics (LCP, CLS, FID, etc.)',
category: 'admin-monitoring',
requiresAuth: true,
adminOnly: true,
parameters: [
{ name: 'period', type: 'string', required: false, location: 'query', description: 'Time period', enum: ['24h', '7d', '30d'] },
{ name: 'page', type: 'string', required: false, location: 'query', description: 'Filter by page path' },
],
responses: [
{ status: 200, description: 'Web Vitals metrics', example: { success: true, data: { lcp: 2500, cls: 0.1, fid: 100 } } },
],
},
// Performance Data APIs (Plan 88)
{
id: 'admin-monitoring-performance-endpoint-details',
method: 'GET',
path: '/api/admin/monitoring/performance/endpoints/{path}',
summary: 'Get endpoint performance details',
description: 'Returns detailed performance metrics for a specific API endpoint including response times, percentiles, and status code distribution',
category: 'admin-monitoring',
requiresAuth: true,
adminOnly: true,
parameters: [
{ name: 'path', type: 'string', required: true, location: 'path', description: 'URL-encoded endpoint path' },
{ name: 'timeRange', type: 'string', required: false, location: 'query', description: 'Time range', enum: ['1h', '6h', '24h', '7d', '30d'] },
{ name: 'page', type: 'number', required: false, location: 'query', description: 'Page number (default: 1)' },
{ name: 'limit', type: 'number', required: false, location: 'query', description: 'Results per page (default: 50, max: 100)' },
],
responses: [
{ status: 200, description: 'Endpoint performance details', example: { success: true, data: { data: [], pagination: {}, summary: { totalRequests: 100, avgDuration: 150 } } } },
{ status: 400, description: 'Invalid parameters' },
{ status: 404, description: 'No data found for endpoint' },
],
},
{
id: 'admin-monitoring-performance-slow',
method: 'GET',
path: '/api/admin/monitoring/performance/slow',
summary: 'Get slow requests',
description: 'Returns requests that exceeded the duration threshold, sorted by duration descending',
category: 'admin-monitoring',
requiresAuth: true,
adminOnly: true,
parameters: [
{ name: 'threshold', type: 'number', required: false, location: 'query', description: 'Duration threshold in ms (default: 500)' },
{ name: 'timeRange', type: 'string', required: false, location: 'query', description: 'Time range', enum: ['1h', '6h', '24h', '7d', '30d'] },
{ name: 'path', type: 'string', required: false, location: 'query', description: 'Filter by endpoint path' },
{ name: 'page', type: 'number', required: false, location: 'query', description: 'Page number (default: 1)' },
{ name: 'limit', type: 'number', required: false, location: 'query', description: 'Results per page (default: 50, max: 100)' },
],
responses: [
{ status: 200, description: 'Slow requests with summary', example: { success: true, data: { data: [], pagination: {}, summary: { totalSlowRequests: 10, avgSlowDuration: 1500, topOffenders: [] } } } },
{ status: 400, description: 'Invalid threshold or pagination parameters' },
],
},
{
id: 'admin-monitoring-performance-export',
method: 'GET',
path: '/api/admin/monitoring/performance/export',
summary: 'Export performance data',
description: 'Exports performance metrics to CSV or JSON format. Rate limited to 10 requests per minute.',
category: 'admin-monitoring',
requiresAuth: true,
adminOnly: true,
parameters: [
{ name: 'format', type: 'string', required: false, location: 'query', description: 'Export format (default: json)', enum: ['csv', 'json'] },
{ name: 'timeRange', type: 'string', required: false, location: 'query', description: 'Time range', enum: ['1h', '6h', '24h', '7d', '30d'] },
{ name: 'path', type: 'string', required: false, location: 'query', description: 'Filter by endpoint path' },
],
responses: [
{ status: 200, description: 'Export file download (CSV or JSON)' },
{ status: 400, description: 'Invalid format or time range' },
{ status: 429, description: 'Rate limit exceeded (10 requests per minute)' },
],
},
{
id: 'admin-monitoring-performance-aggregate',
method: 'GET',
path: '/api/admin/monitoring/performance/aggregate',
summary: 'Get aggregated metrics',
description: 'Returns aggregated performance metrics grouped by path, method, status code, or time period',
category: 'admin-monitoring',
requiresAuth: true,
adminOnly: true,
parameters: [
{ name: 'groupBy', type: 'string', required: false, location: 'query', description: 'Group by field (default: path)', enum: ['path', 'method', 'statusCode', 'hour', 'day'] },
{ name: 'metric', type: 'string', required: false, location: 'query', description: 'Metric to aggregate (default: avgDuration)', enum: ['avgDuration', 'maxDuration', 'minDuration', 'count', 'errorRate'] },
{ name: 'timeRange', type: 'string', required: false, location: 'query', description: 'Time range', enum: ['1h', '6h', '24h', '7d', '30d'] },
{ name: 'path', type: 'string', required: false, location: 'query', description: 'Filter by endpoint path' },
{ name: 'limit', type: 'number', required: false, location: 'query', description: 'Number of results (default: 20, max: 100)' },
],
responses: [
{ status: 200, description: 'Aggregated metrics', example: { success: true, data: { groupBy: 'path', metric: 'avgDuration', data: [{ key: '/api/products', value: 150, count: 100 }] } } },
{ status: 400, description: 'Invalid groupBy or metric parameter' },
],
},
];
|