Skip to content

Commit 726616c

Browse files
Merge pull request #316 from serverless-operations/feature/fixed_timeout_alarm
fix: incorrect alarm time for ExecutionsTimedOut
2 parents cf15702 + ac55d43 commit 726616c

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ stepFunctions:
117117
alarm: arn:aws:sns:us-east-1:1234567890:NotifyMe
118118
insufficientData: arn:aws:sns:us-east-1:1234567890:NotifyMe
119119
metrics:
120-
- executionsTimeOut
120+
- executionsTimedOut
121121
- executionsFailed
122122
- executionsAborted
123123
- metric: executionThrottled
@@ -235,7 +235,7 @@ stepFunctions:
235235
alarm: arn:aws:sns:us-east-1:1234567890:NotifyMe
236236
insufficientData: arn:aws:sns:us-east-1:1234567890:NotifyMe
237237
metrics:
238-
- executionsTimeOut
238+
- executionsTimedOut
239239
- executionsFailed
240240
- executionsAborted
241241
- executionThrottled
@@ -257,7 +257,7 @@ The generated CloudWatch alarms would have the following configurations:
257257

258258
```yaml
259259
namespace: 'AWS/States'
260-
metric: <ExecutionsTimeOut | ExecutionsFailed | ExecutionsAborted | ExecutionThrottled>
260+
metric: <ExecutionsTimedOut | ExecutionsFailed | ExecutionsAborted | ExecutionThrottled>
261261
threshold: 1
262262
period: 60
263263
evaluationPeriods: 1
@@ -278,7 +278,7 @@ alarms:
278278
alarm: arn:aws:sns:us-east-1:1234567890:NotifyMe
279279
insufficientData: arn:aws:sns:us-east-1:1234567890:NotifyMe
280280
metrics:
281-
- executionsTimeOut
281+
- executionsTimedOut
282282
- executionsFailed
283283
- executionsAborted
284284
- metric: executionThrottled
@@ -1079,7 +1079,7 @@ stepFunctions:
10791079
definition:
10801080
```
10811081

1082-
It is also possible to use the [CloudFormation intrinsic functions](https://docs.aws.amazon.com/en_en/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.html) to reference resources from elsewhere. This allows for an IAM role to be created, and applied to the state machines all within the serverless file.
1082+
It is also possible to use the [CloudFormation intrinsic functions](https://docs.aws.amazon.com/en_en/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.html) to reference resources from elsewhere. This allows for an IAM role to be created, and applied to the state machines all within the serverless file.
10831083

10841084
The below example shows the policy needed if your step function needs the ability to send a message to an sqs queue. To apply the role either the RoleName can be used as a reference in the state machine, or the role ARN can be used like in the example above. It is important to note that if you want to store your state machine role at a certain path, this must be specified on the `Path` property on the new role.
10851085

lib/deploy/stepFunctions/compileAlarms.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ const Joi = require('@hapi/joi');
66
const schema = require('./compileAlarms.schema');
77

88
const cloudWatchMetricNames = {
9-
executionsTimeOut: 'ExecutionsTimeOut',
9+
executionsTimedOut: 'ExecutionsTimedOut',
1010
executionsFailed: 'ExecutionsFailed',
1111
executionsAborted: 'ExecutionsAborted',
1212
executionThrottled: 'ExecutionThrottled',
1313
};
1414

1515
const alarmDescriptions = {
16-
executionsTimeOut: 'executions timed out',
16+
executionsTimedOut: 'executions timed out',
1717
executionsFailed: 'executions failed',
1818
executionsAborted: 'executions were aborted',
1919
executionThrottled: 'execution were throttled',

lib/deploy/stepFunctions/compileAlarms.schema.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const treatMissingData = Joi.string()
2121
.default('missing');
2222

2323
const simpleMetric = Joi.string()
24-
.allow('executionsTimeOut', 'executionsFailed', 'executionsAborted', 'executionThrottled');
24+
.allow('executionsTimedOut', 'executionsFailed', 'executionsAborted', 'executionThrottled');
2525

2626
const complexMetric = Joi.object().keys({
2727
metric: simpleMetric.required(),

lib/deploy/stepFunctions/compileAlarms.test.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ describe('#compileAlarms', () => {
5656
insufficientData: '${self:service}-${opt:stage}-alerts-missing',
5757
},
5858
metrics: [
59-
'executionsTimeOut',
59+
'executionsTimedOut',
6060
'executionsFailed',
6161
'executionsAborted',
6262
'executionThrottled',
@@ -74,16 +74,16 @@ describe('#compileAlarms', () => {
7474
serverlessStepFunctions.compileAlarms();
7575
const resources = serverlessStepFunctions.serverless.service
7676
.provider.compiledCloudFormationTemplate.Resources;
77-
expect(resources).to.have.property('StateMachineBeta1ExecutionsTimeOutAlarm');
78-
validateCloudWatchAlarm(resources.StateMachineBeta1ExecutionsTimeOutAlarm);
77+
expect(resources).to.have.property('StateMachineBeta1ExecutionsTimedOutAlarm');
78+
validateCloudWatchAlarm(resources.StateMachineBeta1ExecutionsTimedOutAlarm);
7979
expect(resources).to.have.property('StateMachineBeta1ExecutionsFailedAlarm');
8080
validateCloudWatchAlarm(resources.StateMachineBeta1ExecutionsFailedAlarm);
8181
expect(resources).to.have.property('StateMachineBeta1ExecutionsAbortedAlarm');
8282
validateCloudWatchAlarm(resources.StateMachineBeta1ExecutionsAbortedAlarm);
8383
expect(resources).to.have.property('StateMachineBeta1ExecutionThrottledAlarm');
8484
validateCloudWatchAlarm(resources.StateMachineBeta1ExecutionThrottledAlarm);
85-
expect(resources).to.have.property('StateMachineBeta2ExecutionsTimeOutAlarm');
86-
validateCloudWatchAlarm(resources.StateMachineBeta2ExecutionsTimeOutAlarm);
85+
expect(resources).to.have.property('StateMachineBeta2ExecutionsTimedOutAlarm');
86+
validateCloudWatchAlarm(resources.StateMachineBeta2ExecutionsTimedOutAlarm);
8787
expect(resources).to.have.property('StateMachineBeta2ExecutionsFailedAlarm');
8888
validateCloudWatchAlarm(resources.StateMachineBeta2ExecutionsFailedAlarm);
8989
expect(resources).to.have.property('StateMachineBeta2ExecutionsAbortedAlarm');
@@ -137,7 +137,7 @@ describe('#compileAlarms', () => {
137137
},
138138
alarms: {
139139
metrics: [
140-
'executionsTimeOut',
140+
'executionsTimedOut',
141141
],
142142
},
143143
});
@@ -172,7 +172,7 @@ describe('#compileAlarms', () => {
172172
alarms: {
173173
topics: {},
174174
metrics: [
175-
'executionsTimeOut',
175+
'executionsTimedOut',
176176
],
177177
},
178178
});
@@ -288,7 +288,7 @@ describe('#compileAlarms', () => {
288288
insufficientData: '${self:service}-${opt:stage}-alerts-missing',
289289
},
290290
metrics: [
291-
'executionsTimeOut',
291+
'executionsTimedOut',
292292
'executionsFailed',
293293
'executionsAborted',
294294
'executionThrottled',
@@ -313,11 +313,11 @@ describe('#compileAlarms', () => {
313313
expect(resources[resourceName].Properties.TreatMissingData).to.equal('ignore');
314314
};
315315

316-
verify('StateMachineBeta1ExecutionsTimeOutAlarm');
316+
verify('StateMachineBeta1ExecutionsTimedOutAlarm');
317317
verify('StateMachineBeta1ExecutionsFailedAlarm');
318318
verify('StateMachineBeta1ExecutionsAbortedAlarm');
319319
verify('StateMachineBeta1ExecutionThrottledAlarm');
320-
verify('StateMachineBeta2ExecutionsTimeOutAlarm');
320+
verify('StateMachineBeta2ExecutionsTimedOutAlarm');
321321
verify('StateMachineBeta2ExecutionsFailedAlarm');
322322
verify('StateMachineBeta2ExecutionsAbortedAlarm');
323323
verify('StateMachineBeta2ExecutionThrottledAlarm');
@@ -344,7 +344,7 @@ describe('#compileAlarms', () => {
344344
insufficientData: '${self:service}-${opt:stage}-alerts-missing',
345345
},
346346
metrics: [
347-
'executionsTimeOut',
347+
'executionsTimedOut',
348348
{ metric: 'executionsFailed', treatMissingData: 'breaching' },
349349
'executionsAborted',
350350
'executionThrottled',
@@ -369,11 +369,11 @@ describe('#compileAlarms', () => {
369369
expect(resources[resourceName].Properties.TreatMissingData).to.equal(expectedConfig);
370370
};
371371

372-
verify('StateMachineBeta1ExecutionsTimeOutAlarm');
372+
verify('StateMachineBeta1ExecutionsTimedOutAlarm');
373373
verify('StateMachineBeta1ExecutionsFailedAlarm', 'breaching');
374374
verify('StateMachineBeta1ExecutionsAbortedAlarm');
375375
verify('StateMachineBeta1ExecutionThrottledAlarm');
376-
verify('StateMachineBeta2ExecutionsTimeOutAlarm');
376+
verify('StateMachineBeta2ExecutionsTimedOutAlarm');
377377
verify('StateMachineBeta2ExecutionsFailedAlarm', 'breaching');
378378
verify('StateMachineBeta2ExecutionsAbortedAlarm');
379379
verify('StateMachineBeta2ExecutionThrottledAlarm');

0 commit comments

Comments
 (0)