From 20094a7953b2eba06ea56788bee90318c1fcd24c Mon Sep 17 00:00:00 2001 From: Manel Date: Fri, 1 Dec 2023 17:31:53 +0100 Subject: [PATCH 1/2] feat(parallel): support `runParallel` in checks and groups [sc-18210] --- packages/cli/src/constructs/check-group.ts | 7 +++++++ packages/cli/src/constructs/check.ts | 7 +++++++ packages/cli/src/services/checkly-config-loader.ts | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/constructs/check-group.ts b/packages/cli/src/constructs/check-group.ts index 0b8b1026..2c2a8331 100644 --- a/packages/cli/src/constructs/check-group.ts +++ b/packages/cli/src/constructs/check-group.ts @@ -107,6 +107,10 @@ export interface CheckGroupProps { * Sets a retry policy for the group. Use RetryStrategyBuilder to create a retry policy. */ retryStrategy?: RetryStrategy + /** + * Determines whether the checks in the group should run on all selected locations in parallel or round-robin. + */ + runParallel?: boolean } /** @@ -135,6 +139,7 @@ export class CheckGroup extends Construct { browserChecks?: BrowserCheckConfig multiStepChecks?: MultiStepCheckConfig retryStrategy?: RetryStrategy + runParallel?: boolean static readonly __checklyType = 'check-group' @@ -173,6 +178,7 @@ export class CheckGroup extends Construct { this.localSetupScript = props.localSetupScript this.localTearDownScript = props.localTearDownScript this.retryStrategy = props.retryStrategy + this.runParallel = props.runParallel // `browserChecks` is not a CheckGroup resource property. Not present in synthesize() this.browserChecks = props.browserChecks const fileAbsolutePath = Session.checkFileAbsolutePath! @@ -271,6 +277,7 @@ export class CheckGroup extends Construct { apiCheckDefaults: this.apiCheckDefaults, environmentVariables: this.environmentVariables, retryStrategy: this.retryStrategy, + runParallel: this.runParallel, } } } diff --git a/packages/cli/src/constructs/check.ts b/packages/cli/src/constructs/check.ts index 8dec2f2a..544c1a22 100644 --- a/packages/cli/src/constructs/check.ts +++ b/packages/cli/src/constructs/check.ts @@ -86,6 +86,10 @@ export interface CheckProps { * Sets a retry policy for the check. Use RetryStrategyBuilder to create a retry policy. */ retryStrategy?: RetryStrategy + /** + * Determines whether the check should run on all selected locations in parallel or round-robin. + */ + runParallel?: boolean } // This is an abstract class. It shouldn't be used directly. @@ -106,6 +110,7 @@ export abstract class Check extends Construct { alertChannels?: Array testOnly?: boolean retryStrategy?: RetryStrategy + runParallel?: boolean __checkFilePath?: string // internal variable to filter by check file name from the CLI static readonly __checklyType = 'check' @@ -142,6 +147,7 @@ export abstract class Check extends Construct { this.testOnly = props.testOnly ?? false this.retryStrategy = props.retryStrategy + this.runParallel = props.runParallel ?? false this.__checkFilePath = Session.checkFilePath } @@ -218,6 +224,7 @@ export abstract class Check extends Construct { groupId: this.groupId, environmentVariables: this.environmentVariables, retryStrategy: this.retryStrategy, + runParallel: this.runParallel, } } } diff --git a/packages/cli/src/services/checkly-config-loader.ts b/packages/cli/src/services/checkly-config-loader.ts index eafc2cd0..2cd0f73e 100644 --- a/packages/cli/src/services/checkly-config-loader.ts +++ b/packages/cli/src/services/checkly-config-loader.ts @@ -9,7 +9,7 @@ import { ReporterType } from '../reporters/reporter' export type CheckConfigDefaults = Pick + | 'alertChannels' | 'privateLocations' | 'retryStrategy' | 'runParallel'> export type ChecklyConfig = { /** From bb0101b260fd2c66d3ec6b068f9439dcb5470319 Mon Sep 17 00:00:00 2001 From: Manel Date: Thu, 14 Dec 2023 18:15:15 +0100 Subject: [PATCH 2/2] refactor: add docs link for scheduling strategies [sc-18210] --- packages/cli/src/constructs/check-group.ts | 5 +++-- packages/cli/src/constructs/check.ts | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/constructs/check-group.ts b/packages/cli/src/constructs/check-group.ts index 2c2a8331..0c2f5d16 100644 --- a/packages/cli/src/constructs/check-group.ts +++ b/packages/cli/src/constructs/check-group.ts @@ -108,8 +108,9 @@ export interface CheckGroupProps { */ retryStrategy?: RetryStrategy /** - * Determines whether the checks in the group should run on all selected locations in parallel or round-robin. - */ + * Determines whether the checks in the group should run on all selected locations in parallel or round-robin. + * See https://www.checklyhq.com/docs/monitoring/global-locations/ to learn more about scheduling strategies. + */ runParallel?: boolean } diff --git a/packages/cli/src/constructs/check.ts b/packages/cli/src/constructs/check.ts index 544c1a22..935e78ed 100644 --- a/packages/cli/src/constructs/check.ts +++ b/packages/cli/src/constructs/check.ts @@ -88,6 +88,7 @@ export interface CheckProps { retryStrategy?: RetryStrategy /** * Determines whether the check should run on all selected locations in parallel or round-robin. + * See https://www.checklyhq.com/docs/monitoring/global-locations/ to learn more about scheduling strategies. */ runParallel?: boolean }