|
1 | 1 | import type { Check } from '../../rest/checks' |
2 | 2 | import type { CheckStatus } from '../../rest/check-statuses' |
3 | 3 | import type { CheckResult, ApiCheckResult, BrowserCheckResult, MultiStepCheckResult } from '../../rest/check-results' |
4 | | -import type { ErrorGroup } from '../../rest/error-groups' |
| 4 | +import type { ErrorGroup, RootCauseAnalysis } from '../../rest/error-groups' |
5 | 5 | import type { CheckWithStatus } from '../checks' |
6 | 6 |
|
7 | 7 | // --- Check statuses --- |
@@ -388,3 +388,75 @@ export const archivedErrorGroup: ErrorGroup = { |
388 | 388 | lastSeen: '2025-05-15T00:00:00.000Z', |
389 | 389 | archivedUntilNextEvent: true, |
390 | 390 | } |
| 391 | + |
| 392 | +// --- Root cause analyses --- |
| 393 | + |
| 394 | +export const sampleRca: RootCauseAnalysis = { |
| 395 | + id: 'rca-1', |
| 396 | + created_at: '2025-06-15T10:00:00.000Z', |
| 397 | + analysis: { |
| 398 | + classification: 'INFRASTRUCTURE_ERROR', |
| 399 | + rootCause: 'The upstream API returned HTTP 503 Service Unavailable after a long server processing time (~28s TTFB), indicating a transient backend issue.', |
| 400 | + userImpact: 'Users in ap-south-1 cannot trigger checks via the API. Requests fail with 503 after ~28 seconds.', |
| 401 | + codeFix: 'Add retry logic with exponential backoff for transient 503 responses.', |
| 402 | + evidence: [ |
| 403 | + { |
| 404 | + artifacts: [{ name: 'HTTP_REQUEST', type: 'REQUEST' }], |
| 405 | + description: 'The HTTP request completed with status 503 Service Unavailable.', |
| 406 | + }, |
| 407 | + { |
| 408 | + artifacts: [{ name: 'TIMING_PHASES', type: 'TIMINGS' }], |
| 409 | + description: 'DNS and TCP times are sub-2ms while TTFB is ~28.2s.', |
| 410 | + }, |
| 411 | + { |
| 412 | + artifacts: [ |
| 413 | + { name: 'TRACE_ROUTE', type: 'TRACE' }, |
| 414 | + { name: 'PACKET_CAPTURE', type: 'BINARY' }, |
| 415 | + ], |
| 416 | + description: 'No sustained network outage; the failure is on the application side.', |
| 417 | + }, |
| 418 | + ], |
| 419 | + referenceLinks: [ |
| 420 | + { url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503', title: 'HTTP 503 Service Unavailable' }, |
| 421 | + ], |
| 422 | + }, |
| 423 | + provider: 'openai', |
| 424 | + model: 'gpt-5.1', |
| 425 | + durationMs: 9459, |
| 426 | + userContext: [{ text: 'checkly-backend', type: 'TAG' }], |
| 427 | +} |
| 428 | + |
| 429 | +export const sampleRcaMinimal: RootCauseAnalysis = { |
| 430 | + id: 'rca-2', |
| 431 | + created_at: '2025-06-14T08:00:00.000Z', |
| 432 | + analysis: { |
| 433 | + classification: 'APPLICATION_ERROR', |
| 434 | + rootCause: 'The API endpoint /users returns 404 because the route was removed in a recent deployment.', |
| 435 | + userImpact: 'User profile pages fail to load.', |
| 436 | + codeFix: null, |
| 437 | + evidence: null, |
| 438 | + referenceLinks: null, |
| 439 | + }, |
| 440 | + provider: 'openai', |
| 441 | + model: 'gpt-5.1', |
| 442 | + durationMs: 5000, |
| 443 | + userContext: null, |
| 444 | +} |
| 445 | + |
| 446 | +export const errorGroupWithRca: ErrorGroup = { |
| 447 | + ...activeErrorGroup, |
| 448 | + id: 'eg-rca-1', |
| 449 | + rootCauseAnalyses: [sampleRca], |
| 450 | +} |
| 451 | + |
| 452 | +export const errorGroupWithMultipleRcas: ErrorGroup = { |
| 453 | + ...activeErrorGroup, |
| 454 | + id: 'eg-rca-2', |
| 455 | + rootCauseAnalyses: [sampleRca, sampleRcaMinimal], |
| 456 | +} |
| 457 | + |
| 458 | +export const errorGroupWithoutRca: ErrorGroup = { |
| 459 | + ...activeErrorGroup, |
| 460 | + id: 'eg-no-rca', |
| 461 | + rootCauseAnalyses: [], |
| 462 | +} |
0 commit comments