Skip to content

Commit 0edf322

Browse files
Add support to retry a canary automatically after schedule run failures. Users can enable this feature by configuring the RetryConfig field when calling the CreateCanary or UpdateCanary API. Also includes changes in GetCanary and GetCanaryRuns to support retrieving retry configurations.
1 parent 5f9d100 commit 0edf322

18 files changed

+565
-11
lines changed

generator/ServiceModels/synthetics/synthetics-2017-10-11.api.json

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,8 @@
494494
"type":"structure",
495495
"members":{
496496
"Id":{"shape":"UUID"},
497+
"ScheduledRunId":{"shape":"UUID"},
498+
"RetryAttempt":{"shape":"RetryAttempt"},
497499
"Name":{"shape":"CanaryName"},
498500
"Status":{"shape":"CanaryRunStatus"},
499501
"Timeline":{"shape":"CanaryRunTimeline"},
@@ -545,7 +547,8 @@
545547
"type":"structure",
546548
"members":{
547549
"Started":{"shape":"Timestamp"},
548-
"Completed":{"shape":"Timestamp"}
550+
"Completed":{"shape":"Timestamp"},
551+
"MetricTimestampForRunAndRetries":{"shape":"Timestamp"}
549552
}
550553
},
551554
"CanaryRuns":{
@@ -557,14 +560,16 @@
557560
"required":["Expression"],
558561
"members":{
559562
"Expression":{"shape":"String"},
560-
"DurationInSeconds":{"shape":"MaxOneYearInSeconds"}
563+
"DurationInSeconds":{"shape":"MaxOneYearInSeconds"},
564+
"RetryConfig":{"shape":"RetryConfigInput"}
561565
}
562566
},
563567
"CanaryScheduleOutput":{
564568
"type":"structure",
565569
"members":{
566570
"Expression":{"shape":"String"},
567-
"DurationInSeconds":{"shape":"MaxOneYearInSeconds"}
571+
"DurationInSeconds":{"shape":"MaxOneYearInSeconds"},
572+
"RetryConfig":{"shape":"RetryConfigOutput"}
568573
}
569574
},
570575
"CanaryState":{
@@ -1030,6 +1035,11 @@
10301035
"max":31622400,
10311036
"min":0
10321037
},
1038+
"MaxRetries":{
1039+
"type":"integer",
1040+
"max":2,
1041+
"min":0
1042+
},
10331043
"MaxSize100":{
10341044
"type":"integer",
10351045
"max":100,
@@ -1099,6 +1109,24 @@
10991109
"type":"string",
11001110
"enum":["lambda-function"]
11011111
},
1112+
"RetryAttempt":{
1113+
"type":"integer",
1114+
"max":2,
1115+
"min":1
1116+
},
1117+
"RetryConfigInput":{
1118+
"type":"structure",
1119+
"required":["MaxRetries"],
1120+
"members":{
1121+
"MaxRetries":{"shape":"MaxRetries"}
1122+
}
1123+
},
1124+
"RetryConfigOutput":{
1125+
"type":"structure",
1126+
"members":{
1127+
"MaxRetries":{"shape":"MaxRetries"}
1128+
}
1129+
},
11021130
"RoleArn":{
11031131
"type":"string",
11041132
"max":2048,

generator/ServiceModels/synthetics/synthetics-2017-10-11.docs.json

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@
232232
"CanaryStateReasonCode": {
233233
"base": null,
234234
"refs": {
235-
"CanaryStatus$StateReasonCode": "<p>If the canary cannot run or has failed, this field displays the reason.</p>"
235+
"CanaryStatus$StateReasonCode": "<p>If the canary creation or update failed, this field displays the reason code.</p>"
236236
}
237237
},
238238
"CanaryStatus": {
@@ -529,6 +529,13 @@
529529
"CanaryScheduleOutput$DurationInSeconds": "<p>How long, in seconds, for the canary to continue making regular runs after it was created. The runs are performed according to the schedule in the <code>Expression</code> value.</p>"
530530
}
531531
},
532+
"MaxRetries": {
533+
"base": null,
534+
"refs": {
535+
"RetryConfigInput$MaxRetries": "<p>The maximum number of retries. The value must be less than or equal to 2.</p>",
536+
"RetryConfigOutput$MaxRetries": "<p>The maximum number of retries. The value must be less than or equal to 2.</p>"
537+
}
538+
},
532539
"MaxSize100": {
533540
"base": null,
534541
"refs": {
@@ -617,6 +624,24 @@
617624
"ResourceList$member": null
618625
}
619626
},
627+
"RetryAttempt": {
628+
"base": null,
629+
"refs": {
630+
"CanaryRun$RetryAttempt": "<p>The count in number of the retry attempt.</p>"
631+
}
632+
},
633+
"RetryConfigInput": {
634+
"base": "<p>This structure contains information about the canary's retry configuration.</p> <note> <p>The default account level concurrent execution limit from Lambda is 1000. When you have more than 1000 canaries, it's possible there are more than 1000 Lambda invocations due to retries and the console might hang. For more information on the Lambda execution limit, see <a href=\"https://docs.aws.amazon.com/lambda/latest/dg/lambda-concurrency.html#:~:text=As%20your%20functions%20receive%20more,functions%20in%20an%20AWS%20Region\">Understanding Lambda function scaling</a>.</p> </note> <note> <p>For canary with <code>MaxRetries = 2</code>, you need to set the <code>CanaryRunConfigInput.TimeoutInSeconds</code> to less than 600 seconds to avoid validation errors.</p> </note>",
635+
"refs": {
636+
"CanaryScheduleInput$RetryConfig": "<p>A structure that contains the retry configuration for a canary</p>"
637+
}
638+
},
639+
"RetryConfigOutput": {
640+
"base": "<p>This structure contains information about the canary's retry configuration.</p>",
641+
"refs": {
642+
"CanaryScheduleOutput$RetryConfig": "<p>A structure that contains the retry configuration for a canary</p>"
643+
}
644+
},
620645
"RoleArn": {
621646
"base": null,
622647
"refs": {
@@ -707,7 +732,7 @@
707732
"CanaryRunStatus$StateReason": "<p>If run of the canary failed, this field contains the reason for the error.</p>",
708733
"CanaryScheduleInput$Expression": "<p>A <code>rate</code> expression or a <code>cron</code> expression that defines how often the canary is to run.</p> <p>For a rate expression, The syntax is <code>rate(<i>number unit</i>)</code>. <i>unit</i> can be <code>minute</code>, <code>minutes</code>, or <code>hour</code>. </p> <p>For example, <code>rate(1 minute)</code> runs the canary once a minute, <code>rate(10 minutes)</code> runs it once every 10 minutes, and <code>rate(1 hour)</code> runs it once every hour. You can specify a frequency between <code>rate(1 minute)</code> and <code>rate(1 hour)</code>.</p> <p>Specifying <code>rate(0 minute)</code> or <code>rate(0 hour)</code> is a special value that causes the canary to run only once when it is started.</p> <p>Use <code>cron(<i>expression</i>)</code> to specify a cron expression. You can't schedule a canary to wait for more than a year before running. For information about the syntax for cron expressions, see <a href=\"https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_cron.html\"> Scheduling canary runs using cron</a>.</p>",
709734
"CanaryScheduleOutput$Expression": "<p>A <code>rate</code> expression or a <code>cron</code> expression that defines how often the canary is to run.</p> <p>For a rate expression, The syntax is <code>rate(<i>number unit</i>)</code>. <i>unit</i> can be <code>minute</code>, <code>minutes</code>, or <code>hour</code>. </p> <p>For example, <code>rate(1 minute)</code> runs the canary once a minute, <code>rate(10 minutes)</code> runs it once every 10 minutes, and <code>rate(1 hour)</code> runs it once every hour. You can specify a frequency between <code>rate(1 minute)</code> and <code>rate(1 hour)</code>.</p> <p>Specifying <code>rate(0 minute)</code> or <code>rate(0 hour)</code> is a special value that causes the canary to run only once when it is started.</p> <p>Use <code>cron(<i>expression</i>)</code> to specify a cron expression. For information about the syntax for cron expressions, see <a href=\"https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_cron.html\"> Scheduling canary runs using cron</a>.</p>",
710-
"CanaryStatus$StateReason": "<p>If the canary has insufficient permissions to run, this field provides more details.</p>",
735+
"CanaryStatus$StateReason": "<p>If the canary creation or update failed, this field provides details on the failure.</p>",
711736
"CreateCanaryRequest$ArtifactS3Location": "<p>The location in Amazon S3 where Synthetics stores artifacts from the test runs of this canary. Artifacts include the log file, screenshots, and HAR files. The name of the S3 bucket can't include a period (.).</p>",
712737
"CreateCanaryRequest$RuntimeVersion": "<p>Specifies the runtime version to use for the canary. For a list of valid runtime versions and more information about runtime versions, see <a href=\"https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries_Library.html\"> Canary Runtime Versions</a>.</p>",
713738
"DryRunConfigOutput$LastDryRunExecutionStatus": "<p>Returns the last execution status for a canary's dry run.</p>",
@@ -786,6 +811,7 @@
786811
"refs": {
787812
"CanaryRunTimeline$Started": "<p>The start time of the run.</p>",
788813
"CanaryRunTimeline$Completed": "<p>The end time of the run.</p>",
814+
"CanaryRunTimeline$MetricTimestampForRunAndRetries": "<p>The time at which the metrics will be generated for this run or retries.</p>",
789815
"CanaryTimeline$Created": "<p>The date and time the canary was created.</p>",
790816
"CanaryTimeline$LastModified": "<p>The date and time the canary was most recently modified.</p>",
791817
"CanaryTimeline$LastStarted": "<p>The date and time that the canary's most recent run started.</p>",
@@ -805,7 +831,7 @@
805831
"DescribeCanariesResponse$NextToken": "<p>A token that indicates that there is more data available. You can use this token in a subsequent <code>DescribeCanaries</code> operation to retrieve the next set of results.</p>",
806832
"DescribeRuntimeVersionsRequest$NextToken": "<p>A token that indicates that there is more data available. You can use this token in a subsequent <code>DescribeRuntimeVersions</code> operation to retrieve the next set of results.</p>",
807833
"DescribeRuntimeVersionsResponse$NextToken": "<p>A token that indicates that there is more data available. You can use this token in a subsequent <code>DescribeRuntimeVersions</code> operation to retrieve the next set of results.</p>",
808-
"GetCanaryRunsRequest$NextToken": "<p>A token that indicates that there is more data available. You can use this token in a subsequent <code>GetCanaryRuns</code> operation to retrieve the next set of results.</p>",
834+
"GetCanaryRunsRequest$NextToken": "<p>A token that indicates that there is more data available. You can use this token in a subsequent <code>GetCanaryRuns</code> operation to retrieve the next set of results.</p> <note> <p>When auto retry is enabled for the canary, the first subsequent retry is suffixed with *1 indicating its the first retry and the next subsequent try is suffixed with *2.</p> </note>",
809835
"GetCanaryRunsResponse$NextToken": "<p>A token that indicates that there is more data available. You can use this token in a subsequent <code>GetCanaryRuns</code> operation to retrieve the next set of results.</p>",
810836
"ListGroupsResponse$NextToken": "<p>A token that indicates that there is more data available. You can use this token in a subsequent <code>ListGroups</code> operation to retrieve the next set of results.</p>"
811837
}
@@ -820,6 +846,7 @@
820846
"Canary$Id": "<p>The unique ID of this canary.</p>",
821847
"CanaryDryRunConfigOutput$DryRunId": "<p>The DryRunId associated with an existing canary’s dry run. You can use this DryRunId to retrieve information about the dry run.</p>",
822848
"CanaryRun$Id": "<p>A unique ID that identifies this canary run.</p>",
849+
"CanaryRun$ScheduledRunId": "<p>The ID of the scheduled canary run.</p>",
823850
"DryRunConfigOutput$DryRunId": "<p>The DryRunId associated with an existing canary’s dry run. You can use this DryRunId to retrieve information about the dry run.</p>",
824851
"GetCanaryRequest$DryRunId": "<p>The DryRunId associated with an existing canary’s dry run. You can use this DryRunId to retrieve information about the dry run.</p>",
825852
"GetCanaryRunsRequest$DryRunId": "<p>The DryRunId associated with an existing canary’s dry run. You can use this DryRunId to retrieve information about the dry run.</p>",

generator/ServiceModels/synthetics/synthetics-2017-10-11.normal.json

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,14 @@
623623
"shape":"UUID",
624624
"documentation":"<p>A unique ID that identifies this canary run.</p>"
625625
},
626+
"ScheduledRunId":{
627+
"shape":"UUID",
628+
"documentation":"<p>The ID of the scheduled canary run.</p>"
629+
},
630+
"RetryAttempt":{
631+
"shape":"RetryAttempt",
632+
"documentation":"<p>The count in number of the retry attempt.</p>"
633+
},
626634
"Name":{
627635
"shape":"CanaryName",
628636
"documentation":"<p>The name of the canary.</p>"
@@ -729,6 +737,10 @@
729737
"Completed":{
730738
"shape":"Timestamp",
731739
"documentation":"<p>The end time of the run.</p>"
740+
},
741+
"MetricTimestampForRunAndRetries":{
742+
"shape":"Timestamp",
743+
"documentation":"<p>The time at which the metrics will be generated for this run or retries.</p>"
732744
}
733745
},
734746
"documentation":"<p>This structure contains the start and end times of a single canary run.</p>"
@@ -748,6 +760,10 @@
748760
"DurationInSeconds":{
749761
"shape":"MaxOneYearInSeconds",
750762
"documentation":"<p>How long, in seconds, for the canary to continue making regular runs according to the schedule in the <code>Expression</code> value. If you specify 0, the canary continues making runs until you stop it. If you omit this field, the default of 0 is used.</p>"
763+
},
764+
"RetryConfig":{
765+
"shape":"RetryConfigInput",
766+
"documentation":"<p>A structure that contains the retry configuration for a canary</p>"
751767
}
752768
},
753769
"documentation":"<p>This structure specifies how often a canary is to make runs and the date and time when it should stop making runs.</p>"
@@ -762,6 +778,10 @@
762778
"DurationInSeconds":{
763779
"shape":"MaxOneYearInSeconds",
764780
"documentation":"<p>How long, in seconds, for the canary to continue making regular runs after it was created. The runs are performed according to the schedule in the <code>Expression</code> value.</p>"
781+
},
782+
"RetryConfig":{
783+
"shape":"RetryConfigOutput",
784+
"documentation":"<p>A structure that contains the retry configuration for a canary</p>"
765785
}
766786
},
767787
"documentation":"<p>How long, in seconds, for the canary to continue making regular runs according to the schedule in the <code>Expression</code> value.</p>"
@@ -806,11 +826,11 @@
806826
},
807827
"StateReason":{
808828
"shape":"String",
809-
"documentation":"<p>If the canary has insufficient permissions to run, this field provides more details.</p>"
829+
"documentation":"<p>If the canary creation or update failed, this field provides details on the failure.</p>"
810830
},
811831
"StateReasonCode":{
812832
"shape":"CanaryStateReasonCode",
813-
"documentation":"<p>If the canary cannot run or has failed, this field displays the reason.</p>"
833+
"documentation":"<p>If the canary creation or update failed, this field displays the reason code.</p>"
814834
}
815835
},
816836
"documentation":"<p>A structure that contains the current state of the canary.</p>"
@@ -1189,7 +1209,7 @@
11891209
},
11901210
"NextToken":{
11911211
"shape":"Token",
1192-
"documentation":"<p>A token that indicates that there is more data available. You can use this token in a subsequent <code>GetCanaryRuns</code> operation to retrieve the next set of results.</p>"
1212+
"documentation":"<p>A token that indicates that there is more data available. You can use this token in a subsequent <code>GetCanaryRuns</code> operation to retrieve the next set of results.</p> <note> <p>When auto retry is enabled for the canary, the first subsequent retry is suffixed with *1 indicating its the first retry and the next subsequent try is suffixed with *2.</p> </note>"
11931213
},
11941214
"MaxResults":{
11951215
"shape":"MaxSize100",
@@ -1464,6 +1484,11 @@
14641484
"max":31622400,
14651485
"min":0
14661486
},
1487+
"MaxRetries":{
1488+
"type":"integer",
1489+
"max":2,
1490+
"min":0
1491+
},
14671492
"MaxSize100":{
14681493
"type":"integer",
14691494
"max":100,
@@ -1536,6 +1561,32 @@
15361561
"type":"string",
15371562
"enum":["lambda-function"]
15381563
},
1564+
"RetryAttempt":{
1565+
"type":"integer",
1566+
"max":2,
1567+
"min":1
1568+
},
1569+
"RetryConfigInput":{
1570+
"type":"structure",
1571+
"required":["MaxRetries"],
1572+
"members":{
1573+
"MaxRetries":{
1574+
"shape":"MaxRetries",
1575+
"documentation":"<p>The maximum number of retries. The value must be less than or equal to 2.</p>"
1576+
}
1577+
},
1578+
"documentation":"<p>This structure contains information about the canary's retry configuration.</p> <note> <p>The default account level concurrent execution limit from Lambda is 1000. When you have more than 1000 canaries, it's possible there are more than 1000 Lambda invocations due to retries and the console might hang. For more information on the Lambda execution limit, see <a href=\"https://docs.aws.amazon.com/lambda/latest/dg/lambda-concurrency.html#:~:text=As%20your%20functions%20receive%20more,functions%20in%20an%20AWS%20Region\">Understanding Lambda function scaling</a>.</p> </note> <note> <p>For canary with <code>MaxRetries = 2</code>, you need to set the <code>CanaryRunConfigInput.TimeoutInSeconds</code> to less than 600 seconds to avoid validation errors.</p> </note>"
1579+
},
1580+
"RetryConfigOutput":{
1581+
"type":"structure",
1582+
"members":{
1583+
"MaxRetries":{
1584+
"shape":"MaxRetries",
1585+
"documentation":"<p>The maximum number of retries. The value must be less than or equal to 2.</p>"
1586+
}
1587+
},
1588+
"documentation":"<p>This structure contains information about the canary's retry configuration.</p>"
1589+
},
15391590
"RoleArn":{
15401591
"type":"string",
15411592
"max":2048,

sdk/code-analysis/ServiceAnalysis/Synthetics/Generated/PropertyValueRules.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,15 @@
422422
<max>255</max>
423423
<pattern>^[0-9a-z_\-]+$</pattern>
424424
</property-value-rule>
425+
<property-value-rule>
426+
<property>Amazon.Synthetics.Model.CanaryRun.RetryAttempt</property>
427+
<min>1</min>
428+
<max>2</max>
429+
</property-value-rule>
430+
<property-value-rule>
431+
<property>Amazon.Synthetics.Model.CanaryRun.ScheduledRunId</property>
432+
<pattern>^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$</pattern>
433+
</property-value-rule>
425434
<property-value-rule>
426435
<property>Amazon.Synthetics.Model.CanaryRunConfigInput.MemoryInMB</property>
427436
<min>960</min>
@@ -513,6 +522,16 @@
513522
<min>1</min>
514523
<max>64</max>
515524
</property-value-rule>
525+
<property-value-rule>
526+
<property>Amazon.Synthetics.Model.RetryConfigInput.MaxRetries</property>
527+
<min>0</min>
528+
<max>2</max>
529+
</property-value-rule>
530+
<property-value-rule>
531+
<property>Amazon.Synthetics.Model.RetryConfigOutput.MaxRetries</property>
532+
<min>0</min>
533+
<max>2</max>
534+
</property-value-rule>
516535
<property-value-rule>
517536
<property>Amazon.Synthetics.Model.RuntimeVersion.Description</property>
518537
<min>1</min>

sdk/src/Services/Synthetics/Generated/Model/CanaryRun.cs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ public partial class CanaryRun
3838
private CanaryDryRunConfigOutput _dryRunConfig;
3939
private string _id;
4040
private string _name;
41+
private int? _retryAttempt;
42+
private string _scheduledRunId;
4143
private CanaryRunStatus _status;
4244
private CanaryRunTimeline _timeline;
4345

@@ -116,6 +118,43 @@ internal bool IsSetName()
116118
return this._name != null;
117119
}
118120

121+
/// <summary>
122+
/// Gets and sets the property RetryAttempt.
123+
/// <para>
124+
/// The count in number of the retry attempt.
125+
/// </para>
126+
/// </summary>
127+
[AWSProperty(Min=1, Max=2)]
128+
public int RetryAttempt
129+
{
130+
get { return this._retryAttempt.GetValueOrDefault(); }
131+
set { this._retryAttempt = value; }
132+
}
133+
134+
// Check to see if RetryAttempt property is set
135+
internal bool IsSetRetryAttempt()
136+
{
137+
return this._retryAttempt.HasValue;
138+
}
139+
140+
/// <summary>
141+
/// Gets and sets the property ScheduledRunId.
142+
/// <para>
143+
/// The ID of the scheduled canary run.
144+
/// </para>
145+
/// </summary>
146+
public string ScheduledRunId
147+
{
148+
get { return this._scheduledRunId; }
149+
set { this._scheduledRunId = value; }
150+
}
151+
152+
// Check to see if ScheduledRunId property is set
153+
internal bool IsSetScheduledRunId()
154+
{
155+
return this._scheduledRunId != null;
156+
}
157+
119158
/// <summary>
120159
/// Gets and sets the property Status.
121160
/// <para>

0 commit comments

Comments
 (0)