1 | import type { TraceContext } from './context';
|
2 | interface CrontabSchedule {
|
3 | type: 'crontab';
|
4 | value: string;
|
5 | }
|
6 | interface IntervalSchedule {
|
7 | type: 'interval';
|
8 | value: number;
|
9 | unit: 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute';
|
10 | }
|
11 | type MonitorSchedule = CrontabSchedule | IntervalSchedule;
|
12 | export interface SerializedCheckIn {
|
13 | check_in_id: string;
|
14 | monitor_slug: string;
|
15 | status: 'in_progress' | 'ok' | 'error';
|
16 | duration?: number;
|
17 | release?: string;
|
18 | environment?: string;
|
19 | monitor_config?: {
|
20 | schedule: MonitorSchedule;
|
21 | checkin_margin?: number;
|
22 | max_runtime?: number;
|
23 | timezone?: string;
|
24 | failure_issue_threshold?: number;
|
25 | recovery_threshold?: number;
|
26 | };
|
27 | contexts?: {
|
28 | trace?: TraceContext;
|
29 | };
|
30 | }
|
31 | export interface HeartbeatCheckIn {
|
32 | monitorSlug: SerializedCheckIn['monitor_slug'];
|
33 | status: 'ok' | 'error';
|
34 | }
|
35 | export interface InProgressCheckIn {
|
36 | monitorSlug: SerializedCheckIn['monitor_slug'];
|
37 | status: 'in_progress';
|
38 | }
|
39 | export interface FinishedCheckIn {
|
40 | monitorSlug: SerializedCheckIn['monitor_slug'];
|
41 | status: 'ok' | 'error';
|
42 | checkInId: SerializedCheckIn['check_in_id'];
|
43 | duration?: SerializedCheckIn['duration'];
|
44 | }
|
45 | export type CheckIn = HeartbeatCheckIn | InProgressCheckIn | FinishedCheckIn;
|
46 | type SerializedMonitorConfig = NonNullable<SerializedCheckIn['monitor_config']>;
|
47 | export interface MonitorConfig {
|
48 | schedule: MonitorSchedule;
|
49 | checkinMargin?: SerializedMonitorConfig['checkin_margin'];
|
50 | maxRuntime?: SerializedMonitorConfig['max_runtime'];
|
51 | timezone?: SerializedMonitorConfig['timezone'];
|
52 | failureIssueThreshold?: SerializedMonitorConfig['failure_issue_threshold'];
|
53 | recoveryThreshold?: SerializedMonitorConfig['recovery_threshold'];
|
54 | }
|
55 | export {};
|
56 |
|
\ | No newline at end of file |