@@ -16,7 +16,7 @@ export default class App {
16
16
this . _capacityCalculator = new CapacityCalculator ( ) ;
17
17
}
18
18
19
- async runAsync ( event : any , context : any ) : Promise {
19
+ async runAsync ( event : any , context : any ) : Promise < void > {
20
20
invariant ( event != null , 'The argument \'event\' was null' ) ;
21
21
invariant ( context != null , 'The argument \'context\' was null' ) ;
22
22
@@ -48,11 +48,8 @@ export default class App {
48
48
this . _logMetrics ( tableDetails ) ;
49
49
50
50
// Return an empty response
51
- let response = null ;
52
51
if ( context ) {
53
- context . succeed ( response ) ;
54
- } else {
55
- return response ;
52
+ context . succeed ( null ) ;
56
53
}
57
54
}
58
55
@@ -103,7 +100,7 @@ export default class App {
103
100
return result ;
104
101
}
105
102
106
- async _updateTablesAsync ( tableUpdateRequests : UpdateTableRequest [ ] ) : Promise {
103
+ async _updateTablesAsync ( tableUpdateRequests : UpdateTableRequest [ ] ) : Promise < void > {
107
104
invariant ( tableUpdateRequests instanceof Array ,
108
105
'The argument \'tableUpdateRequests\' was not an array' ) ;
109
106
@@ -117,7 +114,7 @@ export default class App {
117
114
}
118
115
119
116
async _updateTableAsync ( tableUpdateRequest : UpdateTableRequest ,
120
- isRateLimitedUpdatingRequired : boolean ) : Promise {
117
+ isRateLimitedUpdatingRequired : boolean ) : Promise < void > {
121
118
invariant ( tableUpdateRequest != null , 'The argument \'tableUpdateRequest\' was null' ) ;
122
119
invariant ( typeof isRateLimitedUpdatingRequired === 'boolean' ,
123
120
'The argument \'isRateLimitedUpdatingRequired\' was not a boolean' ) ;
@@ -160,26 +157,38 @@ export default class App {
160
157
} ;
161
158
} , { ReadCapacityUnits : 0 , WriteCapacityUnits : 0 } ) ;
162
159
160
+ let indexHandler = stJSON [ 'Index.handler' ] != null ? {
161
+ mean : stJSON [ 'Index.handler' ] . histogram . mean
162
+ } : undefined ;
163
+
164
+ let dynamoDBListTablesAsync = stJSON [ 'DynamoDB.listTablesAsync' ] != null ? {
165
+ mean : stJSON [ 'DynamoDB.listTablesAsync' ] . histogram . mean ,
166
+ } : undefined ;
167
+
168
+ let dynamoDBDescribeTableAsync = stJSON [ 'DynamoDB.describeTableAsync' ] != null ? {
169
+ mean : stJSON [ 'DynamoDB.describeTableAsync' ] . histogram . mean ,
170
+ } : undefined ;
171
+
172
+ let dynamoDBDescribeTableConsumedCapacityAsync =
173
+ stJSON [ 'DynamoDB.describeTableConsumedCapacityAsync' ] != null ?
174
+ { mean : stJSON [ 'DynamoDB.describeTableConsumedCapacityAsync' ] . histogram . mean } :
175
+ undefined ;
176
+
177
+ let cloudWatchGetMetricStatisticsAsync =
178
+ stJSON [ 'CloudWatch.getMetricStatisticsAsync' ] != null ?
179
+ { mean : stJSON [ 'CloudWatch.getMetricStatisticsAsync' ] . histogram . mean } :
180
+ undefined ;
181
+
182
+ let tableUpdates = updateRequests != null ? { count : updateRequests . length } :
183
+ undefined ;
184
+
163
185
log ( JSON . stringify ( {
164
- 'Index.handler' : {
165
- mean : stJSON [ 'Index.handler' ] . histogram . mean
166
- } ,
167
- 'DynamoDB.listTablesAsync' : {
168
- mean : stJSON [ 'DynamoDB.listTablesAsync' ] . histogram . mean ,
169
- } ,
170
- 'DynamoDB.describeTableAsync' : {
171
- mean : stJSON [ 'DynamoDB.describeTableAsync' ] . histogram . mean ,
172
- } ,
173
- 'DynamoDB.describeTableConsumedCapacityAsync' : {
174
- mean : stJSON [ 'DynamoDB.describeTableConsumedCapacityAsync' ]
175
- . histogram . mean ,
176
- } ,
177
- 'CloudWatch.getMetricStatisticsAsync' : {
178
- mean : stJSON [ 'CloudWatch.getMetricStatisticsAsync' ] . histogram . mean ,
179
- } ,
180
- TableUpdates : {
181
- count : updateRequests . length ,
182
- } ,
186
+ 'Index.handler' : indexHandler ,
187
+ 'DynamoDB.listTablesAsync' : dynamoDBListTablesAsync ,
188
+ 'DynamoDB.describeTableAsync' : dynamoDBDescribeTableAsync ,
189
+ 'DynamoDB.describeTableConsumedCapacityAsync' : dynamoDBDescribeTableConsumedCapacityAsync ,
190
+ 'CloudWatch.getMetricStatisticsAsync' : cloudWatchGetMetricStatisticsAsync ,
191
+ TableUpdates : tableUpdates ,
183
192
TotalProvisionedThroughput : totalProvisionedThroughput ,
184
193
TotalMonthlyEstimatedCost : totalMonthlyEstimatedCost ,
185
194
} , null , json . padding ) ) ;
0 commit comments