checkly 7.1.0 → 7.2.0
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/dist/ai-context/checkly.rules.md +67 -78
- package/dist/ai-context/context.d.ts +37 -2
- package/dist/ai-context/context.js +62 -20
- package/dist/ai-context/context.js.map +1 -1
- package/dist/ai-context/skills/monitoring/README.md +13 -2
- package/dist/ai-context/skills/monitoring/SKILL.md +13 -560
- package/dist/ai-context/skills/monitoring/references/alert-channels.md +49 -0
- package/dist/ai-context/skills/monitoring/references/api-checks.md +58 -0
- package/dist/ai-context/skills/monitoring/references/browser-checks.md +38 -0
- package/dist/ai-context/skills/monitoring/references/check-groups.md +15 -0
- package/dist/ai-context/skills/monitoring/references/multistep-checks.md +33 -0
- package/dist/ai-context/skills/monitoring/references/playwright-checks.md +19 -0
- package/dist/ai-context/skills/monitoring/references/supporting-constructs.md +119 -0
- package/dist/ai-context/skills/monitoring/references/uptime-monitors.md +206 -0
- package/dist/commands/debug/parse-project.js +2 -2
- package/dist/commands/debug/parse-project.js.map +1 -1
- package/dist/commands/pw-test.js +2 -2
- package/dist/commands/pw-test.js.map +1 -1
- package/dist/constructs/api-check-codegen.js +1 -1
- package/dist/constructs/api-check-codegen.js.map +1 -1
- package/dist/constructs/api-check.js.map +1 -1
- package/dist/constructs/api-request-codegen.js +1 -1
- package/dist/constructs/api-request-codegen.js.map +1 -1
- package/dist/constructs/check-codegen.js +4 -4
- package/dist/constructs/check-codegen.js.map +1 -1
- package/dist/constructs/dns-monitor-codegen.js +1 -1
- package/dist/constructs/dns-monitor-codegen.js.map +1 -1
- package/dist/constructs/playwright-check.js +1 -2
- package/dist/constructs/playwright-check.js.map +1 -1
- package/dist/constructs/project.d.ts +1 -2
- package/dist/constructs/project.js +2 -2
- package/dist/constructs/project.js.map +1 -1
- package/dist/constructs/tcp-monitor-codegen.d.ts +1 -1
- package/dist/constructs/tcp-monitor-codegen.js +9 -9
- package/dist/constructs/tcp-monitor-codegen.js.map +1 -1
- package/dist/constructs/url-monitor-codegen.js +2 -2
- package/dist/constructs/url-monitor-codegen.js.map +1 -1
- package/dist/services/project-parser.d.ts +2 -2
- package/dist/services/project-parser.js +13 -9
- package/dist/services/project-parser.js.map +1 -1
- package/dist/services/util.d.ts +1 -1
- package/dist/services/util.js +14 -2
- package/dist/services/util.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
|
@@ -15,10 +15,11 @@ metadata:
|
|
|
15
15
|
- Import and / or require any constructs you need in your code, such as `ApiCheck`, `BrowserCheck`, or `PlaywrightCheck` from the `checkly/constructs` package.
|
|
16
16
|
- Always ground generated code and CLI commands against the official documentation and examples in this file.
|
|
17
17
|
|
|
18
|
-
##
|
|
18
|
+
## Using the Checkly CLI
|
|
19
19
|
|
|
20
|
-
-
|
|
20
|
+
- Use `npx checkly` instead of installing the Checkly CLI globally.
|
|
21
21
|
- NEVER make up commands that do not exist.
|
|
22
|
+
- Use `npm create checkly@latest` to set up a new Checkly project via the CLI.
|
|
22
23
|
|
|
23
24
|
## Project Structure
|
|
24
25
|
|
|
@@ -80,565 +81,17 @@ export default defineConfig({
|
|
|
80
81
|
|
|
81
82
|
## Check and Monitor Constructs
|
|
82
83
|
|
|
83
|
-
|
|
84
|
+
Parse and read further reference documentation when tasked with creating or managing any of the following Checkly constructs:
|
|
84
85
|
|
|
85
|
-
-
|
|
86
|
-
-
|
|
87
|
-
-
|
|
88
|
-
-
|
|
89
|
-
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
92
|
-
|
|
93
|
-
**Reference:** https://www.checklyhq.com/docs/constructs/api-check/
|
|
94
|
-
|
|
95
|
-
```typescript
|
|
96
|
-
import { AlertEscalationBuilder, ApiCheck, Frequency, RetryStrategyBuilder } from 'checkly/constructs'
|
|
97
|
-
|
|
98
|
-
new ApiCheck('example-api-check', {
|
|
99
|
-
name: 'Example API Check',
|
|
100
|
-
request: {
|
|
101
|
-
url: 'https://api.example.com/v1/products',
|
|
102
|
-
method: 'GET',
|
|
103
|
-
ipFamily: 'IPv4',
|
|
104
|
-
},
|
|
105
|
-
setupScript: {
|
|
106
|
-
entrypoint: './setup-script.ts',
|
|
107
|
-
},
|
|
108
|
-
tearDownScript: {
|
|
109
|
-
entrypoint: './teardown-script.ts',
|
|
110
|
-
},
|
|
111
|
-
degradedResponseTime: 5000,
|
|
112
|
-
maxResponseTime: 20000,
|
|
113
|
-
activated: true,
|
|
114
|
-
muted: false,
|
|
115
|
-
shouldFail: false,
|
|
116
|
-
locations: [
|
|
117
|
-
'eu-central-1',
|
|
118
|
-
'eu-west-2',
|
|
119
|
-
],
|
|
120
|
-
frequency: Frequency.EVERY_5M,
|
|
121
|
-
alertEscalationPolicy: AlertEscalationBuilder.runBasedEscalation(1, {
|
|
122
|
-
amount: 0,
|
|
123
|
-
interval: 5,
|
|
124
|
-
}, {
|
|
125
|
-
enabled: false,
|
|
126
|
-
percentage: 10,
|
|
127
|
-
}),
|
|
128
|
-
retryStrategy: RetryStrategyBuilder.linearStrategy({
|
|
129
|
-
baseBackoffSeconds: 60,
|
|
130
|
-
maxRetries: 2,
|
|
131
|
-
maxDurationSeconds: 600,
|
|
132
|
-
sameRegion: true,
|
|
133
|
-
}),
|
|
134
|
-
runParallel: true,
|
|
135
|
-
})
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
#### Authentication Setup Scripts for API Checks
|
|
139
|
-
|
|
140
|
-
- Setup scripts should be flat scripts, no functions, no exports, they will be executed straight by Checkly.
|
|
141
|
-
- Use axios for making HTTP requests.
|
|
142
|
-
- Read the input credentials from env variables using `process.env`.
|
|
143
|
-
- Pass auth tokens to the request object using `request.headers['key'] = AUTH_TOKEN_VALUE`.
|
|
144
|
-
|
|
145
|
-
### Browser Check
|
|
146
|
-
|
|
147
|
-
- Import the `BrowserCheck` construct from `checkly/constructs`.
|
|
148
|
-
- Generate a separate `.spec.ts` file for the Playwright code referenced in the `BrowserCheck` construct.
|
|
149
|
-
- Use the `code.entrypoint` property to specify the path to your Playwright test file.
|
|
150
|
-
|
|
151
|
-
**Reference:** https://www.checklyhq.com/docs/constructs/browser-check/
|
|
152
|
-
|
|
153
|
-
```typescript
|
|
154
|
-
import { AlertEscalationBuilder, BrowserCheck, Frequency, RetryStrategyBuilder } from 'checkly/constructs'
|
|
155
|
-
|
|
156
|
-
new BrowserCheck('example-browser-check', {
|
|
157
|
-
name: 'Example Browser Check',
|
|
158
|
-
code: {
|
|
159
|
-
entrypoint: './example-browser-check.spec.ts',
|
|
160
|
-
},
|
|
161
|
-
activated: false,
|
|
162
|
-
muted: false,
|
|
163
|
-
shouldFail: false,
|
|
164
|
-
locations: [
|
|
165
|
-
'eu-central-1',
|
|
166
|
-
'eu-west-2',
|
|
167
|
-
],
|
|
168
|
-
frequency: Frequency.EVERY_10M,
|
|
169
|
-
alertEscalationPolicy: AlertEscalationBuilder.runBasedEscalation(1, {
|
|
170
|
-
amount: 0,
|
|
171
|
-
interval: 5,
|
|
172
|
-
}, {
|
|
173
|
-
enabled: false,
|
|
174
|
-
percentage: 10,
|
|
175
|
-
}),
|
|
176
|
-
retryStrategy: RetryStrategyBuilder.linearStrategy({
|
|
177
|
-
baseBackoffSeconds: 60,
|
|
178
|
-
maxRetries: 2,
|
|
179
|
-
maxDurationSeconds: 600,
|
|
180
|
-
sameRegion: true,
|
|
181
|
-
}),
|
|
182
|
-
runParallel: true,
|
|
183
|
-
})
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
### Playwright Check Suite
|
|
187
|
-
|
|
188
|
-
- Import the `PlaywrightCheck` construct from `checkly/constructs`.
|
|
189
|
-
- use `pwProjects` if your tasked to reuse a Playwright project.
|
|
190
|
-
|
|
191
|
-
**Reference:** https://www.checklyhq.com/docs/constructs/playwright-check/
|
|
192
|
-
|
|
193
|
-
```typescript
|
|
194
|
-
import { PlaywrightCheck } from "checkly/constructs"
|
|
195
|
-
|
|
196
|
-
const playwrightChecks = new PlaywrightCheck("multi-browser-check", {
|
|
197
|
-
name: "Multi-browser check suite",
|
|
198
|
-
playwrightConfigPath: "./playwright.config.ts",
|
|
199
|
-
// Playwright Check Suites support all browsers
|
|
200
|
-
// defined in your `playwright.config`
|
|
201
|
-
pwProjects: ["chromium", "firefox", "webkit"],
|
|
202
|
-
});
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
### MultiStep Check
|
|
206
|
-
|
|
207
|
-
- Import the `MultiStepCheck` construct from `checkly/constructs`.
|
|
208
|
-
- Generate a separate `.spec.ts` file for the Playwright code referenced in the `MultiStepCheck` construct.
|
|
209
|
-
- Use the `code.entrypoint` property to specify the path to your Playwright test file.
|
|
210
|
-
|
|
211
|
-
**Reference:** https://www.checklyhq.com/docs/constructs/multistep-check/
|
|
212
|
-
|
|
213
|
-
```typescript
|
|
214
|
-
import { AlertEscalationBuilder, Frequency, MultiStepCheck, RetryStrategyBuilder } from 'checkly/constructs'
|
|
215
|
-
|
|
216
|
-
new MultiStepCheck('example-multi-step-check', {
|
|
217
|
-
name: 'Example Multistep Check',
|
|
218
|
-
code: {
|
|
219
|
-
entrypoint: './example-multistep-check.spec.ts',
|
|
220
|
-
},
|
|
221
|
-
activated: true,
|
|
222
|
-
muted: false,
|
|
223
|
-
shouldFail: false,
|
|
224
|
-
locations: [
|
|
225
|
-
'eu-central-1',
|
|
226
|
-
'eu-west-2',
|
|
227
|
-
],
|
|
228
|
-
frequency: Frequency.EVERY_1H,
|
|
229
|
-
alertEscalationPolicy: AlertEscalationBuilder.runBasedEscalation(1, {
|
|
230
|
-
amount: 0,
|
|
231
|
-
interval: 5,
|
|
232
|
-
}, {
|
|
233
|
-
enabled: false,
|
|
234
|
-
percentage: 10,
|
|
235
|
-
}),
|
|
236
|
-
retryStrategy: RetryStrategyBuilder.noRetries(),
|
|
237
|
-
runParallel: true,
|
|
238
|
-
})
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
### TCP Monitor
|
|
242
|
-
|
|
243
|
-
- Import the `TcpMonitor` construct from `checkly/constructs`.
|
|
244
|
-
- When adding `assertions`, always use `TcpAssertionBuilder` class for TCP monitors.
|
|
245
|
-
|
|
246
|
-
**Reference:** https://www.checklyhq.com/docs/constructs/tcp-monitor/
|
|
247
|
-
|
|
248
|
-
```typescript
|
|
249
|
-
import { AlertEscalationBuilder, Frequency, RetryStrategyBuilder, TcpAssertionBuilder, TcpMonitor } from 'checkly/constructs'
|
|
250
|
-
|
|
251
|
-
new TcpMonitor('example-tcp-monitor', {
|
|
252
|
-
name: 'Example TCP Monitor',
|
|
253
|
-
request: {
|
|
254
|
-
hostname: 'tcp.example.com',
|
|
255
|
-
port: 4242,
|
|
256
|
-
ipFamily: 'IPv4',
|
|
257
|
-
assertions: [
|
|
258
|
-
TcpAssertionBuilder.responseTime().lessThan(200),
|
|
259
|
-
TcpAssertionBuilder.responseData().isEmpty(),
|
|
260
|
-
],
|
|
261
|
-
},
|
|
262
|
-
degradedResponseTime: 5000,
|
|
263
|
-
maxResponseTime: 5000,
|
|
264
|
-
activated: true,
|
|
265
|
-
muted: false,
|
|
266
|
-
shouldFail: false,
|
|
267
|
-
locations: [
|
|
268
|
-
'eu-central-1',
|
|
269
|
-
'eu-west-2',
|
|
270
|
-
],
|
|
271
|
-
frequency: Frequency.EVERY_1H,
|
|
272
|
-
alertEscalationPolicy: AlertEscalationBuilder.runBasedEscalation(1, {
|
|
273
|
-
amount: 0,
|
|
274
|
-
interval: 5,
|
|
275
|
-
}, {
|
|
276
|
-
enabled: false,
|
|
277
|
-
percentage: 10,
|
|
278
|
-
}),
|
|
279
|
-
retryStrategy: RetryStrategyBuilder.linearStrategy({
|
|
280
|
-
baseBackoffSeconds: 60,
|
|
281
|
-
maxRetries: 2,
|
|
282
|
-
maxDurationSeconds: 600,
|
|
283
|
-
sameRegion: true,
|
|
284
|
-
}),
|
|
285
|
-
runParallel: true,
|
|
286
|
-
})
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
### URL Monitor
|
|
290
|
-
|
|
291
|
-
- Import the `UrlMonitor` construct from `checkly/constructs`.
|
|
292
|
-
- When adding `assertions`, always use `UrlAssertionBuilder`.
|
|
293
|
-
|
|
294
|
-
**Reference:** https://www.checklyhq.com/docs/constructs/url-monitor/
|
|
295
|
-
|
|
296
|
-
```typescript
|
|
297
|
-
import { AlertEscalationBuilder, Frequency, RetryStrategyBuilder, UrlAssertionBuilder, UrlMonitor } from 'checkly/constructs'
|
|
298
|
-
|
|
299
|
-
new UrlMonitor('example-url-monitor', {
|
|
300
|
-
name: 'Example URL Monitor',
|
|
301
|
-
request: {
|
|
302
|
-
url: 'https://example.com',
|
|
303
|
-
ipFamily: 'IPv4',
|
|
304
|
-
assertions: [
|
|
305
|
-
UrlAssertionBuilder.statusCode().equals(200),
|
|
306
|
-
],
|
|
307
|
-
},
|
|
308
|
-
degradedResponseTime: 5000,
|
|
309
|
-
maxResponseTime: 20000,
|
|
310
|
-
activated: true,
|
|
311
|
-
muted: false,
|
|
312
|
-
shouldFail: false,
|
|
313
|
-
locations: [
|
|
314
|
-
'eu-central-1',
|
|
315
|
-
'eu-west-2',
|
|
316
|
-
],
|
|
317
|
-
frequency: Frequency.EVERY_5M,
|
|
318
|
-
alertEscalationPolicy: AlertEscalationBuilder.runBasedEscalation(1, {
|
|
319
|
-
amount: 0,
|
|
320
|
-
interval: 5,
|
|
321
|
-
}, {
|
|
322
|
-
enabled: false,
|
|
323
|
-
percentage: 10,
|
|
324
|
-
}),
|
|
325
|
-
retryStrategy: RetryStrategyBuilder.linearStrategy({
|
|
326
|
-
baseBackoffSeconds: 60,
|
|
327
|
-
maxRetries: 2,
|
|
328
|
-
maxDurationSeconds: 600,
|
|
329
|
-
sameRegion: true,
|
|
330
|
-
}),
|
|
331
|
-
runParallel: true,
|
|
332
|
-
})
|
|
333
|
-
```
|
|
334
|
-
|
|
335
|
-
### DNS Monitor
|
|
336
|
-
|
|
337
|
-
- Import the `DnsMonitor` construct from `checkly/constructs`.
|
|
338
|
-
- Reference [the docs for DNS monitors](https://www.checklyhq.com/docs/constructs/dns-monitor/) before generating any code.
|
|
339
|
-
- When adding `assertions`, always use `DnsAssertionBuilder` class.
|
|
340
|
-
|
|
341
|
-
**Reference:** https://www.checklyhq.com/docs/constructs/dns-monitor/
|
|
342
|
-
|
|
343
|
-
```typescript
|
|
344
|
-
import { AlertEscalationBuilder, DnsAssertionBuilder, DnsMonitor, Frequency, RetryStrategyBuilder } from 'checkly/constructs'
|
|
345
|
-
|
|
346
|
-
new DnsMonitor('example-dns-monitor', {
|
|
347
|
-
name: 'Example DNS Monitor',
|
|
348
|
-
request: {
|
|
349
|
-
recordType: 'AAAA',
|
|
350
|
-
query: 'welcome.checklyhq.com',
|
|
351
|
-
assertions: [
|
|
352
|
-
DnsAssertionBuilder.responseCode().equals('NOERROR'),
|
|
353
|
-
],
|
|
354
|
-
},
|
|
355
|
-
degradedResponseTime: 500,
|
|
356
|
-
maxResponseTime: 1000,
|
|
357
|
-
activated: true,
|
|
358
|
-
muted: false,
|
|
359
|
-
shouldFail: false,
|
|
360
|
-
locations: [
|
|
361
|
-
'eu-central-1',
|
|
362
|
-
'eu-north-1',
|
|
363
|
-
],
|
|
364
|
-
frequency: Frequency.EVERY_10M,
|
|
365
|
-
alertEscalationPolicy: AlertEscalationBuilder.runBasedEscalation(1, {
|
|
366
|
-
amount: 0,
|
|
367
|
-
interval: 5,
|
|
368
|
-
}, {
|
|
369
|
-
enabled: false,
|
|
370
|
-
percentage: 10,
|
|
371
|
-
}),
|
|
372
|
-
retryStrategy: RetryStrategyBuilder.noRetries(),
|
|
373
|
-
runParallel: false,
|
|
374
|
-
})
|
|
375
|
-
```
|
|
376
|
-
|
|
377
|
-
### ICMP Monitor
|
|
378
|
-
|
|
379
|
-
- Import the `IcmpMonitor` construct from `checkly/constructs`.
|
|
380
|
-
- Reference [the docs for ICMP monitors](https://www.checklyhq.com/docs/constructs/icmp-monitor/) before generating any code.
|
|
381
|
-
- When adding `assertions`, always use `IcmpAssertionBuilder` class.
|
|
382
|
-
- Latency assertions require a property parameter: `'avg'`, `'min'`, `'max'`, or `'stdDev'`.
|
|
383
|
-
- Use `degradedPacketLossThreshold` and `maxPacketLossThreshold` for packet loss thresholds (percentages).
|
|
384
|
-
|
|
385
|
-
**Reference:** https://www.checklyhq.com/docs/constructs/icmp-monitor/
|
|
386
|
-
|
|
387
|
-
```typescript
|
|
388
|
-
import { AlertEscalationBuilder, Frequency, IcmpAssertionBuilder, IcmpMonitor, RetryStrategyBuilder } from 'checkly/constructs'
|
|
389
|
-
|
|
390
|
-
new IcmpMonitor('example-icmp-monitor', {
|
|
391
|
-
name: 'Example ICMP Monitor',
|
|
392
|
-
request: {
|
|
393
|
-
hostname: '1.1.1.1',
|
|
394
|
-
pingCount: 10,
|
|
395
|
-
assertions: [
|
|
396
|
-
IcmpAssertionBuilder.latency('avg').lessThan(100),
|
|
397
|
-
IcmpAssertionBuilder.latency('max').lessThan(200),
|
|
398
|
-
],
|
|
399
|
-
},
|
|
400
|
-
degradedPacketLossThreshold: 10,
|
|
401
|
-
maxPacketLossThreshold: 20,
|
|
402
|
-
activated: true,
|
|
403
|
-
muted: false,
|
|
404
|
-
locations: [
|
|
405
|
-
'eu-central-1',
|
|
406
|
-
'eu-north-1',
|
|
407
|
-
],
|
|
408
|
-
frequency: Frequency.EVERY_10M,
|
|
409
|
-
alertEscalationPolicy: AlertEscalationBuilder.runBasedEscalation(1, {
|
|
410
|
-
amount: 0,
|
|
411
|
-
interval: 5,
|
|
412
|
-
}, {
|
|
413
|
-
enabled: false,
|
|
414
|
-
percentage: 10,
|
|
415
|
-
}),
|
|
416
|
-
retryStrategy: RetryStrategyBuilder.noRetries(),
|
|
417
|
-
runParallel: false,
|
|
418
|
-
})
|
|
419
|
-
```
|
|
420
|
-
|
|
421
|
-
### Heartbeat Monitor
|
|
422
|
-
|
|
423
|
-
- Import the `HeartbeatMonitor` construct from `checkly/constructs`.
|
|
424
|
-
|
|
425
|
-
**Reference:** https://www.checklyhq.com/docs/constructs/heartbeat-monitor/
|
|
426
|
-
|
|
427
|
-
```typescript
|
|
428
|
-
import { AlertEscalationBuilder, Frequency, HeartbeatMonitor, RetryStrategyBuilder } from 'checkly/constructs'
|
|
429
|
-
|
|
430
|
-
new HeartbeatMonitor('example-heartbeat-monitor', {
|
|
431
|
-
name: 'Example Heartbeat Monitor',
|
|
432
|
-
period: 1,
|
|
433
|
-
periodUnit: 'hours',
|
|
434
|
-
grace: 30,
|
|
435
|
-
graceUnit: 'minutes',
|
|
436
|
-
activated: true,
|
|
437
|
-
muted: false,
|
|
438
|
-
shouldFail: false,
|
|
439
|
-
frequency: Frequency.EVERY_10S,
|
|
440
|
-
alertEscalationPolicy: AlertEscalationBuilder.runBasedEscalation(1, {
|
|
441
|
-
amount: 0,
|
|
442
|
-
interval: 5,
|
|
443
|
-
}, {
|
|
444
|
-
enabled: false,
|
|
445
|
-
percentage: 10,
|
|
446
|
-
}),
|
|
447
|
-
retryStrategy: RetryStrategyBuilder.linearStrategy({
|
|
448
|
-
baseBackoffSeconds: 60,
|
|
449
|
-
maxRetries: 2,
|
|
450
|
-
maxDurationSeconds: 600,
|
|
451
|
-
sameRegion: true,
|
|
452
|
-
}),
|
|
453
|
-
runParallel: true,
|
|
454
|
-
})
|
|
455
|
-
```
|
|
456
|
-
|
|
457
|
-
### Check Group
|
|
458
|
-
|
|
459
|
-
- Import the `CheckGroupV2` construct from `checkly/constructs`.
|
|
460
|
-
- Check Groups are used to group checks together for easier management and organization.
|
|
461
|
-
- Checks are added to Check Groups by referencing the group in the `group` property of a check.
|
|
462
|
-
|
|
463
|
-
**Reference:** https://www.checklyhq.com/docs/constructs/check-group/
|
|
464
|
-
|
|
465
|
-
```typescript
|
|
466
|
-
import { CheckGroupV2 } from 'checkly/constructs'
|
|
467
|
-
|
|
468
|
-
export const exampleGroup = new CheckGroupV2('example-group', {
|
|
469
|
-
name: 'Example Group',
|
|
470
|
-
})
|
|
471
|
-
```
|
|
472
|
-
|
|
473
|
-
## Alert Channel Constructs
|
|
474
|
-
|
|
475
|
-
- Alert channels are used to send notifications when checks and monitors fail or recover.
|
|
476
|
-
- Alert channels are added to checks, monitors, and check groups constructs by adding them to the `alertChannels` array property.
|
|
477
|
-
|
|
478
|
-
Here are some examples of how to create different types of alert channels. All alert are described in the [Checkly docs](https://www.checklyhq.com/docs/constructs/overview/).
|
|
479
|
-
|
|
480
|
-
### Email Alert Channel
|
|
481
|
-
|
|
482
|
-
**Reference:** https://www.checklyhq.com/docs/constructs/email-alert-channel/
|
|
483
|
-
|
|
484
|
-
```typescript
|
|
485
|
-
import { EmailAlertChannel } from 'checkly/constructs'
|
|
486
|
-
|
|
487
|
-
export const testEmailAlert = new EmailAlertChannel('example-email-alert-channel', {
|
|
488
|
-
address: 'test@example.com',
|
|
489
|
-
sslExpiry: true,
|
|
490
|
-
})
|
|
491
|
-
```
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
### Phone Call Alert Channel
|
|
495
|
-
|
|
496
|
-
**Reference:** https://www.checklyhq.com/docs/constructs/phone-call-alert-channel/
|
|
497
|
-
|
|
498
|
-
```typescript
|
|
499
|
-
import { PhoneCallAlertChannel } from 'checkly/constructs'
|
|
500
|
-
|
|
501
|
-
export const testUserPhoneCallAlert = new PhoneCallAlertChannel('example-call-alert-channel', {
|
|
502
|
-
name: 'Test User',
|
|
503
|
-
phoneNumber: '+311234567890',
|
|
504
|
-
})
|
|
505
|
-
```
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
### Slack Alert Channel
|
|
509
|
-
|
|
510
|
-
**Reference:** https://www.checklyhq.com/docs/constructs/slack-alert-channel/
|
|
511
|
-
|
|
512
|
-
```typescript
|
|
513
|
-
import { SlackAlertChannel } from 'checkly/constructs'
|
|
514
|
-
|
|
515
|
-
export const generalSlackAlert = new SlackAlertChannel('example-slack-alert-channel', {
|
|
516
|
-
url: 'https://hooks.slack.com/services/TK123456789123/12345/123456789',
|
|
517
|
-
channel: '#general',
|
|
518
|
-
})
|
|
519
|
-
```
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
## Supporting Constructs
|
|
523
|
-
|
|
524
|
-
### Status Page
|
|
525
|
-
|
|
526
|
-
- Import the `StatusPage` construct from `checkly/constructs`.
|
|
527
|
-
- Status pages are used to display the status of your services to your users.
|
|
528
|
-
- A Status Page consists of cards which include Status Page Services.
|
|
529
|
-
|
|
530
|
-
**Reference:** https://www.checklyhq.com/docs/constructs/status-page/
|
|
531
|
-
|
|
532
|
-
```typescript
|
|
533
|
-
import { StatusPage } from 'checkly/constructs'
|
|
534
|
-
import { exampleService } from './services/example-service.check'
|
|
535
|
-
|
|
536
|
-
new StatusPage('example-status-page', {
|
|
537
|
-
name: 'Example Status Page',
|
|
538
|
-
url: 'example-status-page',
|
|
539
|
-
cards: [
|
|
540
|
-
{
|
|
541
|
-
name: 'Example service',
|
|
542
|
-
services: [
|
|
543
|
-
exampleService,
|
|
544
|
-
],
|
|
545
|
-
},
|
|
546
|
-
],
|
|
547
|
-
customDomain: 'status.example.com',
|
|
548
|
-
defaultTheme: 'AUTO',
|
|
549
|
-
})
|
|
550
|
-
```
|
|
551
|
-
|
|
552
|
-
### Status Page Service
|
|
553
|
-
|
|
554
|
-
- Import the `StatusPageService` construct from `checkly/constructs`.
|
|
555
|
-
- Status Page Services are used to represent individual services on a Status Page.
|
|
556
|
-
|
|
557
|
-
**Reference:** https://www.checklyhq.com/docs/constructs/status-page-service/
|
|
558
|
-
|
|
559
|
-
```typescript
|
|
560
|
-
import { StatusPageService } from 'checkly/constructs'
|
|
561
|
-
|
|
562
|
-
export const exampleService = new StatusPageService('example-status-page-service', {
|
|
563
|
-
name: 'Example Service',
|
|
564
|
-
})
|
|
565
|
-
```
|
|
566
|
-
|
|
567
|
-
### Dashboard
|
|
568
|
-
|
|
569
|
-
- Import the `Dashboard` construct from `checkly/constructs`.
|
|
570
|
-
- Dashboards are used to display the results of your checks on screens external to Checkly.
|
|
571
|
-
|
|
572
|
-
**Reference:** https://www.checklyhq.com/docs/constructs/dashboard/
|
|
573
|
-
|
|
574
|
-
```typescript
|
|
575
|
-
import { Dashboard } from 'checkly/constructs'
|
|
576
|
-
|
|
577
|
-
new Dashboard('example-dashboard', {
|
|
578
|
-
tags: [
|
|
579
|
-
'app:webshop',
|
|
580
|
-
],
|
|
581
|
-
customUrl: 'example-dashboard',
|
|
582
|
-
customDomain: 'dash.example.com',
|
|
583
|
-
header: 'Example Dashboard',
|
|
584
|
-
description: 'Example dashboard',
|
|
585
|
-
width: 'FULL',
|
|
586
|
-
refreshRate: 60,
|
|
587
|
-
paginate: true,
|
|
588
|
-
paginationRate: 60,
|
|
589
|
-
checksPerPage: 15,
|
|
590
|
-
useTagsAndOperator: false,
|
|
591
|
-
hideTags: false,
|
|
592
|
-
enableIncidents: false,
|
|
593
|
-
expandChecks: false,
|
|
594
|
-
showHeader: true,
|
|
595
|
-
isPrivate: false,
|
|
596
|
-
showP95: true,
|
|
597
|
-
showP99: true,
|
|
598
|
-
})
|
|
599
|
-
```
|
|
600
|
-
|
|
601
|
-
### Maintenance Window
|
|
602
|
-
|
|
603
|
-
- Import the `MaintenanceWindow` construct from `checkly/constructs`.
|
|
604
|
-
- Maintenance windows are used to pause checks during maintenance periods so no alerts are sent.
|
|
605
|
-
- Checks are referenced by their tags in the `tags` property.
|
|
606
|
-
|
|
607
|
-
**Reference:** https://www.checklyhq.com/docs/constructs/maintenance-window/
|
|
608
|
-
|
|
609
|
-
```typescript
|
|
610
|
-
import { MaintenanceWindow } from 'checkly/constructs'
|
|
611
|
-
|
|
612
|
-
new MaintenanceWindow('example-maintenance-window', {
|
|
613
|
-
name: 'Example Maintenance Window',
|
|
614
|
-
tags: [
|
|
615
|
-
'app:webshop',
|
|
616
|
-
],
|
|
617
|
-
startsAt: new Date('2025-07-01T09:00:00.000Z'),
|
|
618
|
-
endsAt: new Date('2025-07-01T10:00:00.000Z'),
|
|
619
|
-
repeatInterval: 1,
|
|
620
|
-
repeatUnit: 'WEEK',
|
|
621
|
-
repeatEndsAt: new Date('2025-08-01T00:00:00.000Z'),
|
|
622
|
-
})
|
|
623
|
-
```
|
|
624
|
-
|
|
625
|
-
### Private Location
|
|
626
|
-
|
|
627
|
-
- Import the `PrivateLocation` construct from `checkly/constructs`.
|
|
628
|
-
- Private locations are used to run checks from your own infrastructure with the Checkly Agent, an OCI compatible container.
|
|
629
|
-
|
|
630
|
-
**Reference:** https://www.checklyhq.com/docs/constructs/private-location/
|
|
631
|
-
|
|
632
|
-
```typescript
|
|
633
|
-
import { PrivateLocation } from 'checkly/constructs'
|
|
634
|
-
|
|
635
|
-
export const examplePrivateLocation = new PrivateLocation('example-private-location', {
|
|
636
|
-
name: 'Example Private Location',
|
|
637
|
-
slugName: 'example-private-location',
|
|
638
|
-
icon: 'location',
|
|
639
|
-
})
|
|
640
|
-
```
|
|
86
|
+
- [API Checks](references/api-checks.md) - ApiCheck construct, assertions, and authentication setup scripts
|
|
87
|
+
- [Browser Checks](references/browser-checks.md) - BrowserCheck construct with Playwright test files
|
|
88
|
+
- [Playwright Checks](references/playwright-checks.md) - PlaywrightCheck construct for multi-browser test suites
|
|
89
|
+
- [MultiStep Checks](references/multistep-checks.md) - MultiStepCheck construct for complex user flows
|
|
90
|
+
- [Uptime Monitors](references/uptime-monitors.md) - TCP (`TcpMonitor`), URL (`UrlMonitor`), DNS (`DnsMonitor`), ICMP (`IcmpMonitor`), and Heartbeat monitors (`HeartbeatMonitor`)
|
|
91
|
+
- [Check Groups](references/check-groups.md) - CheckGroupV2 construct for organizing checks
|
|
92
|
+
- [Alert Channels](references/alert-channels.md) - Email, Phone, and Slack alert channels
|
|
93
|
+
- [Supporting Constructs](references/supporting-constructs.md) - Status pages, dashboards, maintenance windows, and private locations
|
|
641
94
|
|
|
642
95
|
## Testing and Debugging
|
|
643
96
|
|
|
644
|
-
- Test checks using `npx checkly test` command
|
|
97
|
+
- Test checks using the `npx checkly test` command. Pass environment variables with the `-e` flag, use `--record` to persist results, and use `--verbose` to see all errors.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Alert Channels
|
|
2
|
+
|
|
3
|
+
- Alert channels are used to send notifications when checks and monitors fail or recover.
|
|
4
|
+
- Alert channels are added to checks, monitors, and check groups constructs by adding them to the `alertChannels` array property.
|
|
5
|
+
|
|
6
|
+
Here are some examples of how to create different types of alert channels.
|
|
7
|
+
|
|
8
|
+
All available alerts are described in the [Checkly docs](https://www.checklyhq.com/docs/constructs/overview/).
|
|
9
|
+
|
|
10
|
+
*Important*: Don't make up email addresses, phone numbers, Slack URLs or similar static values. Scan the project to discover a valid configuration or ask what the values should be.
|
|
11
|
+
|
|
12
|
+
## Email Alert Channel
|
|
13
|
+
|
|
14
|
+
**Reference:** https://www.checklyhq.com/docs/constructs/email-alert-channel/
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import { EmailAlertChannel } from 'checkly/constructs'
|
|
18
|
+
|
|
19
|
+
export const testEmailAlert = new EmailAlertChannel('example-email-alert-channel', {
|
|
20
|
+
address: 'test@example.com',
|
|
21
|
+
sslExpiry: true,
|
|
22
|
+
})
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Phone Call Alert Channel
|
|
26
|
+
|
|
27
|
+
**Reference:** https://www.checklyhq.com/docs/constructs/phone-call-alert-channel/
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { PhoneCallAlertChannel } from 'checkly/constructs'
|
|
31
|
+
|
|
32
|
+
export const testUserPhoneCallAlert = new PhoneCallAlertChannel('example-call-alert-channel', {
|
|
33
|
+
name: 'Test User',
|
|
34
|
+
phoneNumber: 'INSERT_PHONE_NUMBER',
|
|
35
|
+
})
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Slack Alert Channel
|
|
39
|
+
|
|
40
|
+
**Reference:** https://www.checklyhq.com/docs/constructs/slack-alert-channel/
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
import { SlackAlertChannel } from 'checkly/constructs'
|
|
44
|
+
|
|
45
|
+
export const generalSlackAlert = new SlackAlertChannel('example-slack-alert-channel', {
|
|
46
|
+
url: 'INSERT_SLACK_URL',
|
|
47
|
+
channel: '#general',
|
|
48
|
+
})
|
|
49
|
+
```
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# API Checks
|
|
2
|
+
|
|
3
|
+
- Import the `ApiCheck` construct from `checkly/constructs`.
|
|
4
|
+
- When adding `assertions`, always use `AssertionBuilder` class for API Checks.
|
|
5
|
+
- When referencing environment variables always use the handlebar syntax `{{MY_ENV_VAR}}`.
|
|
6
|
+
- When referencing secrets always use the handlebar syntax `{{MY_SECRET}}`.
|
|
7
|
+
- If endpoints require authentication ask the user which authentication method to use and then generate a setupScript to authenticate the given requests.
|
|
8
|
+
- Referenced `setup-script.ts` and `teardown-script.ts` for API checks must be plain ts files and not export anything.
|
|
9
|
+
- Check in the code if API endpoints require authentication.
|
|
10
|
+
|
|
11
|
+
**Reference:** https://www.checklyhq.com/docs/constructs/api-check/
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { AlertEscalationBuilder, ApiCheck, Frequency, RetryStrategyBuilder } from 'checkly/constructs'
|
|
15
|
+
|
|
16
|
+
new ApiCheck('example-api-check', {
|
|
17
|
+
name: 'Example API Check',
|
|
18
|
+
setupScript: {
|
|
19
|
+
entrypoint: './setup-script.ts',
|
|
20
|
+
},
|
|
21
|
+
tearDownScript: {
|
|
22
|
+
entrypoint: './teardown-script.ts',
|
|
23
|
+
},
|
|
24
|
+
degradedResponseTime: 5000,
|
|
25
|
+
maxResponseTime: 20000,
|
|
26
|
+
activated: true,
|
|
27
|
+
locations: [
|
|
28
|
+
'eu-central-1',
|
|
29
|
+
'eu-west-2',
|
|
30
|
+
],
|
|
31
|
+
frequency: Frequency.EVERY_5M,
|
|
32
|
+
alertEscalationPolicy: AlertEscalationBuilder.runBasedEscalation(1, {
|
|
33
|
+
amount: 0,
|
|
34
|
+
interval: 5,
|
|
35
|
+
}, {
|
|
36
|
+
enabled: false,
|
|
37
|
+
percentage: 10,
|
|
38
|
+
}),
|
|
39
|
+
retryStrategy: RetryStrategyBuilder.linearStrategy({
|
|
40
|
+
baseBackoffSeconds: 60,
|
|
41
|
+
maxRetries: 2,
|
|
42
|
+
maxDurationSeconds: 600,
|
|
43
|
+
sameRegion: true,
|
|
44
|
+
}),
|
|
45
|
+
runParallel: true,
|
|
46
|
+
request: {
|
|
47
|
+
url: 'https://api.example.com/v1/products',
|
|
48
|
+
method: 'GET',
|
|
49
|
+
},
|
|
50
|
+
})
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Authentication Setup Scripts for API Checks
|
|
54
|
+
|
|
55
|
+
- Setup scripts should be flat scripts, no functions, no exports, they will be executed straight by Checkly.
|
|
56
|
+
- Use axios for making HTTP requests.
|
|
57
|
+
- Read the input credentials from env variables using `process.env`.
|
|
58
|
+
- Pass auth tokens to the request object using `request.headers['key'] = AUTH_TOKEN_VALUE`.
|