checkly advanced
Advanced Checkly CLI features and patterns.
Retry Strategies
Fixed retry
import { RetryStrategyBuilder } from 'checkly/constructs'
retryStrategy: RetryStrategyBuilder.fixedStrategy({
baseBackoffSeconds: 60,
maxAttempts: 2,
maxDurationSeconds: 600,
sameRegion: true,
})
Linear backoff
retryStrategy: RetryStrategyBuilder.linearStrategy({
baseBackoffSeconds: 30,
maxAttempts: 3,
maxDurationSeconds: 600,
sameRegion: false,
})
Exponential backoff
retryStrategy: RetryStrategyBuilder.exponentialStrategy({
baseBackoffSeconds: 10,
maxAttempts: 5,
maxDurationSeconds: 1800,
sameRegion: true,
})
Conditional retries
// Retry only on network errors (API checks only)
retryStrategy: RetryStrategyBuilder.fixedStrategy({
maxAttempts: 2,
onlyOn: 'NETWORK_ERROR',
})
Reporters
List reporter (default)
npx checkly test --reporter=list
Dot reporter (compact)
npx checkly test --reporter=dot
JSON reporter
npx checkly test --reporter=json > results.json
GitHub Actions reporter
npx checkly test --reporter=github
CI reporter
npx checkly test --reporter=ci
Environment Variables
Global variables
// checkly.config.ts
checks: {
environmentVariables: [
{ key: 'API_URL', value: 'https://api.example.com' },
{ key: 'API_KEY', value: process.env.API_KEY!, locked: true },
],
}
Group-level variables
const group = new CheckGroup('api-group', {
environmentVariables: [
{ key: 'SERVICE', value: 'api' },
],
})
Check-level variables
new ApiCheck('check', {
environmentVariables: [
{ key: 'ENDPOINT', value: '/status' },
],
})
Validation Options
# Verify runtime dependencies
npx checkly test --verify-runtime-dependencies
# Show verbose output
npx checkly test --verbose
# Validate without running
npx checkly validate
Custom patterns
Dynamic check generation
const endpoints = ['users', 'products', 'orders']
endpoints.forEach(endpoint => {
new ApiCheck(`${endpoint}-api`, {
name: `${endpoint} API`,
request: {
url: `https://api.example.com/${endpoint}`,
},
})
})
Shared alert configurations
// alerts.ts
export const criticalAlerts = [emailChannel, slackChannel, pagerduty]
// check.ts
new ApiCheck('critical-check', {
alertChannels: criticalAlerts,
})
Related Skills
- See
checkly-constructsfor construct system details - See
checkly-testfor testing options - See
checkly-checksfor applying advanced features