Skip to content

Commit

Permalink
feat: add ExecutionSucceeded as a valid metric
Browse files Browse the repository at this point in the history
  • Loading branch information
Vishal Bhavsar committed Oct 14, 2020
1 parent 6a765b5 commit 820e298
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ stepFunctions:
- executionsAborted
- metric: executionThrottled
treatMissingData: breaching # overrides below default
- executionsSucceeded
treatMissingData: ignore # optional
hellostepfunc2:
definition:
Expand Down Expand Up @@ -254,6 +255,7 @@ stepFunctions:
- executionsFailed
- executionsAborted
- executionThrottled
- executionSucceeded
treatMissingData: missing
```

Expand Down Expand Up @@ -298,6 +300,7 @@ alarms:
- executionsAborted
- metric: executionThrottled
treatMissingData: breaching # override
- executionsSucceeded
treatMissingData: ignore # default
```

Expand Down
2 changes: 2 additions & 0 deletions lib/deploy/stepFunctions/compileAlarms.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ const cloudWatchMetricNames = {
executionsFailed: 'ExecutionsFailed',
executionsAborted: 'ExecutionsAborted',
executionThrottled: 'ExecutionThrottled',
executionSucceeded: 'ExecutionSucceeded',
};

const alarmDescriptions = {
executionsTimedOut: 'executions timed out',
executionsFailed: 'executions failed',
executionsAborted: 'executions were aborted',
executionThrottled: 'execution were throttled',
executionSucceeded: 'execution succeeded',
};

function getCloudWatchAlarms(
Expand Down
3 changes: 2 additions & 1 deletion lib/deploy/stepFunctions/compileAlarms.schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ const treatMissingData = Joi.string()
.default('missing');

const simpleMetric = Joi.string()
.allow('executionsTimedOut', 'executionsFailed', 'executionsAborted', 'executionThrottled');
.allow('executionsTimedOut', 'executionsFailed', 'executionsAborted', 'executionThrottled',
'executionSucceeded');

const complexMetric = Joi.object().keys({
metric: simpleMetric.required(),
Expand Down
3 changes: 3 additions & 0 deletions lib/deploy/stepFunctions/compileAlarms.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ describe('#compileAlarms', () => {
'executionsFailed',
'executionsAborted',
'executionThrottled',
'executionSucceeded',
],
},
});
Expand Down Expand Up @@ -296,6 +297,7 @@ describe('#compileAlarms', () => {
'executionsFailed',
'executionsAborted',
'executionThrottled',
'executionSucceeded',
],
treatMissingData: 'ignore',
},
Expand Down Expand Up @@ -352,6 +354,7 @@ describe('#compileAlarms', () => {
{ metric: 'executionsFailed', treatMissingData: 'breaching' },
'executionsAborted',
'executionThrottled',
'executionSucceeded',
],
treatMissingData: 'ignore',
},
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
"mocha-param": "^2.0.0",
"nyc": "^15.0.0",
"semantic-release": "^15.14.0",
"sinon": "^1.17.5",
"serverless": "^1.72.0"
"serverless": "^1.72.0",
"sinon": "^1.17.5"
},
"dependencies": {
"@hapi/joi": "^15.0.2",
Expand Down

0 comments on commit 820e298

Please sign in to comment.